Re arrange can bus interfaces, disable logging because crash

This commit is contained in:
Carsten Schmiemann 2022-11-20 23:46:21 +01:00
parent c1a2b4dbf8
commit f0aa4187c7
2 changed files with 21 additions and 5 deletions

View file

@ -56,10 +56,12 @@ OvmsVehicleRenaultZoePh2CAN::OvmsVehicleRenaultZoePh2CAN() {
MyConfig.RegisterParam("xrz2c", "Renault Zoe Ph2 (CAN) configuration", true, true); MyConfig.RegisterParam("xrz2c", "Renault Zoe Ph2 (CAN) configuration", true, true);
ConfigChanged(NULL); ConfigChanged(NULL);
// CAN1: Init Zoe Ph2 M-CAN Interface // CAN1: Init Zoe Ph2 M-CAN bus
RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS); 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); 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; POLLSTATE_OFF;
ESP_LOGI(TAG, "Pollstate switched to OFF"); ESP_LOGI(TAG, "Pollstate switched to OFF");
@ -143,7 +145,8 @@ void OvmsVehicleRenaultZoePh2CAN::ZoeWakeUp() {
*/ */
void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan1(CAN_frame_t* p_frame) { void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan1(CAN_frame_t* p_frame) {
uint8_t *data = p_frame->data.u8; 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 a CAN message comes in, start polling
if (!mt_bus_awake->AsBool()) { 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) { void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan2(CAN_frame_t* p_frame) {
uint8_t *data = p_frame->data.u8; 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 //ToDo: Analyse PIDs and copy data to useful metrics
} }

View file

@ -69,6 +69,7 @@ class OvmsVehicleRenaultZoePh2CAN : public OvmsVehicle {
void ZoeWakeUp(); void ZoeWakeUp();
void IncomingFrameCan1(CAN_frame_t* p_frame); void IncomingFrameCan1(CAN_frame_t* p_frame);
void IncomingFrameCan2(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 IncomingPollReply(canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, uint8_t length, uint16_t remain);
void WebInit(); void WebInit();
void WebDeInit(); void WebDeInit();