![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
for learning
Diff: main.cpp
- Revision:
- 237:aa3863117889
- Parent:
- 236:1276112e0147
- Child:
- 238:e4bda4d06a7d
--- a/main.cpp Sat Jan 02 06:58:18 2021 +0000 +++ b/main.cpp Sat Jan 02 07:20:26 2021 +0000 @@ -2803,11 +2803,9 @@ TIM4->CCR1 = (PWM_ARR)*(1.0f-dtc_w); - if (TMR2_COUNT_CAN_TX % (int) ((int) TMR_FREQ_5k/CAN_FREQ) == 0) { - - /* + if (TMR2_COUNT_CAN_TX % (int) ((int) TMR_FREQ_5k/CAN_FREQ) == 0) { // Position, Velocity, and Torque (ID:1200) if (flag_data_request[0] == HIGH) { @@ -2865,21 +2863,23 @@ //CAN_TX_VALVE_POSITION((int16_t) pos.sen/(float)(ENC_PULSE_PER_POSITION), (int16_t) virt_pos, (int16_t) (logging2*1000.0f), (int16_t) (logging4*1000.0f)); //1600 CAN_TX_VALVE_POSITION((int16_t) (a_hat*0.0001f), (int16_t) 0, (int16_t) 0, (int16_t) 0); //1600 } -*/ + // Others : Reference position, Reference FT, PWM, Current (ID:1300) -// if (flag_data_request[1] == HIGH) { -// CAN_TX_SOMETHING((int) (FORCE_VREF), (int16_t) (1), (int16_t) (2), (int16_t) (3)); -// } - //if (flag_delay_test == 1){ - //CAN_TX_PRES((int16_t) (0),(int16_t) torq_ref); - //} + if (flag_data_request[1] == HIGH) { + CAN_TX_SOMETHING((int) (FORCE_VREF), (int16_t) (1), (int16_t) (2), (int16_t) (3)); + } + if (flag_delay_test == 1){ + CAN_TX_PRES((int16_t) (0),(int16_t) torq_ref); + } TMR2_COUNT_CAN_TX = 0; } TMR2_COUNT_CAN_TX++; - + +*/ + } TIM3->SR = 0x0; // reset the status register