Browse Source

Added a commandline parapeter to the meas script to trigger the save default values functionality.

klaute 2 years ago
parent
commit
ac9f77d8d5
2 changed files with 10 additions and 2 deletions
  1. 2
    2
      firmware/command_ctrl.ino
  2. 8
    0
      tools/meas.py

+ 2
- 2
firmware/command_ctrl.ino View File

@@ -373,11 +373,11 @@ void cc_disableClk(void)
373 373
 
374 374
 void cc_saveDefaults(void)
375 375
 {
376
-  Serial.write(MSG_SOM1);
377
-  Serial.write(MSG_SOM2);
378 376
 
379 377
   saveEEPValues();
380 378
 
379
+  Serial.write(MSG_SOM1);
380
+  Serial.write(MSG_SOM2);
381 381
   Serial.write(MSG_TYPE_ANSWER_OK);
382 382
   Serial.write(MSG_EOM1);
383 383
   Serial.write(MSG_EOM2);

+ 8
- 0
tools/meas.py View File

@@ -33,6 +33,8 @@ parser.add_argument("-o", "--output_file", type=str, help="")
33 33
 parser.add_argument("-g", "--show_graph", default=False, help="", action='store_true')
34 34
 # get config
35 35
 parser.add_argument("-c", "--get_config", default=False, help="", action='store_true')
36
+# save default config
37
+parser.add_argument("-S", "--save_config", default=False, help="", action='store_true')
36 38
 
37 39
 ###############################################################################
38 40
 
@@ -60,6 +62,7 @@ CC_CMD_SET_DRIVE_STRENGTH = 0x04
60 62
 CC_CMD_SET_FREQ_STEP      = 0x05
61 63
 CC_CMD_START_MEASUREMENT  = 0x06
62 64
 CC_CMD_GET_CONFIG         = 0x10
65
+CC_CMD_SAV_DFLT           = 0x22
63 66
 
64 67
 ###############################################################################
65 68
 
@@ -451,6 +454,11 @@ if __name__ == "__main__":
451 454
     sendSerialData([CC_CMD_GET_CONFIG])
452 455
     dataSend = dataSend + 1
453 456
 
457
+  if args.save_config == True:
458
+    print "Save default configuration values..."
459
+    sendSerialData([CC_CMD_SAV_DFLT])
460
+    dataSend = dataSend + 1
461
+
454 462
   # 4. start main loop
455 463
   while dataSend > 0 and timeout < TIMEOUT_CNT_MAX:
456 464