Change env_on behavior, later use CAN direct

This commit is contained in:
Carsten Schmiemann 2022-04-18 01:15:42 +02:00
parent 3a7340ecf8
commit f4c78f831e
3 changed files with 5 additions and 12 deletions

View File

@ -52,18 +52,23 @@ void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const ch
if (CAN_NIBL(0) == 1) {
mt_inv_status->SetValue("Inverter off");
StandardMetrics.ms_v_env_on->SetValue(false);
POLLSTATE_ON;
} else if (CAN_NIBL(0) == 2) {
mt_inv_status->SetValue("Inverter on");
StandardMetrics.ms_v_env_on->SetValue(true);
POLLSTATE_RUNNING;
} else if (CAN_NIBL(0) == 3) {
mt_inv_status->SetValue("Inverter decharging");
StandardMetrics.ms_v_env_on->SetValue(false);
POLLSTATE_ON;
} else if (CAN_NIBL(0) == 4) {
mt_inv_status->SetValue("Inverter alternator mode");
StandardMetrics.ms_v_env_on->SetValue(false);
POLLSTATE_ON;
} else if (CAN_NIBL(0) == 5) {
mt_inv_status->SetValue("Inverter ready to sleep");
StandardMetrics.ms_v_env_on->SetValue(false);
POLLSTATE_ON;
} else {
mt_inv_status->SetValue("Inverter state unknown");
}

View File

@ -123,17 +123,6 @@ void OvmsVehicleRenaultZoePh2::IncomingFrameCan1(CAN_frame_t* p_frame) {
StandardMetrics.ms_v_env_charging12v->SetValue(true);
POLLSTATE_ON;
}
if (mt_bus_awake->AsBool() && !CarIsDriving && StandardMetrics.ms_v_pos_gpsspeed->AsFloat() > 5) { //If GPS speed bigger than 5km/h then assume Vehicle driving, later I used OBD speed for that
ESP_LOGI(TAG,"Zoe is driving");
StandardMetrics.ms_v_env_on->SetValue(true);
POLLSTATE_RUNNING;
CarIsDriving = true;
} else if (mt_bus_awake->AsBool() && CarIsDriving && StandardMetrics.ms_v_pos_gpsspeed->AsFloat() < 5) {
ESP_LOGI(TAG,"Zoe stopped driving");
StandardMetrics.ms_v_env_on->SetValue(false);
POLLSTATE_ON;
}
}
/**

View File

@ -69,7 +69,6 @@ class OvmsVehicleRenaultZoePh2 : public OvmsVehicle {
void IncomingPollReply(canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, uint8_t length, uint16_t remain);
void WebInit();
void WebDeInit();
bool CarIsDriving = false;
bool CarIsCharging = false;
bool CarPluggedIn = false;
bool CarLastCharging = false;