Use additional poll as wake up detection

This commit is contained in:
Carsten Schmiemann 2022-04-21 21:03:59 +02:00
parent 072fb6ffe8
commit 0cce906308
4 changed files with 16 additions and 8 deletions

View File

@ -98,7 +98,7 @@ void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const ch
}
break;
}
case 0x2B6D: { // Charge MMI States
case 0x2B6D: { // Charge MMI States, will be polled every 30s even car is off, because free frames are unreliable
//ESP_LOGD(TAG, "2B6D Charge MMI States RAW: %d", CAN_NIBL(0));
if (CAN_NIBL(0) == 0) {
StandardMetrics.ms_v_charge_state->SetValue("stopped");
@ -145,6 +145,9 @@ void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const ch
StandardMetrics.ms_v_charge_inprogress->SetValue(false);
//ESP_LOGD(TAG, "2B6D Charge MMI States : Charge preparation");
}
if (!mt_bus_awake->AsBool()) {
ZoeWakeUp();
}
break;
}
case 0x2B7A: { // Charge type

View File

@ -52,7 +52,7 @@ static const OvmsVehicle::poll_pid_t renault_zoe_polls[] = {
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2A09, { 0, 10, 10, 10 }, 0, ISOTP_EXTFRAME }, // Power usage by consumer
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2191, { 0, 10, 10, 10 }, 0, ISOTP_EXTFRAME }, // Power usage by ptc
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2B85, { 0, 2, 300, 10 }, 0, ISOTP_EXTFRAME }, // Charge plug preset
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2B6D, { 60, 2, 300, 10 }, 0, ISOTP_EXTFRAME }, // Charge MMI states
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2B6D, { 30, 2, 300, 10 }, 0, ISOTP_EXTFRAME }, // Charge MMI states
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x2B7A, { 0, 2, 300, 10 }, 0, ISOTP_EXTFRAME }, // Charge type
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x3064, { 0, 10, 3, 10 }, 0, ISOTP_EXTFRAME }, // Motor rpm
{ 0x18dadaf1, 0x18daf1da, VEHICLE_POLL_TYPE_OBDIIEXTENDED, 0x300F, { 0, 2, 300, 3 }, 0, ISOTP_EXTFRAME }, // AC charging power available

View File

@ -123,6 +123,15 @@ void OvmsVehicleRenaultZoePh2::ConfigChanged(OvmsConfigParam* param) {
ESP_LOGI(TAG, "Renault Zoe Ph2 reload configuration: Range ideal: %d, Battery capacity: %d, Use Car trip counter: %s, Use BMS as energy counter: %s, Use BMS for SOC: %s", m_range_ideal, m_battery_capacity, m_UseCarTrip ? "Yes" : "No", m_UseBMScalculation ? "yes" : "no", m_UseBMSsoc ? "yes" : "no");
}
void OvmsVehicleRenaultZoePh2::ZoeWakeUp() {
ESP_LOGI(TAG,"Zoe woke up (CAN Bus activity detected)");
mt_bus_awake->SetValue(true);;
StandardMetrics.ms_v_env_awake->SetValue(true);
StandardMetrics.ms_v_env_charging12v->SetValue(true);
POLLSTATE_ON;
ESP_LOGI(TAG, "Pollstate switched to ON");
}
/**
* Handles incoming CAN-frames on bus 1
*/
@ -146,12 +155,7 @@ void OvmsVehicleRenaultZoePh2::IncomingFrameCan1(CAN_frame_t* p_frame) {
}
//There are some free frames on wakeup and start and stop charging.... I try to use them to see if Car is awake and charging, see /Reference/ZOE_Ph2_xxx text files
if (!mt_bus_awake->AsBool() && (data[0] == 0x05 || data[0] == 0x06 || data[0] == 0x07)) { //listen for SingleFrames (0x0) with length of 5-7
ESP_LOGI(TAG,"Zoe woke up (CAN Bus activity detected)");
mt_bus_awake->SetValue(true);;
StandardMetrics.ms_v_env_awake->SetValue(true);
StandardMetrics.ms_v_env_charging12v->SetValue(true);
POLLSTATE_ON;
ESP_LOGI(TAG, "Pollstate switched to ON");
ZoeWakeUp();
}
}

View File

@ -65,6 +65,7 @@ class OvmsVehicleRenaultZoePh2 : public OvmsVehicle {
~OvmsVehicleRenaultZoePh2();
static void WebCfgCommon(PageEntry_t& p, PageContext_t& c);
void ConfigChanged(OvmsConfigParam* param);
void ZoeWakeUp();
void IncomingFrameCan1(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();