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

[P176] Add plugin Communication - Victron VE.Direct #5148

Open
wants to merge 24 commits into
base: mega
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4cd1d80
[P176] Add plugin Communication - Victron VE.Direct
tonhuisman Oct 25, 2024
9dd301b
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Oct 26, 2024
0aecf3b
[P176] Add some features and code improvements
tonhuisman Oct 26, 2024
9d8135e
[P176] Fix ESP8266 build issue
tonhuisman Oct 26, 2024
d67d8e6
[P176] Update taskvalues at receiving data, other improvements
tonhuisman Oct 27, 2024
78d6a2c
[P176] Fix use of plugin compiletime feature flags
tonhuisman Oct 27, 2024
8c3eb08
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Oct 28, 2024
f5068aa
[P176] Move Led initialization to DataStruct initialization function
tonhuisman Oct 28, 2024
3e862bc
[P176] Add documentation
tonhuisman Oct 28, 2024
7a5f744
[P176] Refactorings to optimize performance (lower load), remove RX T…
tonhuisman Oct 29, 2024
9ca8f79
[P176] Update documentation
tonhuisman Oct 29, 2024
88f7940
[P176] Simplify handling temporary values before checksum checked
TD-er Oct 29, 2024
f2a01e6
[P176] Avoid calling serial->available() too often, uncrustify some r…
tonhuisman Oct 30, 2024
8f475f1
[P176] Update changelog (and GH Actions failed)
tonhuisman Oct 30, 2024
21ff328
[P176] Handle ON and OFF values as 1 and 0
tonhuisman Oct 30, 2024
7de795e
[P176] Fix checksum validation, was ignoring the first line after rec…
tonhuisman Nov 2, 2024
c8d6e45
Merge branch 'mega' into feature/P176-add-plugin-victron-ve.direct
TD-er Nov 4, 2024
ed33fd0
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Nov 8, 2024
7954406
[P176] Add variables `successcount`, `errorcount` and `ischanged`
tonhuisman Nov 8, 2024
90c4a2f
[P176] Rename variable `ischanged` to `updated`
tonhuisman Nov 10, 2024
78cf151
Merge branch 'mega' into feature/P176-add-plugin-victron-ve.direct
TD-er Nov 13, 2024
db133eb
Merge branch 'mega' of https://github.com/letscontrolit/ESPEasy into …
tonhuisman Nov 24, 2024
bbda83d
[P176] Add Events only when updated option and docs
tonhuisman Nov 24, 2024
d39c3f9
[P176] Fix bug in screenshot :-)
tonhuisman Nov 24, 2024
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
2 changes: 2 additions & 0 deletions src/_P176_VE_Direct.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// #######################################################################################################

/** Changelog:
* 2024-11-08 tonhuisman: Add successcount, errorcount and ischanged values for GetConfig. IsChanged will reset the state on each call, so
* should be called only once in a session.
* 2024-10-30 tonhuisman: Accept ON/On and OFF/Off as 1 and 0 numeric values, to be able to use them as Values in the device configuration
* 2024-10-30 tonhuisman: Simplifying the code somewhat, making it more robust, partially by TD-er
* 2024-10-29 tonhuisman: Optimize receiving and processing data, resulting in much lower load (based on suggestions by TD-er)
Expand Down
17 changes: 17 additions & 0 deletions src/src/PluginStructs/P176_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,23 @@ bool P176_data_struct::plugin_get_config_value(struct EventStruct *event,
const String key = parseString(string, 1, '.'); // Decimal point as separator, by convention
VictronValue value;

# if P176_HANDLE_CHECKSUM

if (equals(key, F("successcount"))) {
string = _successCounter;
success = true;
} else
if (equals(key, F("ischanged"))) {
tonhuisman marked this conversation as resolved.
Show resolved Hide resolved
string = _successCounter != _lastSuccessCounter;
_lastSuccessCounter = _successCounter;
success = true;
} else
if (equals(key, F("errorcount"))) {
string = _checksumErrors;
success = true;
} else
# endif // if P176_HANDLE_CHECKSUM

if (getReceivedValue(key, value)) {
string = value.getValue();
success = true;
Expand Down
7 changes: 4 additions & 3 deletions src/src/PluginStructs/P176_data_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ struct P176_data_struct : public PluginTaskData_base {
ESPeasySerial *_serial = nullptr;

# if P176_HANDLE_CHECKSUM
uint32_t _checksumErrors = 0;
uint32_t _checksumDelta = 0;
uint32_t _successCounter = 0;
uint32_t _checksumErrors = 0;
uint32_t _checksumDelta = 0;
uint32_t _successCounter = 0;
uint32_t _lastSuccessCounter = 0;
# endif // if P176_HANDLE_CHECKSUM
int _baud = P176_DEFAULT_BAUDRATE;
unsigned int _serialBuffer = P176_DEFAULT_BUFFER;
Expand Down