From 3aae5c16a869c7781f4e00efd8a5b7c0a6640e89 Mon Sep 17 00:00:00 2001 From: Carsten Schmiemann Date: Thu, 14 Apr 2022 22:54:52 +0200 Subject: [PATCH] Fix calculation on PIDs --- .../src/vehicle_renaultzoe_ph2.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.cpp index d5c1e5f..3afab85 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.cpp @@ -245,24 +245,24 @@ void OvmsVehicleRenaultZoePh2::IncomingPollReply(canbus* bus, uint16_t type, uin void OvmsVehicleRenaultZoePh2::IncomingINV(uint16_t type, uint16_t pid, const char* data, uint16_t len) { switch (pid) { case 0x700C: { // Inverter temperature - StandardMetrics.ms_v_inv_temp->SetValue(float((CAN_UINT(0) - 40) * 0.1953125), Celcius); - ESP_LOGD(TAG, "700C INV ms_v_inv_temp: %f", float((CAN_UINT(0) - 40) * 0.1953125)); + StandardMetrics.ms_v_inv_temp->SetValue(float((CAN_UINT(0) * 0.1953125) - 40), Celcius); + ESP_LOGD(TAG, "700C INV ms_v_inv_temp: %f", float((CAN_UINT(0) * 0.1953125) - 40)); break; } case 0x700F: { // Motor, Stator1 temperature - StandardMetrics.ms_v_mot_temp->SetValue(float((CAN_UINT(0) - 40) * 0.1953125), Celcius); - mt_mot_temp_stator1->SetValue(float((CAN_UINT(0) - 40)), Celcius); - ESP_LOGD(TAG, "700F INV ms_v_mot_temp: %f", float((CAN_UINT(0) - 40) * 0.1953125)); + StandardMetrics.ms_v_mot_temp->SetValue(float((CAN_UINT(0) * 0.1953125) - 40), Celcius); + mt_mot_temp_stator1->SetValue(float((CAN_UINT(0) * 0.1953125) - 40), Celcius); + ESP_LOGD(TAG, "700F INV ms_v_mot_temp: %f", float((CAN_UINT(0) * 0.1953125) - 40)); break; } case 0x7010: { // Stator 2 temperature - mt_mot_temp_stator2->SetValue(float((CAN_UINT(0) - 40) * 0.1953125), Celcius); - ESP_LOGD(TAG, "7010 INV mt_mot_temp_stator2: %f", float((CAN_UINT(0) - 40) * 0.1953125)); + mt_mot_temp_stator2->SetValue(float((CAN_UINT(0) * 0.1953125) - 40), Celcius); + ESP_LOGD(TAG, "7010 INV mt_mot_temp_stator2: %f", float((CAN_UINT(0) * 0.1953125) - 40)); break; } case 0x2001: { // Motor rpm - StandardMetrics.ms_v_mot_rpm->SetValue(float(CAN_UINT(0) - 16000) * 0.5); - ESP_LOGD(TAG, "2001 INV ms_v_mot_rpm: %f", float(CAN_UINT(0) - 16000) * 0.5); + StandardMetrics.ms_v_mot_rpm->SetValue(float(CAN_UINT(0) / 2) - 16000); + ESP_LOGD(TAG, "2001 INV ms_v_mot_rpm: %f", float(CAN_UINT(0) / 2) - 16000); break; } case 0x2004: { // Battery voltage sense @@ -272,8 +272,8 @@ void OvmsVehicleRenaultZoePh2::IncomingINV(uint16_t type, uint16_t pid, const ch break; } case 0x7049: { // Battery current sense - mt_inv_hv_current->SetValue(float((CAN_UINT(0) - 500) * 0.003125), Amps); - ESP_LOGD(TAG, "7049 INV mt_inv_hv_current: %f", float(CAN_UINT(0) - 500) * 0.003125); + mt_inv_hv_current->SetValue(float((CAN_UINT(0) * 0.003125) - 500), Amps); + ESP_LOGD(TAG, "7049 INV mt_inv_hv_current: %f", float(CAN_UINT(0) * 0.003125) - 500); StandardMetrics.ms_v_inv_power->SetValue(float (mt_inv_hv_current->AsFloat() * mt_inv_hv_voltage->AsFloat() / 1000)); break; } @@ -408,9 +408,9 @@ void OvmsVehicleRenaultZoePh2::IncomingLBC(uint16_t type, uint16_t pid, const ch break; } case 0x925D: { //Battery current - 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: %f", ((CAN_UINT(0) - 1020) * 0.03125)); + StandardMetrics.ms_v_bat_current->SetValue((float) ((CAN_UINT(4) - 1020) * 0.03125), Amps); + ESP_LOGD(TAG, "925D LBC ms_v_bat_current: %d", CAN_UINT(4)); + ESP_LOGD(TAG, "925D LBC ms_v_bat_current: %f", ((CAN_UINT(4) - 1020) * 0.03125)); break; } case 0x9012: { //Battery average temperature