Parcourir la source

sync to store sensor parameters

Juraj Ďuďák il y a 1 an
Parent
commit
3c9955a9bf
4 fichiers modifiés avec 21 ajouts et 15 suppressions
  1. 1 4
      Core/Src/main.c
  2. 1 1
      Modules/nbus
  3. 1 1
      Modules/one-wire-memory
  4. 18 9
      test/app.py

+ 1 - 4
Core/Src/main.c

@@ -290,9 +290,7 @@ int main(void)
   		DS28EC20_readData4B,
   		DS28EC20_readData2B,
   		DS28EC20_readData1B,
-  		DS28EC20_writeData4B, // TODO zamenit za DS28EC20_writeMem(data, size). Vyuzije sa pri formate
-  		DS28EC20_writeData2B,
-  		DS28EC20_writeData1B,
+  		DS28EC20_writeData,
 		DS28EC20_getId,
 		DS28EC20_getCapacity
   };
@@ -300,7 +298,6 @@ int main(void)
   memory_ec20.init(ONE_WIRE_GPIO_Port, ONE_WIRE_Pin);
   nbus_init_memory_driver(&memory_ec20);
 
-
   nbus_stack();
 
   /* USER CODE END 2 */

+ 1 - 1
Modules/nbus

@@ -1 +1 @@
-Subproject commit 04de35d2020a9d799e3020d9ed582f175639695d
+Subproject commit c8ce08de5dfdfac620d81952868f2cbcff5abf18

+ 1 - 1
Modules/one-wire-memory

@@ -1 +1 @@
-Subproject commit 8e9af68840ae9e80ad073ff6720424ef29158c6f
+Subproject commit 23a69c32eef6a51e023d9bf2e610a9bf13815c5f

+ 18 - 9
test/app.py

@@ -55,7 +55,6 @@ class AppTest:
     def cmd_sensor_cnt(self):
         print("SENSOR CNT")
         resp = self.serial_port.request(self.module, 0, CMD_SENSOR_CNT,[])        
-        print(resp)
         return resp[3]
 
     def cmd_sensor_type(self, index):
@@ -143,7 +142,11 @@ class AppTest:
 
     def cmd_reset(self):
         print("MODULE RESET")
-        resp = self.serial_port.request(self.module, 0, (SET+CMD_RESET),[], long_answer=1)
+        resp = self.serial_port.request(self.module, 0, (SET+CMD_RESET),[], long_answer=0.3)
+
+    def cmd_store(self, sensor):
+        print("MODULE STORE PARAM")
+        resp = self.serial_port.request(self.module, sensor, (SET+CMD_STORE),[], long_answer=0.1)
 
 if __name__ == "__main__":
     
@@ -155,11 +158,17 @@ if __name__ == "__main__":
     if app.cmd_echo([97,98,99,100]) == 0:
         sys.exit()
 
-    app.cmd_reset()
-    #app.cmd_set_param(1, PARAM_SAMPLERATE, 10)
-    #app.cmd_set_param(1, PARAM_RANGE, 1)
-    #app.cmd_set_param(1, PARAM_FILTER, 2)
-    
+    #app.cmd_reset()
+    store_param = False
+    if store_param:
+        app.cmd_set_param(1, PARAM_SAMPLERATE, 10)
+        app.cmd_set_param(1, PARAM_RANGE, 1)
+        app.cmd_set_param(1, PARAM_FILTER, 2)
+
+        app.cmd_store(1)
+        
+        sys.exit()
+
     for s in range(1):
         sr=app.cmd_get_param(s+1,PARAM_SAMPLERATE)
         r=app.cmd_get_param(s+1,PARAM_RANGE)
@@ -167,7 +176,7 @@ if __name__ == "__main__":
         ee=app.cmd_get_param(s+1,PARAM_GAIN)
         print(sr,r,lpf,ee)
     
-    sys.exit()
+    # sys.exit()
     #time.sleep(0.5)
     #app.cmd_module_stop()
     
@@ -180,7 +189,7 @@ if __name__ == "__main__":
     #sys.exit()
     print("pocet senzorov=", pocet)
     #app.cmd_sensor_get_data_FSR(pocet)    
-    for i in range(36):
+    for i in range(50):
         acc = app.cmd_sensor_get_data_IMU(1)
         gyr = app.cmd_sensor_get_data_IMU(2)
         print(acc)