shunt data correct for highside

This commit is contained in:
Lene Marquardt 2025-05-26 14:49:38 +02:00
parent 468ba1d7e7
commit 861d9c9bd3
4 changed files with 6 additions and 5 deletions

@ -1 +1 @@
Subproject commit 887f92167d58e551abac18f4f899c74bddc13d46
Subproject commit 4e3bb026f88a7ee5a89ec48dc10281e8e0a3175a

View File

@ -203,7 +203,7 @@ int main(void)
// for testing. in the final code can log streaming will be enabled by can message
isotp_log_enable_streaming(LOG_LEVEL_INFO);
//shunt_init();
shunt_init();
ts_sm_init();
soc_init();
imd_init(&htim15);
@ -243,7 +243,7 @@ int main(void)
print_battery_info();
print_master_status();
}
//shunt_check();
shunt_check();
ts_sm_update();
soc_update();
imd_update();

View File

@ -48,10 +48,10 @@ void shunt_handle_can_msg(uint16_t id, const uint8_t *data) {
shunt_data.last_current_message = HAL_GetTick();
break;
case CAN_ID_SHUNT_VOLTAGE1:
shunt_data.voltage_bat = result;
shunt_data.voltage_bat = -result;
break;
case CAN_ID_SHUNT_VOLTAGE2:
shunt_data.voltage_veh = result;
shunt_data.voltage_veh = shunt_data.voltage_bat - (-result);
break;
case CAN_ID_SHUNT_VOLTAGE3:
shunt_data.voltage3 = result;

View File

@ -243,6 +243,7 @@ void ts_sm_check_close_wait(int *is_closed, int should_close) {
}
void ts_sm_handle_ams_in(const uint8_t *data) {
// ToDo: reset if no ts-on signal for a while recieved
if (data[0] & 0x01) {
ts_state.target_state = TS_ACTIVE;
} else {