Skip to content

Commit

Permalink
Merge pull request #929 from openvehicles/revert-905-remove-static-lo…
Browse files Browse the repository at this point in the history
…cals

Revert "Zoe + Smart ED - Move static locals to member variables"
  • Loading branch information
dexterbg committed Aug 19, 2023
2 parents 9fd0802 + 6f40a93 commit 9ddbb01
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ OvmsVehicleRenaultZoe* OvmsVehicleRenaultZoe::GetInstance(OvmsWriter* writer /*=
OvmsVehicleRenaultZoe::OvmsVehicleRenaultZoe() {
ESP_LOGI(TAG, "Start Renault Zoe/Kangoo vehicle module");

m_last_pid = 0;
StandardMetrics.ms_v_type->SetValue("RZ");
StandardMetrics.ms_v_charge_inprogress->SetValue(false);

Expand Down Expand Up @@ -799,14 +798,13 @@ void OvmsVehicleRenaultZoe::IncomingFrameCan1(CAN_frame_t* p_frame) {
* Handles incoming poll results
*/
void OvmsVehicleRenaultZoe::IncomingPollReply(canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, uint8_t length, uint16_t remain) {
string& rxbuf = zoe_obd_rxbuf;

if (pid != m_last_pid) {
// Ignore if it's no tthe same one.
if (m_poll_ml_frame != 0)
return;
//ESP_LOGD(TAG, "pid: %04x length: %d m_poll_ml_remain: %d mlframe: %d", pid, length, m_poll_ml_remain, m_poll_ml_frame);
m_last_pid = pid;
string& rxbuf = zoe_obd_rxbuf;
static uint16_t last_pid = -1;

if (pid != last_pid) {
//ESP_LOGD(TAG, "pid: %04x length: %d m_poll_ml_remain: %d m_poll_ml_frame: %d", pid, length, m_poll_ml_remain, m_poll_ml_frame);
last_pid = pid;
m_poll_ml_frame=0;
}

// init / fill rx buffer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ class OvmsVehicleRenaultZoe : public OvmsVehicle {
private:
unsigned int m_candata_timer;
unsigned int m_candata_poll;

uint16_t m_last_pid;

public:
static void zoe_trip(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv);

Expand Down
10 changes: 5 additions & 5 deletions vehicle/OVMS.V3/components/vehicle_smarted/src/ed_can_poll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ void OvmsVehicleSmartED::ObdInitPoll() {
*/
void OvmsVehicleSmartED::IncomingPollReply(canbus* bus, uint16_t type, uint16_t pid, uint8_t* data, uint8_t length, uint16_t remain) {
string& rxbuf = smarted_obd_rxbuf;
static uint16_t last_pid = -1;

if (pid != m_last_pid) {
//ESP_LOGD(TAG, "pid: %04x length: %d mlremain: %d mlframe: %d", pid, length, mlremain, mlframe);
if (mlframe > 0)
return;
m_last_pid = pid;
if (pid != last_pid) {
//ESP_LOGD(TAG, "pid: %04x length: %d m_poll_ml_remain: %d m_poll_ml_frame: %d", pid, length, m_poll_ml_remain, m_poll_ml_frame);
last_pid = pid;
m_poll_ml_frame=0;
}

// init / fill rx buffer:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ OvmsVehicleSmartED::OvmsVehicleSmartED() : smarted_obd_rxwait(1,1) {
// 12v charging
m_charging_timer = 0;

m_last_pid = 0;
// init commands:
cmd_xse = MyCommandApp.RegisterCommand("xse","SmartED 451 Gen.3");
cmd_xse->RegisterCommand("recu","Set recu..", xse_recu, "<up/down>",1,1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ class OvmsVehicleSmartED : public OvmsVehicle

protected:
int m_reboot_ticker;
uint16_t m_last_pid;

virtual void Ticker1(uint32_t ticker);
virtual void Ticker10(uint32_t ticker);
virtual void Ticker60(uint32_t ticker);
Expand Down

0 comments on commit 9ddbb01

Please sign in to comment.