[PATCH 2/6] Cochran: Added descriptors for early Commander
John Van Ostrand
john at vanostrand.com
Sat Jul 15 13:39:37 PDT 2017
No support but an initial patch to support Commander TM
dive computers.
---
src/cochran_commander.c | 38 +++++++++++++++++++++++++++++++++-----
src/cochran_commander_parser.c | 1 +
src/descriptor.c | 1 +
3 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/src/cochran_commander.c b/src/cochran_commander.c
index 3e125bb..bc10fc9 100644
--- a/src/cochran_commander.c
+++ b/src/cochran_commander.c
@@ -33,11 +33,12 @@
#define C_ARRAY_SIZE(array) (sizeof (array) / sizeof *(array))
-#define COCHRAN_MODEL_COMMANDER_PRE21000 0
-#define COCHRAN_MODEL_COMMANDER_AIR_NITROX 1
-#define COCHRAN_MODEL_EMC_14 2
-#define COCHRAN_MODEL_EMC_16 3
-#define COCHRAN_MODEL_EMC_20 4
+#define COCHRAN_MODEL_COMMANDER_TM 0
+#define COCHRAN_MODEL_COMMANDER_PRE21000 1
+#define COCHRAN_MODEL_COMMANDER_AIR_NITROX 2
+#define COCHRAN_MODEL_EMC_14 3
+#define COCHRAN_MODEL_EMC_16 4
+#define COCHRAN_MODEL_EMC_20 5
typedef enum cochran_endian_t {
ENDIAN_LE,
@@ -113,6 +114,29 @@ static const dc_device_vtable_t cochran_commander_device_vtable = {
cochran_commander_device_close /* close */
};
+// Cochran Commander TM, pre-dates pre-21000 s/n
+static const cochran_device_layout_t cochran_cmdr_tm_device_layout = {
+ COCHRAN_MODEL_COMMANDER_TM, // model
+ 24, // address_bits
+ ENDIAN_WORD_BE, // endian
+ 9600, // baudrate
+ 0x146, // cf_dive_count
+ 0x158, // cf_last_log
+ 0xffffff, // cf_last_interdive
+ 0x15c, // cf_serial_number
+ 0x000000, // rb_logbook_begin
+ 0x002328, // rb_logbook_end
+ 90, // rb_logbook_entry_size
+ 100, // rb_logbook_entry_count
+ 0x002328, // rb_profile_begin
+ 0x008000, // rb_profile_end
+ 15, // pt_fingerprint
+ 4, // fingerprint_size
+ 0, // pt_profile_pre
+ 0, // pt_profile_begin
+ 90, // pt_profile_end (Next begin pointer is the end)
+};
+
// Cochran Commander pre-21000 s/n
static const cochran_device_layout_t cochran_cmdr_1_device_layout = {
COCHRAN_MODEL_COMMANDER_PRE21000, // model
@@ -240,6 +264,7 @@ static unsigned int
cochran_commander_get_model (cochran_commander_device_t *device)
{
const cochran_commander_model_t models[] = {
+ {"\x01""12", COCHRAN_MODEL_COMMANDER_TM},
{"\x11""21", COCHRAN_MODEL_COMMANDER_PRE21000},
{"\x11""22", COCHRAN_MODEL_COMMANDER_AIR_NITROX},
{"730", COCHRAN_MODEL_EMC_14},
@@ -646,6 +671,9 @@ cochran_commander_device_open (dc_device_t **out, dc_context_t *context, const c
unsigned int model = cochran_commander_get_model(device);
switch (model) {
+ case COCHRAN_MODEL_COMMANDER_TM:
+ device->layout = &cochran_cmdr_tm_device_layout;
+ break;
case COCHRAN_MODEL_COMMANDER_PRE21000:
device->layout = &cochran_cmdr_1_device_layout;
break;
diff --git a/src/cochran_commander_parser.c b/src/cochran_commander_parser.c
index b58a6c4..b6ee17a 100644
--- a/src/cochran_commander_parser.c
+++ b/src/cochran_commander_parser.c
@@ -198,6 +198,7 @@ static const cochran_events_t cochran_events[] = {
{0xC3, 1, SAMPLE_EVENT_OLF, SAMPLE_FLAGS_NONE}, // CNS Oxygen toxicity warning
{0xC4, 1, SAMPLE_EVENT_MAXDEPTH, SAMPLE_FLAGS_NONE}, // Depth exceeds user set point
{0xC5, 1, SAMPLE_EVENT_NONE, SAMPLE_FLAGS_BEGIN}, // Entered decompression mode
+ {0xC7, 1, SAMPLE_EVENT_VIOLATION,SAMPLE_FLAGS_BEGIN}, // Entered Gauge mode (e.g. locked out)
{0xC8, 1, SAMPLE_EVENT_PO2, SAMPLE_FLAGS_BEGIN}, // PO2 too high
{0xCC, 1, SAMPLE_EVENT_NONE, SAMPLE_FLAGS_BEGIN}, // Low Cylinder 1 pressure
{0xCE, 1, SAMPLE_EVENT_NONE, SAMPLE_FLAGS_BEGIN}, // Non-decompression warning
diff --git a/src/descriptor.c b/src/descriptor.c
index 76157da..5093700 100644
--- a/src/descriptor.c
+++ b/src/descriptor.c
@@ -297,6 +297,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"Cochran", "EMC-14", DC_FAMILY_COCHRAN_COMMANDER, 2},
{"Cochran", "EMC-16", DC_FAMILY_COCHRAN_COMMANDER, 3},
{"Cochran", "EMC-20H", DC_FAMILY_COCHRAN_COMMANDER, 4},
+ {"Cochran", "Commander TM", DC_FAMILY_COCHRAN_COMMANDER, 5},
};
typedef struct dc_descriptor_iterator_t {
--
2.4.11
More information about the devel
mailing list