Fix tpms pressure readings

This commit is contained in:
Carsten Schmiemann 2022-05-08 23:29:14 +02:00
parent 43df545b41
commit c6858eaf16
1 changed files with 20 additions and 12 deletions

View File

@ -28,47 +28,55 @@
void OvmsVehicleRenaultZoePh2::IncomingBCM(uint16_t type, uint16_t pid, const char* data, uint16_t len) {
switch (pid) {
case 0x6300: { // TPMS pressure - front left
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_FL, (float)CAN_UINT(0) * 7.5 / 10, kPa);
if ((CAN_UINT(0) * 7.5) < 7672) {
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_FL, (float)CAN_UINT(0) * 7.5 / 10, kPa);
}
ESP_LOGD(TAG, "6300 BCM tpms pressure FL: %f", CAN_UINT(0) * 7.5);
break;
}
case 0x6301: { // TPMS pressure - front right
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_FR, (float)CAN_UINT(0) * 7.5 / 10, kPa);
if ((CAN_UINT(0) * 7.5) < 7672) {
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_FR, (float)CAN_UINT(0) * 7.5 / 10, kPa);
}
ESP_LOGD(TAG, "6301 BCM tpms pressure FR: %f", CAN_UINT(0) * 7.5);
break;
}
case 0x6302: { // TPMS pressure - rear left
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_RL, (float)CAN_UINT(0) * 7.5 / 10, kPa);
if ((CAN_UINT(0) * 7.5) < 7672) {
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_RL, (float)CAN_UINT(0) * 7.5 / 10, kPa);
}
ESP_LOGD(TAG, "6302 BCM tpms pressure RL: %f", CAN_UINT(0) * 7.5);
break;
}
case 0x6303: { // TPMS pressure - rear right
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_RR, (float)CAN_UINT(0) * 7.5 / 10, kPa);
if ((CAN_UINT(0) * 7.5) < 7672) {
StandardMetrics.ms_v_tpms_pressure->SetElemValue(MS_V_TPMS_IDX_RR, (float)CAN_UINT(0) * 7.5 / 10, kPa);
}
ESP_LOGD(TAG, "6303 BCM tpms pressure RR: %f", CAN_UINT(0) * 7.5);
break;
}
case 0x6310: { // TPMS temp - front left
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_FL, (float)(CAN_UINT(0) - 30) * 0.001, Celcius);
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_FL, (float)(CAN_UINT(0) * 0.001) - 30, Celcius);
ESP_LOGD(TAG, "6310 BCM tpms temp FL RAW: %d", CAN_UINT(0));
ESP_LOGD(TAG, "6310 BCM tpms temp FL: %f", (CAN_UINT(0) - 30) * 0.001);
ESP_LOGD(TAG, "6310 BCM tpms temp FL: %f", (CAN_UINT(0) * 0.001) - 30);
break;
}
case 0x6311: { // TPMS temp - front right
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_FR, (float)(CAN_UINT(0) - 30) * 0.001, Celcius);
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_FR, (float)(CAN_UINT(0) * 0.001) - 30, Celcius);
ESP_LOGD(TAG, "6311 BCM tpms temp FR RAW: %d", CAN_UINT(0));
ESP_LOGD(TAG, "6311 BCM tpms temp FR: %f", (CAN_UINT(0) - 30) * 0.001);
ESP_LOGD(TAG, "6311 BCM tpms temp FR: %f", (CAN_UINT(0) * 0.001) - 30);
break;
}
case 0x6312: { // TPMS temp - rear left
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_RL, (float)(CAN_UINT(0) - 30) * 0.001, Celcius);
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_RL, (float)(CAN_UINT(0) * 0.001) - 30, Celcius);
ESP_LOGD(TAG, "6312 BCM tpms temp RL RAW: %d", CAN_UINT(0));
ESP_LOGD(TAG, "6312 BCM tpms temp RL: %f", (CAN_UINT(0) - 30) * 0.001);
ESP_LOGD(TAG, "6312 BCM tpms temp RL: %f", (CAN_UINT(0) * 0.001) - 30);
break;
}
case 0x6313: { // TPMS temp - rear right
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_RR, (float)(CAN_UINT(0) - 30) * 0.001, Celcius);
StandardMetrics.ms_v_tpms_temp->SetElemValue(MS_V_TPMS_IDX_RR, (float)(CAN_UINT(0) * 0.001) - 30, Celcius);
ESP_LOGD(TAG, "6313 BCM tpms temp RR RAW: %d", CAN_UINT(0));
ESP_LOGD(TAG, "6313 BCM tpms temp RR: %f", (CAN_UINT(0) - 30) * 0.001);
ESP_LOGD(TAG, "6313 BCM tpms temp RR: %f", (CAN_UINT(0) * 0.001) - 30);
break;
}
case 0x4109: { // TPMS alert - front left