rainbow

Dependencies:   mbed FastPWM

Revision:
23:59218d4a256d
Parent:
19:23b7c1ad8683
Child:
27:a2254a485f23
diff -r 966b35691d69 -r 59218d4a256d CAN/function_CAN.cpp
--- a/CAN/function_CAN.cpp	Mon Sep 09 10:41:16 2019 +0000
+++ b/CAN/function_CAN.cpp	Tue Sep 10 09:38:26 2019 +0000
@@ -75,7 +75,7 @@
             
             ROM_RESET_DATA();
             
-            //spi_eeprom_write(RID_OPERATING_MODE, (int16_t) OPERATING_MODE);
+
             break;
         }
         case CRX_SET_ENC_ZERO: {
@@ -84,7 +84,6 @@
             break;
         }
         case CRX_SET_FET_ON: {
-            //LAT_MOT_EN = (int16_t) msg.data[1];
 
             break;
         }
@@ -529,11 +528,11 @@
             break;
         }
         case CRX_SET_VALVE_GAIN_PLUS: {
-            VALVE_GAIN_LPM_PER_V[0] = (double) msg.data[1] / 50.;
-            VALVE_GAIN_LPM_PER_V[2] = (double) msg.data[2] / 50.;
-            VALVE_GAIN_LPM_PER_V[4] = (double) msg.data[3] / 50.;
-            VALVE_GAIN_LPM_PER_V[6] = (double) msg.data[4] / 50.;
-            VALVE_GAIN_LPM_PER_V[8] = (double) msg.data[5] / 50.;
+            VALVE_GAIN_LPM_PER_V[0] = (double) msg.data[1] / 50.0;
+            VALVE_GAIN_LPM_PER_V[2] = (double) msg.data[2] / 50.0;
+            VALVE_GAIN_LPM_PER_V[4] = (double) msg.data[3] / 50.0;
+            VALVE_GAIN_LPM_PER_V[6] = (double) msg.data[4] / 50.0;
+            VALVE_GAIN_LPM_PER_V[8] = (double) msg.data[5] / 50.0;
             ROM_RESET_DATA();
             //spi_eeprom_write(RID_VALVE_GAIN_PLUS_1, (int16_t) (VALVE_GAIN_LPM_PER_V[0] * 100.));
             //spi_eeprom_write(RID_VALVE_GAIN_PLUS_2, (int16_t) (VALVE_GAIN_LPM_PER_V[2] * 100.));
@@ -550,11 +549,11 @@
             break;
         }
         case CRX_SET_VALVE_GAIN_MINUS: {
-            VALVE_GAIN_LPM_PER_V[1] = (double) msg.data[1] / 50.;
-            VALVE_GAIN_LPM_PER_V[3] = (double) msg.data[2] / 50.;
-            VALVE_GAIN_LPM_PER_V[5] = (double) msg.data[3] / 50.;
-            VALVE_GAIN_LPM_PER_V[7] = (double) msg.data[4] / 50.;
-            VALVE_GAIN_LPM_PER_V[9] = (double) msg.data[5] / 50.;
+            VALVE_GAIN_LPM_PER_V[1] = (double) msg.data[1] / 50.0;
+            VALVE_GAIN_LPM_PER_V[3] = (double) msg.data[2] / 50.0;
+            VALVE_GAIN_LPM_PER_V[5] = (double) msg.data[3] / 50.0;
+            VALVE_GAIN_LPM_PER_V[7] = (double) msg.data[4] / 50.0;
+            VALVE_GAIN_LPM_PER_V[9] = (double) msg.data[5] / 50.0;
             ROM_RESET_DATA();
             //spi_eeprom_write(RID_VALVE_GAIN_MINUS_1, (int16_t) (VALVE_GAIN_LPM_PER_V[1] * 100.));
             //spi_eeprom_write(RID_VALVE_GAIN_MINUS_2, (int16_t) (VALVE_GAIN_LPM_PER_V[3] * 100.));
@@ -643,8 +642,15 @@
 
 void CAN_RX_HANDLER()
 {
+    
     //pc.printf("can received");
     can.read(msg);
+//    can.read(msg, h1);
+//    can.read(msg, h2);
+//    can.read(msg, h3);
+//    can.read(msg, h4);
+//    can.read(msg, h5);
+//    can.read(msg, h6);
     unsigned int address = msg.id;
     //pc.printf("add %d\n",address);
     //pc.printf("cmd %d\n", CID_RX_CMD);
@@ -1249,3 +1255,5 @@
 
     can.write(temp_msg);
 }
+
+