Skip to content

Commit

Permalink
fix event
Browse files Browse the repository at this point in the history
  • Loading branch information
KipK committed Feb 1, 2023
1 parent 622e810 commit 415f74e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/limit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down Expand Up @@ -275,14 +275,17 @@ 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;
};

bool Limit::clear() {
_limit_properties.init();
StaticJsonDocument<16> doc;
doc["limit_version"] = ++_version;
event_send(doc);
return true;
};

Expand Down

0 comments on commit 415f74e

Please sign in to comment.