Sungwoo Kim
/
HydraulicControlBoard_Rainbow_v1_2_copy1
2011
Diff: CAN/function_CAN.cpp
- Revision:
- 28:2a62d73e3dd0
- Parent:
- 27:a2254a485f23
- Child:
- 30:8d561f16383b
diff -r a2254a485f23 -r 2a62d73e3dd0 CAN/function_CAN.cpp --- a/CAN/function_CAN.cpp Tue Oct 01 05:18:16 2019 +0000 +++ b/CAN/function_CAN.cpp Tue Oct 01 11:52:10 2019 +0000 @@ -46,7 +46,7 @@ CID_TX_VALVE_POSITION = (int) (BNO + INIT_CID_TX_VALVE_POSITION); } -void ReadCMD(int8_t CMD) +void ReadCMD(int16_t CMD) { switch(CMD){ case CRX_ASK_INFO: { @@ -579,13 +579,6 @@ break; } - - case CRX_SET_ROM: { - ROM_RESET_DATA(); - //CONTROL_MODE = 33; - CAN_TX_TORQUE((int16_t) (33)); - break; - } case CRX_JUMP_STATUS: { MODE_JUMP_STATUS = msg.data[1]; @@ -642,6 +635,11 @@ CAN_TX_VALVE_POS_NUM(); break; } + + case CRX_SET_ROM: { + ROM_RESET_DATA(); + break; + } default: break; } @@ -650,21 +648,12 @@ 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); if(address==CID_RX_CMD){ unsigned int CMD = msg.data[0]; ReadCMD(CMD); - //pc.printf("cmd %d\n ",CMD); + pc.printf("cmd %d\n ",CMD); } else if(address==CID_RX_REF_POSITION) { int32_t temp_pos = (int32_t) (msg.data[0] | msg.data[1] << 8 | msg.data[2] << 16 | msg.data[3] << 24); int32_t temp_vel = (int32_t) (msg.data[4] | msg.data[5] << 8 | msg.data[6] << 16 | msg.data[7] << 24);