2011

Dependencies:   mbed FastPWM

Revision:
33:91b17819ec30
Parent:
32:4b8c0fedaf2c
Child:
35:34ce7b0347b8
diff -r 4b8c0fedaf2c -r 91b17819ec30 CAN/function_CAN.cpp
--- a/CAN/function_CAN.cpp	Mon Nov 11 09:48:00 2019 +0000
+++ b/CAN/function_CAN.cpp	Tue Nov 12 11:29:36 2019 +0000
@@ -642,7 +642,20 @@
         }
         case CRX_SET_VALVE_CENTER_OFFSET: {
             VALVE_CENTER_OFFSET_times10 = (int16_t) (msg.data[1] | msg.data[2] << 8);
-            VALVE_CENTER_OFFSET = VALVE_CENTER_OFFSET_times10 * 0.1f;
+            VALVE_CENTER_OFFSET = ((float) VALVE_CENTER_OFFSET_times10) * 0.1f;
+            DDV_CENTER = DDV_CENTER + VALVE_CENTER_OFFSET;
+            ROM_RESET_DATA();
+            break;
+        }
+        case CRX_SET_VALVE_DZ_MINUS_OFFSET: {
+            VALVE_DZ_MINUS_OFFSET = ((float) ((int16_t) (msg.data[1] | msg.data[2] << 8))) * 0.1f;
+            VALVE_DEADZONE_MINUS = VALVE_DEADZONE_MINUS + VALVE_DZ_MINUS_OFFSET;
+            ROM_RESET_DATA();
+            break;
+        }
+        case CRX_SET_VALVE_DZ_PLUS_OFFSET: {
+            VALVE_DZ_PLUS_OFFSET = ((float) ((int16_t) (msg.data[1] | msg.data[2] << 8))) * 0.1f;
+            VALVE_DEADZONE_PLUS = VALVE_DEADZONE_PLUS + VALVE_DZ_PLUS_OFFSET;
             ROM_RESET_DATA();
             break;
         }
@@ -1161,7 +1174,7 @@
     int32_t valve_pos_vs_flowrate;
     valve_pos_vs_flowrate = (int32_t) (JOINT_VEL[canindex]);
 
-    int16_t VALVE_POS_VALVE_ID = ID_index_array[canindex] * 10 + DDV_CENTER;
+    int16_t VALVE_POS_VALVE_ID = ID_index_array[canindex] * 10 + (int) DDV_CENTER;
     
     temp_msg.id = CID_TX_INFO;
     temp_msg.len = 7;