diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/BCM_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/BCM_pids.cpp index ada991e..8e9062d 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/BCM_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/BCM_pids.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; @@ -22,7 +22,6 @@ ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ - #include "vehicle_renaultzoe_ph2_can.h" void OvmsVehicleRenaultZoePh2CAN::IncomingBCM(uint16_t type, uint16_t pid, const char* data, uint16_t len) { diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/EVC_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/EVC_pids.cpp index d28d24e..6b76dab 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/EVC_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/EVC_pids.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; @@ -22,7 +22,6 @@ ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ - #include "vehicle_renaultzoe_ph2_can.h" void OvmsVehicleRenaultZoePh2CAN::IncomingEVC(uint16_t type, uint16_t pid, const char* data, uint16_t len) { diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/HVAC_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/HVAC_pids.cpp index 3e6e611..63069f1 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/HVAC_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/HVAC_pids.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/INV_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/INV_pids.cpp index 0114902..50e9e88 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/INV_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/INV_pids.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; @@ -22,7 +22,6 @@ ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ - #include "vehicle_renaultzoe_ph2_can.h" void OvmsVehicleRenaultZoePh2CAN::IncomingINV(uint16_t type, uint16_t pid, const char* data, uint16_t len) { diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/LBC_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/LBC_pids.cpp index 76e4ece..30ef813 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/LBC_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/LBC_pids.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; @@ -22,7 +22,6 @@ ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ - #include "vehicle_renaultzoe_ph2_can.h" void OvmsVehicleRenaultZoePh2CAN::IncomingLBC(uint16_t type, uint16_t pid, const char* data, uint16_t len) { diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/UCM_pids.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/UCM_pids.cpp index 35982e3..5394d6d 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/UCM_pids.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/UCM_pids.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/ph2_commands.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/ph2_commands.cpp new file mode 100644 index 0000000..a0ac7bc --- /dev/null +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/ph2_commands.cpp @@ -0,0 +1,88 @@ +/* +; Project: Open Vehicle Monitor System +; Date: 19th Nov 2022 +; +; (C) 2022 Carsten Schmiemann +; +; Permission is hereby granted, free of charge, to any person obtaining a copy +; of this software and associated documentation files (the "Software"), to deal +; in the Software without restriction, including without limitation the rights +; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the Software is +; furnished to do so, subject to the following conditions: +; +; The above copyright notice and this permission notice shall be included in +; all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +; THE SOFTWARE. +*/ +#include "ovms_log.h" + +#include +#include +#include +#include "pcp.h" +#include "ovms_metrics.h" +#include "ovms_events.h" +#include "ovms_config.h" +#include "ovms_command.h" +#include "metrics_standard.h" +#include "ovms_notify.h" +#include "ovms_peripherals.h" +#include "ovms_netmanager.h" + +#include "vehicle_renaultzoe_ph2_can.h" + +OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandPreHeat(bool climatecontrolon) { + //ToDo: Sniff TCU packets for preheat/cool, OVMS is connected on TCU port + return NotImplemented; +} + +OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandWakeup() { + ESP_LOGI(TAG, "Send Wakeup Command"); + + vTaskDelay(500 / portTICK_PERIOD_MS); + + uint32_t txid = 0x747, rxid = 0x767; //IVI + uint8_t protocol = ISOTP_STD; + int timeout_ms = 100; + std::string request; + std::string response; + + request = hexdecode("2F90090301"); + int err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol); + + request = hexdecode("2F900900"); + err = PollSingleRequest(m_can1, txid, rxid, request, response, timeout_ms, protocol); + + if (err == POLLSINGLE_TXFAILURE) { + ESP_LOGE(TAG, "ERROR: transmission failure (CAN bus error)"); + return Fail; + } + else if (err < 0) { + ESP_LOGD(TAG, "ERROR: timeout waiting for poller/response"); + return Fail; + } + else if (err) { + ESP_LOGD(TAG, "ERROR: request failed with response error code %02X\n", err); + return Fail; + } + + return Success; +} + +OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandLock(bool climatecontrolon) { + //ToDo: Sniff HFM/BCM packets + return NotImplemented; +} + +OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandUnlock(bool climatecontrolon) { + //ToDo: Sniff HFM/BCM packets + return NotImplemented; +} \ No newline at end of file diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/rz2_web.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/rz2_web.cpp index a97437b..2d3f8d5 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/rz2_web.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/rz2_web.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp index ad25b02..f51f7a8 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.cpp @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; @@ -22,8 +22,6 @@ ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ - - #include "ovms_log.h" #include diff --git a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h index 1047fe3..9d66a11 100644 --- a/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h +++ b/OVMS.V3/components/vehicle_renaultzoe_ph2_can/src/vehicle_renaultzoe_ph2_can.h @@ -1,6 +1,6 @@ /* ; Project: Open Vehicle Monitor System -; Date: 15th Apr 2022 +; Date: 19th Nov 2022 ; ; (C) 2022 Carsten Schmiemann ; @@ -22,7 +22,6 @@ ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ - #ifndef __VEHICLE_RENAULTZOE_PH2_OBD_H__ #define __VEHICLE_RENAULTZOE_PH2_OBD_H__ @@ -102,6 +101,8 @@ class OvmsVehicleRenaultZoePh2CAN : public OvmsVehicle { private: unsigned int m_can1_activity_timer; + + OvmsCommand *cmd_zoe_ph2; // Renault ZOE specific metrics OvmsMetricBool *mt_bus_awake; //CAN bus awake status @@ -128,7 +129,12 @@ class OvmsVehicleRenaultZoePh2CAN : public OvmsVehicle { OvmsMetricString *mt_hvac_compressor_mode; //Compressor mode OvmsMetricFloat *mt_v_env_pressure; //Ambient air pressure - + public: + virtual vehicle_command_t CommandWakeup(); + virtual vehicle_command_t CommandPreHeat(bool enable); + virtual vehicle_command_t CommandLock(const char* pin); + virtual vehicle_command_t CommandUnlock(const char* pin); + protected: string zoe_obd_rxbuf; };