From 415f74e8c0ebb79b8b916b558eb16b97716069e7 Mon Sep 17 00:00:00 2001 From: KipK Date: Wed, 1 Feb 2023 10:07:24 +0100 Subject: [PATCH] fix event --- src/limit.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/limit.cpp b/src/limit.cpp index 89855e89..b770344c 100644 --- a/src/limit.cpp +++ b/src/limit.cpp @@ -136,9 +136,6 @@ Limit limit; Limit::Limit() : Limit::Task() { _version = 0; _limit_properties.init(); - StaticJsonDocument<32> doc; - doc["limit_version"] = ++_version; - event_send(doc); }; Limit::~Limit() { @@ -154,6 +151,9 @@ void Limit::begin(EvseManager &evse) { DBUGLN("Starting Limit task"); this -> _evse = &evse; MicroTask.startTask(this); + StaticJsonDocument<16> doc; + doc["limit_version"] = _version; + event_send(doc); }; unsigned long Limit::loop(MicroTasks::WakeReason reason) { @@ -275,7 +275,7 @@ bool Limit::set(String json) { bool Limit::set(LimitProperties props) { _limit_properties = props; - StaticJsonDocument<32> doc; + StaticJsonDocument<16> doc; doc["limit_version"] = ++_version; event_send(doc); return true; @@ -283,6 +283,9 @@ bool Limit::set(LimitProperties props) { bool Limit::clear() { _limit_properties.init(); + StaticJsonDocument<16> doc; + doc["limit_version"] = ++_version; + event_send(doc); return true; };