current measurement bug testing

This commit is contained in:
interfisch 2020-06-07 01:33:19 +02:00
parent 3a71408329
commit 78b8d80e5b
1 changed files with 11 additions and 4 deletions

View File

@ -101,6 +101,7 @@ static SerialFeedback Feedback;
#endif
static uint8_t serialSendCounter; // serial send counter
#if defined(CONTROL_NUNCHUCK) || defined(CONTROL_PPM) || defined(CONTROL_ADC)
static uint8_t button1, button2;
#endif
@ -135,8 +136,12 @@ extern uint8_t enable; // global variable for motor enable
extern volatile uint32_t timeout; // global variable for timeout
extern int16_t batVoltage; // global variable for battery voltage
extern int16_t curL_DC; // global variable for left motor current. to get current in Ampere divide by A2BIT_CONV
extern int16_t curR_DC; // global variable for right motor current
//extern int16_t curL_DC; // global variable for left motor current. to get current in Ampere divide by A2BIT_CONV
//extern int16_t curR_DC; // global variable for right motor current
extern int16_t curL_phaA;
extern int16_t curL_phaB;
extern int16_t curR_phaA;
extern int16_t curR_phaB;
static uint32_t inactivity_timeout_counter;
static uint32_t main_loop_counter;
@ -493,8 +498,10 @@ int main(void) {
//Feedback.angleR_meas = (int16_t)rtY_Right.a_elecAngle/N_POLEPAIRS; //rtY_Right.a_elecAngle/N_POLEPAIRS goes from 0 to ca. 24
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; //divide by A2BIT_CONV to get current in amperes
Feedback.curR_DC = (int16_t)curR_DC;
//Feedback.curL_DC = (int16_t)curL_DC; //divide by A2BIT_CONV to get current in amperes
//Feedback.curR_DC = (int16_t)curR_DC;
Feedback.curL_DC = (int16_t)curL_phaA;
Feedback.curR_DC = (int16_t)curL_phaB;
Feedback.checksum = (uint16_t)(Feedback.start ^ Feedback.cmd1 ^ Feedback.cmd2 ^ Feedback.speedL ^ Feedback.speedR
^ Feedback.speedL_meas ^ Feedback.speedR_meas ^ Feedback.batVoltage ^ Feedback.boardTemp ^ Feedback.curL_DC ^Feedback.curR_DC);