Ioniq - Aux. batt percentage calculation

Signed-off-by: Martin Kolací <martin.kolaci@lmc.eu>
This commit is contained in:
Martin Kolací
2020-12-25 21:15:20 +01:00
parent eb87dcb3a8
commit fc00d31505

View File

@@ -155,11 +155,12 @@ void CarHyundaiIoniq::parseRowMerged() {
liveData->params.batFanStatus = liveData->hexToDecFromResponse(58, 60, 2, true); liveData->params.batFanStatus = liveData->hexToDecFromResponse(58, 60, 2, true);
liveData->params.batFanFeedbackHz = liveData->hexToDecFromResponse(60, 62, 2, true); liveData->params.batFanFeedbackHz = liveData->hexToDecFromResponse(60, 62, 2, true);
liveData->params.auxVoltage = liveData->hexToDecFromResponse(62, 64, 2, true) / 10.0; liveData->params.auxVoltage = liveData->hexToDecFromResponse(62, 64, 2, true) / 10.0;
float tmpAuxPerc; float tmpAuxPerc;
if(liveData->params.ignitionOn) { if(liveData->params.ignitionOn) {
tmpAuxPerc = map(liveData->params.auxVoltage * 10, 128, 148, 0, 1000) / 10; tmpAuxPerc = (float)(liveData->params.auxVoltage - 12.8) * 100 / (float)(14.8 - 12.8); //min: 12.8V; max: 14.8V
} else { } else {
tmpAuxPerc = map(liveData->params.auxVoltage * 10, 116, 128, 0, 1000) / 10; tmpAuxPerc = (float)(liveData->params.auxVoltage - 11.6) * 100 / (float)(12.8 - 11.6); //min 11.6V; max: 12.8V
} }
if(tmpAuxPerc > 100) { if(tmpAuxPerc > 100) {
liveData->params.auxPerc = 100; liveData->params.auxPerc = 100;