From 0fb74da92cf16c27ec9c3c4c1b949b80a822ccf0 Mon Sep 17 00:00:00 2001 From: KipK Date: Mon, 21 Nov 2022 20:59:00 +0100 Subject: [PATCH] publish override_version after claim engine treat it. --- src/evse_man.cpp | 7 +++++++ src/manual.cpp | 8 +++++--- src/manual.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/evse_man.cpp b/src/evse_man.cpp index cf4c7e73..f3116445 100644 --- a/src/evse_man.cpp +++ b/src/evse_man.cpp @@ -475,6 +475,9 @@ bool EvseManager::claim(EvseClient client, int priority, EvseProperties &target) MicroTask.wakeTask(this); StaticJsonDocument<128> event; event["claims_version"] = ++_version; + if (client == EvseClient_OpenEVSE_Manual) { + event["override_version"] = manual.setVersion(manual.getVersion() + 1); + } event_send(event); } return true; @@ -501,6 +504,10 @@ bool EvseManager::release(EvseClient client) MicroTask.wakeTask(this); StaticJsonDocument<128> event; event["claims_version"] = ++_version; + if (client == EvseClient_OpenEVSE_Manual) { + event["override_version"] = manual.setVersion(manual.getVersion() + 1); + + } event_send(event); return true; } diff --git a/src/manual.cpp b/src/manual.cpp index e57039dd..493ecc0a 100644 --- a/src/manual.cpp +++ b/src/manual.cpp @@ -20,9 +20,6 @@ bool ManualOverride::claim() bool ManualOverride::claim(EvseProperties &props) { if (!props.hasAutoRelease()) props.setAutoRelease(true); - StaticJsonDocument<128> event; - event["override_version"] = ++_version; - event_send(event); return _evse->claim(EvseClient_OpenEVSE_Manual, EvseManager_Priority_Manual, props); } @@ -54,4 +51,9 @@ bool ManualOverride::getProperties(EvseProperties &props) uint8_t ManualOverride::getVersion() { return _version; } + +uint8_t ManualOverride::setVersion(uint8_t version) { + _version = version; + return _version; +} diff --git a/src/manual.h b/src/manual.h index e02bcf34..472a7b94 100644 --- a/src/manual.h +++ b/src/manual.h @@ -23,6 +23,7 @@ class ManualOverride } bool getProperties(EvseProperties &props); uint8_t getVersion(); + uint8_t setVersion(uint8_t version); }; extern ManualOverride manual;