20210203

Dependencies:   mbed FastPWM

Revision:
73:f80dc3970c99
Parent:
72:3436ce769b1e
Child:
85:a3b46118b5cd
--- a/CAN/function_CAN.cpp	Tue May 19 01:36:27 2020 +0000
+++ b/CAN/function_CAN.cpp	Mon Jun 08 11:00:23 2020 +0000
@@ -26,7 +26,7 @@
 extern float x_past[];
 extern float f_past[];
 extern float f_future[];
-extern float input[];
+extern float input_NN[];
 
 /*******************************************************************************
  * CAN functions
@@ -758,19 +758,19 @@
 
         int ind = 0;
         for(int i=0;i<numpast_x;i++){
-            input[ind] = x_past[2*i] / 60.0f;
+            input_NN[ind] = x_past[2*i] / 60.0f;
             ind = ind + 1;
         }
-        input[ind] = (pos.sen / ENC_PULSE_PER_POSITION) / 60.0f;
+        input_NN[ind] = (pos.sen / ENC_PULSE_PER_POSITION) / 60.0f;
         ind = ind + 1;
         for(int i=0;i<numpast_f;i++){
-            input[ind] = f_past[2*i] / 10000.0f + 0.5f;
+            input_NN[ind] = f_past[2*i] / 10000.0f + 0.5f;
             ind = ind + 1;
         }
-        input[ind] = torq.sen / 10000.0f + 0.5f;
+        input_NN[ind] = torq.sen / 10000.0f + 0.5f;
         ind = ind + 1;
         for(int i=0;i<numfuture_f;i++){
-            input[ind] = (f_future[2*i+2] - f_future[0])/10000.0f+0.5f;
+            input_NN[ind] = (f_future[2*i+2] - f_future[0])/10000.0f+0.5f;
             ind = ind + 1;
         }
         
@@ -1439,18 +1439,20 @@
     can.write(temp_msg);
 }
 
-void CAN_TX_VALVE_POSITION(int16_t t_valve_pos, int16_t t_ref_valve_pos, int16_t t_pwm)
+void CAN_TX_VALVE_POSITION(int16_t t_valve_pos_1, int16_t t_valve_pos_2, int16_t t_ref_valve_pos, int16_t t_pwm)
 {
     CANMessage temp_msg;
 
     temp_msg.id = CID_TX_VALVE_POSITION;
-    temp_msg.len = 6;
-    temp_msg.data[0] = (uint8_t) t_valve_pos;
-    temp_msg.data[1] = (uint8_t) (t_valve_pos >> 8);
-    temp_msg.data[2] = (uint8_t) t_ref_valve_pos;
-    temp_msg.data[3] = (uint8_t) (t_ref_valve_pos >> 8);
-    temp_msg.data[4] = (uint8_t) t_pwm;
-    temp_msg.data[5] = (uint8_t) (t_pwm >> 8);
+    temp_msg.len = 8;
+    temp_msg.data[0] = (uint8_t) t_valve_pos_1;
+    temp_msg.data[1] = (uint8_t) (t_valve_pos_1 >> 8);
+    temp_msg.data[2] = (uint8_t) t_valve_pos_2;
+    temp_msg.data[3] = (uint8_t) (t_valve_pos_2 >> 8);
+    temp_msg.data[4] = (uint8_t) t_ref_valve_pos;
+    temp_msg.data[5] = (uint8_t) (t_ref_valve_pos >> 8);
+    temp_msg.data[6] = (uint8_t) t_pwm;
+    temp_msg.data[7] = (uint8_t) (t_pwm >> 8);
     
 
     can.write(temp_msg);