mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Merge pull request #734 from LevinSwe/main
Slow down polling of ParameterPolling KIA / Hyundai
This commit is contained in:
commit
e0d72b71aa
1 changed files with 23 additions and 21 deletions
|
@ -25,6 +25,7 @@ static int16_t batteryAmps = 0;
|
||||||
static int16_t temperatureMax = 0;
|
static int16_t temperatureMax = 0;
|
||||||
static int16_t temperatureMin = 0;
|
static int16_t temperatureMin = 0;
|
||||||
static int16_t poll_data_pid = 0;
|
static int16_t poll_data_pid = 0;
|
||||||
|
static bool holdPidCounter = false;
|
||||||
static uint8_t CellVmaxNo = 0;
|
static uint8_t CellVmaxNo = 0;
|
||||||
static uint8_t CellVminNo = 0;
|
static uint8_t CellVminNo = 0;
|
||||||
static uint8_t batteryManagementMode = 0;
|
static uint8_t batteryManagementMode = 0;
|
||||||
|
@ -262,27 +263,28 @@ void handle_incoming_can_frame_battery(CAN_frame rx_frame) {
|
||||||
case 0x5D8:
|
case 0x5D8:
|
||||||
startedUp = true;
|
startedUp = true;
|
||||||
|
|
||||||
//PID data is polled after last message sent from battery:
|
//PID data is polled after last message sent from battery every other time:
|
||||||
if (poll_data_pid >= 10) { //polling one of ten PIDs at 100ms, resolution = 1s
|
if (holdPidCounter == true) {
|
||||||
poll_data_pid = 0;
|
holdPidCounter = false;
|
||||||
}
|
} else {
|
||||||
poll_data_pid++;
|
holdPidCounter = true;
|
||||||
if (poll_data_pid == 1) {
|
if (poll_data_pid >= 6) { //polling one of six PIDs at 100ms*2, resolution = 1200ms
|
||||||
transmit_can_frame(&KIA64_7E4_id1, can_config.battery);
|
poll_data_pid = 0;
|
||||||
} else if (poll_data_pid == 2) {
|
}
|
||||||
transmit_can_frame(&KIA64_7E4_id2, can_config.battery);
|
poll_data_pid++;
|
||||||
} else if (poll_data_pid == 3) {
|
if (poll_data_pid == 1) {
|
||||||
transmit_can_frame(&KIA64_7E4_id3, can_config.battery);
|
transmit_can_frame(&KIA64_7E4_id1, can_config.battery);
|
||||||
} else if (poll_data_pid == 4) {
|
} else if (poll_data_pid == 2) {
|
||||||
transmit_can_frame(&KIA64_7E4_id4, can_config.battery);
|
transmit_can_frame(&KIA64_7E4_id2, can_config.battery);
|
||||||
} else if (poll_data_pid == 5) {
|
} else if (poll_data_pid == 3) {
|
||||||
transmit_can_frame(&KIA64_7E4_id5, can_config.battery);
|
transmit_can_frame(&KIA64_7E4_id3, can_config.battery);
|
||||||
} else if (poll_data_pid == 6) {
|
} else if (poll_data_pid == 4) {
|
||||||
transmit_can_frame(&KIA64_7E4_id6, can_config.battery);
|
transmit_can_frame(&KIA64_7E4_id4, can_config.battery);
|
||||||
} else if (poll_data_pid == 7) {
|
} else if (poll_data_pid == 5) {
|
||||||
} else if (poll_data_pid == 8) {
|
transmit_can_frame(&KIA64_7E4_id5, can_config.battery);
|
||||||
} else if (poll_data_pid == 9) {
|
} else if (poll_data_pid == 6) {
|
||||||
} else if (poll_data_pid == 10) {
|
transmit_can_frame(&KIA64_7E4_id6, can_config.battery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x7EC: //Data From polled PID group, BigEndian
|
case 0x7EC: //Data From polled PID group, BigEndian
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue