OVMS3/OVMS.V3/components/vehicle_renaultzoe_ph2/src/EVC_pids.h

67 lines
2.5 KiB
C
Raw Normal View History

2022-04-14 22:35:23 +00:00
/**
* Handle incoming polls from the EVC Computer
*/
void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const char* data, uint16_t len) {
switch (pid) {
case 0x2006: { // Odometer (Total Vehicle Distance)
StandardMetrics.ms_v_pos_odometer->SetValue((float) CAN_UINT24(0), Kilometers);
ESP_LOGD(TAG, "2006 EVC ms_v_pos_odometer: %d", CAN_UINT24(0));
if (!mt_bus_awake) {
ESP_LOGI(TAG,"Zoe woke up (Successful poll on odometer)");
mt_bus_awake->SetValue(true);
StandardMetrics.ms_v_env_awake->SetValue(true);
car_on(true);
POLLSTATE_ON;
}
break;
}
case 0x2A8C: {
StandardMetrics.ms_v_charge_12v_current->SetValue((float) (CAN_UINT(0)), Amps);
ESP_LOGD(TAG, "2A8C EVC ms_v_charge_12v_current: %d", CAN_UINT(0));
break;
}
case 0x2005: {
StandardMetrics.ms_v_charge_12v_voltage->SetValue((float) (CAN_UINT(0) * 0.01), Volts);
ESP_LOGD(TAG, "2005 EVC ms_v_charge_12v_voltage: %f", CAN_UINT(0) * 0.01);
break;
}
case 0x21D0: {
StandardMetrics.ms_v_charge_12v_temp->SetValue((float) (CAN_UINT(4) - 40), Celcius);
ESP_LOGD(TAG, "21D0 EVC ms_v_charge_12v_temp: %d", CAN_UINT(4) - 40);
break;
}
case 0x21CF: {
ESP_LOGD(TAG, "21CF EVC mt_inv_status: %d", CAN_NIBL(0));
if (CAN_NIBL(0) == 1) {
mt_inv_status->SetValue("Inverter off");
} else if (CAN_NIBL(0) == 2) {
mt_inv_status->SetValue("Inverter on");
} else if (CAN_NIBL(0) == 3) {
mt_inv_status->SetValue("Inverter decharging");
} else if (CAN_NIBL(0) == 4) {
mt_inv_status->SetValue("Inverter alternator mode");
} else if (CAN_NIBL(0) == 5) {
mt_inv_status->SetValue("Inverter ready to sleep");
} else {
mt_inv_status->SetValue("Inverter state unknown");
}
break;
}
case 0xF446: { // Ambient temperature
StandardMetrics.ms_v_env_temp->SetValue((float) (CAN_UINT(4) - 40) * 0.01, Celcius);
ESP_LOGD(TAG, "F446 EVC ms_v_env_temp: %f", (CAN_UINT(4) - 40) * 0.01);
break;
}
case 0x2A09: { // Power consumption by consumer
mt_aux_power_consumer->SetValue((float) CAN_UINT(4) * 10, Watts);
ESP_LOGD(TAG, "2A09 EVC mt_aux_power_consumer: %d", CAN_UINT(4) * 10);
break;
}
case 0x2191: { // Power consumption by ptc
mt_aux_power_ptc->SetValue((float) CAN_UINT(4) * 10, Watts);
ESP_LOGD(TAG, "2191 EVC mt_aux_power_ptc: %d", CAN_UINT(4) * 10);
break;
}
}
}