Mark Underwood / Mbed OS Internal_DataLogger_NoUSB_MAX32625PICO

Dependencies:   max32625pico CmdLine

Files at this revision

API Documentation at this revision

Comitter:
whismanoid
Date:
Tue Apr 26 01:57:08 2022 -0700
Parent:
59:89713c92669f
Child:
61:52456e705fa8
Commit message:
L@ parse_action_table_args fix logic error

Changed in this revision

DataLogger_Internal.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- a/DataLogger_Internal.cpp	Mon Apr 25 14:42:39 2022 -0700
+++ b/DataLogger_Internal.cpp	Tue Apr 26 01:57:08 2022 -0700
@@ -7479,27 +7479,6 @@
     // parse_and_remove_key() aliases to make editing easier
     char valueBuf[16];
     //
-    if (cmdLine.parse_int_dec("act", edit_action))
-    {
-        //~ cmdLine.serial().printf("\r\n  act=%d", edit_action);
-    }
-    if (cmdLine.parse_int_dec("pin", edit_digitalOutPin))
-    {
-        //~ cmdLine.serial().printf("\r\n  pin=%d", edit_digitalOutPin);
-    }
-    if (cmdLine.parse_int_dec("if", edit_condition))
-    {
-        //~ cmdLine.serial().printf("\r\n  if=%d", edit_condition);
-    }
-    if (cmdLine.parse_int_dec("ch", edit_condition_channel))
-    {
-        //~ cmdLine.serial().printf("\r\n  ch=%d", edit_condition_channel);
-    }
-    if (cmdLine.parse_double("x", edit_condition_threshold))
-    {
-        //~ cmdLine.serial().printf("\r\n  x=%d", edit_condition_threshold);
-    }
-    //
     // "nop" key alias for act=0 -- action_noop = 0                // no operation
     // bool parse_and_remove_key(const char *key, char *valueBuf, int valueBufLen);
     if (cmdLine.parse_and_remove_key("nop", valueBuf, sizeof(valueBuf)))
@@ -7607,7 +7586,7 @@
     // "AIN0nex=" alias for if=12 ch=$ x=_ -- condition_if_AINn_ne_threshold,  // (SPI_AIN_Voltage[channel] != threhsold)
     for (int channel_index = 0; (
         (channel_index < NUM_PLATFORM_ANALOG_IN_CHANNELS) 
-    &&  (channel_index < NUM_DUT_ANALOG_IN_CHANNELS)); 
+    ||  (channel_index < NUM_DUT_ANALOG_IN_CHANNELS)); 
         channel_index++)
     {
         char key[16];
@@ -7717,6 +7696,32 @@
         //
     } // end for (channel_index...)
     //
+
+    //
+    if (cmdLine.parse_int_dec("act", edit_action))
+    {
+        //~ cmdLine.serial().printf("\r\n  act=%d", edit_action);
+    }
+    if (cmdLine.parse_int_dec("pin", edit_digitalOutPin))
+    {
+        //~ cmdLine.serial().printf("\r\n  pin=%d", edit_digitalOutPin);
+    }
+    if (cmdLine.parse_int_dec("if", edit_condition))
+    {
+        //~ cmdLine.serial().printf("\r\n  if=%d", edit_condition);
+    }
+    if (cmdLine.parse_int_dec("ch", edit_condition_channel))
+    {
+        //~ cmdLine.serial().printf("\r\n  ch=%d", edit_condition_channel);
+    }
+    // the shortest key "x" must be tested last, to avoid interfering with keys where it's a substring
+    if (cmdLine.parse_double("x", edit_condition_threshold))
+    {
+        //~ cmdLine.serial().printf("\r\n  x=%d", edit_condition_threshold);
+    }
+    // DIAGNOSTIC
+    //~ cmdLine.serial().printf("\r\n parse_action_table_args() edit_action=%d edit_condition=%d edit_condition_channel=%d edit_condition_threshold=%1.3f \r\n", edit_action, edit_condition, edit_condition_channel, edit_condition_threshold);
+
 }
 #endif // USE_DATALOGGER_ActionTable
 
@@ -8482,11 +8487,11 @@
                             );
                         if (Datalogger_action_table_row_count < ACTION_TABLE_ROW_MAX) {
                             // if Datalogger_action_table_row_count => ACTION_TABLE_ROW_MAX then the table is full
-                            cmdLine.serial().printf("\r\n L@+ act=4 if=1 ch=5 x=12345 -- add new entry at end of table");
+                            cmdLine.serial().printf("\r\n L@+ Hpin=92 always -- add new entry at end of table");
                         }
                         if (Datalogger_action_table_row_count > 0) {
                             // if Datalogger_action_table_row_count == 0 then the table is empty
-                            cmdLine.serial().printf("\r\n L@%d act=4 if=1 ch=5 x=12345 -- edit row %d", 
+                            cmdLine.serial().printf("\r\n L@%d Lpin=92 A5gtx=12345 -- edit row %d", 
                                     Datalogger_action_table_row_count-1,
                                     Datalogger_action_table_row_count-1);
                             cmdLine.serial().printf("\r\n L@-%d -- delete row %d", 
--- a/mbed_app.json	Mon Apr 25 14:42:39 2022 -0700
+++ b/mbed_app.json	Tue Apr 26 01:57:08 2022 -0700
@@ -4,7 +4,7 @@
     "macros": [ 
         "MAX40108_DEMO=9",
         "BOARD_SERIAL_NUMBER=0",
-        "FW_REV=59",
+        "FW_REV=60",
         "HAS_FLASH_PEEK=1",
         "HAS_FLASH_POKE=1",
         "HAS_FLASH_LOAD_SAVE=1"