From f0aa4187c7d08a81e3f3b9f315fb05a24dc9e853 Mon Sep 17 00:00:00 2001 From: Carsten Schmiemann Date: Sun, 20 Nov 2022 23:46:21 +0100 Subject: [PATCH] Re arrange can bus interfaces, disable logging because crash --- .../src/vehicle_renaultzoe_ph2_can.cpp | 25 +++++++++++++++---- .../src/vehicle_renaultzoe_ph2_can.h | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp index 628d86e..aa321bf 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp @@ -56,10 +56,12 @@ OvmsVehicleRenaultZoePh2CAN::OvmsVehicleRenaultZoePh2CAN() { MyConfig.RegisterParam("xrz2c", "Renault Zoe Ph2 (CAN) configuration", true, true); ConfigChanged(NULL); - // CAN1: Init Zoe Ph2 M-CAN Interface + // CAN1: Init Zoe Ph2 M-CAN bus RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS); - // CAN1: Init Zoe Ph2 V1-CAN Interface + // CAN2: Init Zoe Ph2 EXT-CAN bus RegisterCanBus(2, CAN_MODE_LISTEN, CAN_SPEED_500KBPS); + // CAN3: Init Zoe Ph2 V1-CAN bus + RegisterCanBus(3, CAN_MODE_LISTEN, CAN_SPEED_500KBPS); POLLSTATE_OFF; ESP_LOGI(TAG, "Pollstate switched to OFF"); @@ -143,7 +145,8 @@ void OvmsVehicleRenaultZoePh2CAN::ZoeWakeUp() { */ void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan1(CAN_frame_t* p_frame) { uint8_t *data = p_frame->data.u8; - ESP_LOGI(TAG, "M-CAN: PID:%x DATA: %02x %02x %02x %02x %02x %02x %02x %02x", p_frame->MsgID, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + //ESP_LOGI(TAG, "M-CAN: PID:%x DATA: %02x %02x %02x %02x %02x %02x %02x %02x", p_frame->MsgID, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + //tooooooo many packets, OVMS will crash with logging //If a CAN message comes in, start polling if (!mt_bus_awake->AsBool()) { @@ -154,11 +157,23 @@ void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan1(CAN_frame_t* p_frame) { } /** - * Handles incoming CAN-frames on bus 2, connected to V1-CAN + * Handles incoming CAN-frames on bus 2, connected to EXT-CAN */ void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan2(CAN_frame_t* p_frame) { uint8_t *data = p_frame->data.u8; - ESP_LOGI(TAG, "V1-CAN: PID:%x DATA: %02x %02x %02x %02x %02x %02x %02x %02x", p_frame->MsgID, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + //ESP_LOGI(TAG, "V1-CAN: PID:%x DATA: %02x %02x %02x %02x %02x %02x %02x %02x", p_frame->MsgID, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + //tooooooo many packets, OVMS will crash with logging + + //ToDo: Analyse PIDs and copy data to useful metrics +} + +/** + * Handles incoming CAN-frames on bus 3, connected to V1-CAN + */ +void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan3(CAN_frame_t* p_frame) { + uint8_t *data = p_frame->data.u8; + //ESP_LOGI(TAG, "V1-CAN: PID:%x DATA: %02x %02x %02x %02x %02x %02x %02x %02x", p_frame->MsgID, data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); + //tooooooo many packets, OVMS will crash with logging //ToDo: Analyse PIDs and copy data to useful metrics } diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h index 7cf5cd1..530bdd9 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h @@ -69,6 +69,7 @@ class OvmsVehicleRenaultZoePh2CAN : public OvmsVehicle { void ZoeWakeUp(); void IncomingFrameCan1(CAN_frame_t* p_frame); void IncomingFrameCan2(CAN_frame_t* p_frame); + void IncomingFrameCan3(CAN_frame_t* p_frame); void IncomingPollReply(canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, uint8_t length, uint16_t remain); void WebInit(); void WebDeInit();