From 011cc31d505128dee44b7ed4258541f785428d0a Mon Sep 17 00:00:00 2001 From: Carsten Schmiemann Date: Sun, 8 May 2022 23:41:21 +0200 Subject: [PATCH] Write VIN into metric --- .../vehicle_renaultzoe_ph2/src/BCM_pids.cpp | 41 +++++++++++++------ .../src/vehicle_renaultzoe_ph2.h | 1 + 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2/src/BCM_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2/src/BCM_pids.cpp index 11e7bef..5e8be32 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2/src/BCM_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2/src/BCM_pids.cpp @@ -223,24 +223,41 @@ void OvmsVehicleRenaultZoePh2::IncomingBCM(uint16_t type, uint16_t pid, const ch break; } case 0x4060: { //Vehicle identificaftion number - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_NIB(0)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_NIB(1)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_NIB(2)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_NIB(3)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_NIB(4)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_NIB(5)); ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(0)); ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(1)); ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(2)); ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(3)); ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(4)); ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(5)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_UINT(0)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_UINT(1)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_UINT(2)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_UINT(3)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_UINT(4)); - ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_UINT(5)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(6)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(7)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(8)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(9)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(10)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(11)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(12)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(13)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(14)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(15)); + ESP_LOGD(TAG, "4060 Vehicle identificaftion number: %d", CAN_BYTE(16)); + zoe_vin[0] = CAN_BYTE(0); + zoe_vin[1] = CAN_BYTE(1); + zoe_vin[2] = CAN_BYTE(2); + zoe_vin[3] = CAN_BYTE(3); + zoe_vin[4] = CAN_BYTE(4); + zoe_vin[5] = CAN_BYTE(5); + zoe_vin[6] = CAN_BYTE(6); + zoe_vin[7] = CAN_BYTE(7); + zoe_vin[8] = CAN_BYTE(8); + zoe_vin[9] = CAN_BYTE(9); + zoe_vin[10] = CAN_BYTE(10); + zoe_vin[11] = CAN_BYTE(11); + zoe_vin[12] = CAN_BYTE(12); + zoe_vin[13] = CAN_BYTE(13); + zoe_vin[14] = CAN_BYTE(14); + zoe_vin[15] = CAN_BYTE(15); + zoe_vin[16] = CAN_BYTE(16); + StandardMetrics.ms_v_vin->SetValue((string) zoe_vin); break; } diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.h b/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.h index 2e5a94c..f7b4367 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.h +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2/src/vehicle_renaultzoe_ph2.h @@ -84,6 +84,7 @@ class OvmsVehicleRenaultZoePh2 : public OvmsVehicle { bool m_UseCarTrip = false; bool m_UseBMScalculation = false; bool m_UseBMSsoc = false; + char zoe_vin[17] = ""; void IncomingINV(uint16_t type, uint16_t pid, const char* data, uint16_t len); void IncomingEVC(uint16_t type, uint16_t pid, const char* data, uint16_t len); void IncomingBCM(uint16_t type, uint16_t pid, const char* data, uint16_t len);