Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish override_version after claim engine has treated it. #489

Merged
merged 2 commits into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/evse_man.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions src/manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
}

1 change: 1 addition & 0 deletions src/manual.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ManualOverride
}
bool getProperties(EvseProperties &props);
uint8_t getVersion();
uint8_t setVersion(uint8_t version);
};

extern ManualOverride manual;
Expand Down