Compare commits

...

2 Commits

3 changed files with 24 additions and 8 deletions

View File

@ -43,9 +43,9 @@
void OvmsVehicleRenaultZoePh2CAN::CanInit()
{
OvmsCommand* cmd;
OvmsCommand* obd;
obd = cmd_zoe_ph2->RegisterCommand("can", "CAN tools");
cmd = obd->RegisterCommand("request", "Send ISO-TP request, output response");
OvmsCommand* ph2;
ph2 = cmd_zoe_ph2->RegisterCommand("ph2", "Zoe Ph2 CAN tools");
cmd = ph2->RegisterCommand("request", "Send ISO-TP request, output response");
cmd->RegisterCommand("device", "Send ISO-TP request to a ECU", shell_can_request, "<txid> <rxid> <request>", 3, 3);
cmd->RegisterCommand("broadcast", "Send ISO-TP request as broadcast", shell_can_request, "<request>", 1, 1);
}

View File

@ -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
}

View File

@ -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();