Add V1-CAN to CAN2 interface

This commit is contained in:
Carsten Schmiemann 2022-11-19 00:05:06 +01:00
parent 89d64b2211
commit 5bf9c60a47

View file

@ -58,8 +58,10 @@ OvmsVehicleRenaultZoePh2CAN::OvmsVehicleRenaultZoePh2CAN() {
MyConfig.RegisterParam("xrz2c", "Renault Zoe Ph2 (CAN) configuration", true, true);
ConfigChanged(NULL);
// Init Zoe Ph2 OBD Connection (CAN Gateway)
// CAN1: Init Zoe Ph2 M-CAN Interface
RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS);
// CAN1: Init Zoe Ph2 V1-CAN Interface
RegisterCanBus(2, CAN_MODE_LISTEN, CAN_SPEED_500KBPS);
POLLSTATE_OFF;
ESP_LOGI(TAG, "Pollstate switched to OFF");
@ -139,11 +141,11 @@ void OvmsVehicleRenaultZoePh2CAN::ZoeWakeUp() {
}
/**
* Handles incoming CAN-frames on bus 1
* Handles incoming CAN-frames on bus 1, connected to M-CAN
*/
void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan1(CAN_frame_t* p_frame) {
uint8_t *data = p_frame->data.u8;
ESP_LOGI(TAG, "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]);
//If a CAN message comes in, start polling
if (!mt_bus_awake->AsBool()) {
@ -153,6 +155,16 @@ void OvmsVehicleRenaultZoePh2CAN::IncomingFrameCan1(CAN_frame_t* p_frame) {
m_can1_activity_timer = 5;
}
/**
* Handles incoming CAN-frames on bus 2, connected to V1-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]);
//ToDo: Analyse PIDs and copy data to useful metrics
}
/**
* Handles incoming poll results
*/