ao-tools/ao-test-igniter: Deal with devices that use both 'apogee' for ADC
authorKeith Packard <keithp@keithp.com>
Thu, 16 Dec 2021 21:37:17 +0000 (13:37 -0800)
committerKeith Packard <keithp@keithp.com>
Tue, 11 Jan 2022 22:46:48 +0000 (14:46 -0800)
Some devices report drogue igniter ADC value with 'apogee' tag. Deal
with this.

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/ao-test-igniter/ao-test-igniter.c

index 17d5aad6451dd22d1ff874db4e2a525fc0f1d045..180defdb441a436af5a850d731bcee79cee95c3f 100644 (file)
@@ -82,6 +82,16 @@ map_igniter_name(char *adc_name, char *igniter_name)
        return true;
 }
 
+static const char *
+other_igniter_name(const char *name)
+{
+       if (!strcmp(name, "drogue"))
+               return "apogee";
+       if (!strcmp(name, "apogee"))
+               return "drogue";
+       return name;
+}
+
 static struct igniter *
 igniters(struct cc_usb *usb)
 {
@@ -115,7 +125,9 @@ igniters(struct cc_usb *usb)
                                if (found_igniter) {
                                        struct igniter *i;
                                        for (i = head; i; i = i->next)
-                                               if (!strcmp(i->name, igniter_name)) {
+                                               if (!strcmp(i->name, igniter_name) ||
+                                                   !strcmp(i->name, other_igniter_name(igniter_name)))
+                                               {
                                                        i->adc = atoi(tok);
                                                        break;
                                                }