asdgas

Dependencies:   mbed Eigen FastPWM

Revision:
46:2694daea349b
Parent:
45:35fa6884d0c6
Child:
47:fdcb8bd86fd6
diff -r 35fa6884d0c6 -r 2694daea349b CAN/function_CAN.cpp
--- a/CAN/function_CAN.cpp	Thu Jan 16 12:05:15 2020 +0000
+++ b/CAN/function_CAN.cpp	Mon Jan 20 08:05:21 2020 +0000
@@ -271,6 +271,11 @@
                 //spi_eeprom_write(RID_P_GAIN_JOINT_TORQUE, (int16_t) P_GAIN_JOINT_TORQUE);
                 //spi_eeprom_write(RID_I_GAIN_JOINT_TORQUE, (int16_t) I_GAIN_JOINT_TORQUE);
                 //spi_eeprom_write(RID_D_GAIN_JOINT_TORQUE, (int16_t) D_GAIN_JOINT_TORQUE);
+            } else if (msg.data[1] == 3) {
+                K_SPRING = (int16_t) (msg.data[2] | msg.data[3] << 8);
+                D_DAMPER = (int16_t) (msg.data[4] | msg.data[5] << 8);
+                
+                ROM_RESET_DATA();
             }
 
             break;
@@ -875,6 +880,9 @@
         sendPgain = (int16_t) (P_GAIN_JOINT_TORQUE);
         sendIgain = (int16_t) (I_GAIN_JOINT_TORQUE);
         sendDgain = (int16_t) (D_GAIN_JOINT_TORQUE);
+    } else if (t_type == 3) {
+        sendPgain = (int16_t) (K_SPRING);
+        sendIgain = (int16_t) (D_DAMPER);
     }
 
     CANMessage temp_msg;