diff --git a/Inc/config.h b/Inc/config.h index ecd4218..57197b5 100644 --- a/Inc/config.h +++ b/Inc/config.h @@ -8,6 +8,8 @@ // ############################### DO-NOT-TOUCH SETTINGS ############################### +#define N_POLEPAIRS 15 //for wheel angle calculation + #define PWM_FREQ 16000 // PWM frequency in Hz #define DEAD_TIME 32 // PWM deadtime #define DELAY_IN_MAIN_LOOP 5 // in ms. default 5. it is independent of all the timing critical stuff. do not touch if you do not know what you are doing. diff --git a/Src/main.c b/Src/main.c index 2525201..35e64b5 100644 --- a/Src/main.c +++ b/Src/main.c @@ -85,10 +85,10 @@ typedef struct{ uint16_t start; int16_t cmd1; int16_t cmd2; - int16_t speedR; int16_t speedL; - int16_t speedR_meas; + int16_t speedR; int16_t speedL_meas; + int16_t speedR_meas; int16_t batVoltage; int16_t boardTemp; int16_t curL_DC; @@ -483,10 +483,12 @@ int main(void) { Feedback.start = (uint16_t)START_FRAME; Feedback.cmd1 = (int16_t)cmd1; Feedback.cmd2 = (int16_t)cmd2; - Feedback.speedR = (int16_t)speedR; Feedback.speedL = (int16_t)speedL; - Feedback.speedR_meas = (int16_t)rtY_Left.n_mot; - Feedback.speedL_meas = (int16_t)rtY_Right.n_mot; + Feedback.speedR = (int16_t)speedR; + Feedback.speedL_meas = (int16_t)rtY_Left.n_mot; + Feedback.speedR_meas = (int16_t)rtY_Right.n_mot; + //Feedback.angleL_meas = (int16_t)rtY_Left.a_elecAngle/N_POLEPAIRS; + //Feedback.angleR_meas = (int16_t)rtY_Right.a_elecAngle/N_POLEPAIRS; Feedback.batVoltage = (int16_t)(batVoltage * BAT_CALIB_REAL_VOLTAGE / BAT_CALIB_ADC); Feedback.boardTemp = (int16_t)board_temp_deg_c; Feedback.curL_DC = (int16_t)curL_DC*10/A2BIT_CONV*100; //in milli Amperes, 100mA resolution