Add units

This commit is contained in:
Carsten Schmiemann 2022-04-13 23:43:05 +02:00
parent 6d6e4cc398
commit f2ca6c0f18

View file

@ -268,18 +268,18 @@ void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const ch
break; break;
} }
case 0x29FD: { case 0x29FD: {
StandardMetrics.ms_v_charge_12v_current->SetValue((float) (CAN_UINT(0) * 0.01 - 327.675)); StandardMetrics.ms_v_charge_12v_current->SetValue((float) (CAN_UINT(0) * 0.01 - 327.675), Amps);
ESP_LOGD(TAG, "29FD EVC ms_v_charge_12v_current: %d", CAN_UINT(0)); ESP_LOGD(TAG, "29FD EVC ms_v_charge_12v_current: %d", CAN_UINT(0));
ESP_LOGD(TAG, "29FD EVC ms_v_charge_12v_current: %f", CAN_UINT(0) * 0.01 - 327.675); ESP_LOGD(TAG, "29FD EVC ms_v_charge_12v_current: %f", CAN_UINT(0) * 0.01 - 327.675);
break; break;
} }
case 0x2005: { case 0x2005: {
StandardMetrics.ms_v_charge_12v_voltage->SetValue((float) (CAN_UINT(0) * 0.01)); StandardMetrics.ms_v_charge_12v_voltage->SetValue((float) (CAN_UINT(0) * 0.01), Volts);
ESP_LOGD(TAG, "2005 EVC ms_v_charge_12v_voltage: %f", CAN_UINT(0) * 0.01); ESP_LOGD(TAG, "2005 EVC ms_v_charge_12v_voltage: %f", CAN_UINT(0) * 0.01);
break; break;
} }
case 0x21D0: { case 0x21D0: {
StandardMetrics.ms_v_charge_12v_temp->SetValue((float) (CAN_UINT(0) - 40)); StandardMetrics.ms_v_charge_12v_temp->SetValue((float) (CAN_UINT(0) - 40), Celcius);
ESP_LOGD(TAG, "21D0 EVC ms_v_charge_12v_temp: %d", CAN_UINT(0) - 40); ESP_LOGD(TAG, "21D0 EVC ms_v_charge_12v_temp: %d", CAN_UINT(0) - 40);
break; break;
} }
@ -369,43 +369,43 @@ void OvmsVehicleRenaultZoePh2::IncomingBCB(uint16_t type, uint16_t pid, const ch
void OvmsVehicleRenaultZoePh2::IncomingLBC(uint16_t type, uint16_t pid, const char* data, uint16_t len) { void OvmsVehicleRenaultZoePh2::IncomingLBC(uint16_t type, uint16_t pid, const char* data, uint16_t len) {
switch (pid) { switch (pid) {
case 0x9005: { //Battery voltage case 0x9005: { //Battery voltage
StandardMetrics.ms_v_bat_voltage->SetValue((float) (CAN_UINT(0) * 0.1)); StandardMetrics.ms_v_bat_voltage->SetValue((float) (CAN_UINT(0) * 0.1), Volts);
ESP_LOGD(TAG, "9005 LBC ms_v_bat_voltage: %f", CAN_UINT(0) * 0.1); ESP_LOGD(TAG, "9005 LBC ms_v_bat_voltage: %f", CAN_UINT(0) * 0.1);
break; break;
} }
case 0x925D: { //Battery current case 0x925D: { //Battery current
StandardMetrics.ms_v_bat_current->SetValue((float) ((CAN_UINT(0) - 1020) * 0.03125)); StandardMetrics.ms_v_bat_current->SetValue((float) ((CAN_UINT(0) - 1020) * 0.03125), Amps);
ESP_LOGD(TAG, "925D LBC ms_v_bat_current: %d", CAN_UINT(0)); ESP_LOGD(TAG, "925D LBC ms_v_bat_current: %d", CAN_UINT(0));
ESP_LOGD(TAG, "925D LBC ms_v_bat_current: %f", ((CAN_UINT(0) - 1020) * 0.03125)); ESP_LOGD(TAG, "925D LBC ms_v_bat_current: %f", ((CAN_UINT(0) - 1020) * 0.03125));
break; break;
} }
case 0x9012: { //Battery average temperature case 0x9012: { //Battery average temperature
StandardMetrics.ms_v_bat_temp->SetValue((float) (CAN_UINT(0) - 40)); StandardMetrics.ms_v_bat_temp->SetValue((float) (CAN_UINT(0) - 40), Celcius);
ESP_LOGD(TAG, "9012 LBC ms_v_bat_temp: %f", ((CAN_UINT(0) - 40)); ESP_LOGD(TAG, "9012 LBC ms_v_bat_temp: %d", (CAN_UINT(0) - 40));
break; break;
} }
case 0x9002: { //Battery SOC case 0x9002: { //Battery SOC
StandardMetrics.ms_v_bat_soc->SetValue((float) (CAN_UINT(0)) * 0.01); StandardMetrics.ms_v_bat_soc->SetValue((float) (CAN_UINT(0)) * 0.01, Percentage);
ESP_LOGD(TAG, "9002 LBC ms_v_bat_soc: %f", CAN_UINT(0) * 0.01); ESP_LOGD(TAG, "9002 LBC ms_v_bat_soc: %f", CAN_UINT(0) * 0.01);
break; break;
} }
case 0x9003: { //Battery SOH case 0x9003: { //Battery SOH
StandardMetrics.ms_v_bat_soh->SetValue((float) (CAN_UINT(0) * 0.01)); StandardMetrics.ms_v_bat_soh->SetValue((float) (CAN_UINT(0) * 0.01), Percentage);
ESP_LOGD(TAG, "9003 LBC ms_v_bat_soh: %f", CAN_UINT(0) * 0.01); ESP_LOGD(TAG, "9003 LBC ms_v_bat_soh: %f", CAN_UINT(0) * 0.01);
break; break;
} }
case 0x9243: { //Battery energy charged kWh case 0x9243: { //Battery energy charged kWh
StandardMetrics.ms_v_charge_kwh_grid_total->SetValue((float) (CAN_UINT32(0) * 0.001)); StandardMetrics.ms_v_charge_kwh_grid_total->SetValue((float) (CAN_UINT32(0) * 0.001), kWh);
ESP_LOGD(TAG, "9243 LBC ms_v_charge_kwh_grid_total: %f", CAN_UINT32(0) * 0.001); ESP_LOGD(TAG, "9243 LBC ms_v_charge_kwh_grid_total: %f", CAN_UINT32(0) * 0.001);
break; break;
} }
case 0x9244: { //Battery energy discharged kWh case 0x9244: { //Battery energy discharged kWh
StandardMetrics.ms_v_bat_energy_used->SetValue((float) (CAN_UINT32(0) * 0.001)); StandardMetrics.ms_v_bat_energy_used->SetValue((float) (CAN_UINT32(0) * 0.001), kWh);
ESP_LOGD(TAG, "9244 LBC ms_v_bat_energy_used: %f", CAN_UINT32(0) * 0.001); ESP_LOGD(TAG, "9244 LBC ms_v_bat_energy_used: %f", CAN_UINT32(0) * 0.001);
break; break;
} }
case 0x9246: { //Battery energy regenerated kWh case 0x9246: { //Battery energy regenerated kWh
StandardMetrics.ms_v_bat_energy_recd->SetValue((float) (CAN_UINT32(0) * 0.001)); StandardMetrics.ms_v_bat_energy_recd->SetValue((float) (CAN_UINT32(0) * 0.001), kWh);
ESP_LOGD(TAG, "9246 LBC ms_v_bat_energy_recd: %f", CAN_UINT32(0) * 0.001); ESP_LOGD(TAG, "9246 LBC ms_v_bat_energy_recd: %f", CAN_UINT32(0) * 0.001);
break; break;
} }
@ -416,9 +416,9 @@ void OvmsVehicleRenaultZoePh2::IncomingLBC(uint16_t type, uint16_t pid, const ch
} }
break; break;
} }
case 0x91C8: { case 0x91C8: { //Available charge in kWh
StandardMetrics.ms_v_charge_kwh->SetValue(float(CAN_UINT(0))); StandardMetrics.ms_v_charge_kwh->SetValue(float(CAN_UINT24(0)), kWh);
ESP_LOGD(TAG, "91C8 LBC ms_v_charge_kwh: %d", CAN_UINT(0)); ESP_LOGD(TAG, "91C8 LBC ms_v_charge_kwh: %d", CAN_UINT24(0));
break; break;
} }
case 0x9021: { case 0x9021: {