Add ph2_commands file, update headers

This commit is contained in:
Carsten Schmiemann 2022-11-19 01:14:10 +01:00
parent 42e5f1c6ba
commit 08269a30c3
10 changed files with 105 additions and 17 deletions

View file

@ -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) {

View file

@ -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) {

View file

@ -1,6 +1,6 @@
/*
; Project: Open Vehicle Monitor System
; Date: 15th Apr 2022
; Date: 19th Nov 2022
;
; (C) 2022 Carsten Schmiemann
;

View file

@ -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) {

View file

@ -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) {

View file

@ -1,6 +1,6 @@
/*
; Project: Open Vehicle Monitor System
; Date: 15th Apr 2022
; Date: 19th Nov 2022
;
; (C) 2022 Carsten Schmiemann
;

View file

@ -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 <stdio.h>
#include <string>
#include <iomanip>
#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;
}

View file

@ -1,6 +1,6 @@
/*
; Project: Open Vehicle Monitor System
; Date: 15th Apr 2022
; Date: 19th Nov 2022
;
; (C) 2022 Carsten Schmiemann
;

View file

@ -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 <stdio.h>

View file

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