This commit is contained in:
hamza
2024-07-08 18:52:09 +03:00
parent 17e8cee0ac
commit 1a6728f7c0
8 changed files with 165 additions and 13 deletions

View File

@ -49,13 +49,13 @@ void sm_update(){
// state.current_state = state.target_state = STATE_ERROR;
if (state.current_state == STATE_INACTIVE){
base_offset = module.auxVoltages[0];
CURRENT_MEASUREMENT = (module.auxVoltages[0] > 2494) ? (module.auxVoltages[0] - (2494.0)) * (300.0) : 0;
} else {
CURRENT_MEASUREMENT = (module.auxVoltages[0] > 2477) ? (module.auxVoltages[0] - (2477.0)) * (4600.0) : 0;
}
CURRENT_MEASUREMENT = roundf((module.auxVoltages[0] - base_offset) * 350);
CURRENT_MEASUREMENT_ON = (module.auxVoltages[1] > 2400);
RELAY_ESC_SIDE_VOLTAGE = module.auxVoltages[2] * 11.711;
RELAY_BAT_SIDE_VOLTAGE = module.auxVoltages[3] * 11.711; // the calculation says the factor is 11. 11.711 yields the better result
RELAY_ESC_SIDE_VOLTAGE = module.auxVoltages[2] * 15.98;
RELAY_BAT_SIDE_VOLTAGE = module.auxVoltages[3] * 15.98; // the calculation says the factor is 11. 11.711 yields the better result
switch (state.current_state) {