Skip to content
New issue

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

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

Already on GitHub? # to your account

Major looping and modbus read re-write. #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mcsarge
Copy link
Member

@mcsarge mcsarge commented Jul 21, 2023

As discussed, I have reworked the looping to call for a publish periodically. The wake publish rate is limited to not fater than every 5 seconds. When publish time comes around, the buffer flags are cleared and an attempt is made to fill them again. Once filled, the data is published to mqtt. Only one modbus async read is allowed at a time. So when multiple reads need to be done, that are done sequentially. If the modbus read does not return or errors out the publish does not happen. There is a timer that will clear the modbus read flag if the read never returns or errors out as a safety.

valid = false;
}
int rate = _webServer.arg(wakePublishRateParam.getId()).toInt() * 1000;
// long mqttServerParamLength = _webServer.arg(mqttServerParam.getId()).length();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this code is commented?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants