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

incorrect use of serial buffer status corrected #111

Merged
merged 4 commits into from
Feb 28, 2025
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
4 changes: 2 additions & 2 deletions include/schedule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class Schedule {
std::deque<std::vector<uint8_t>> sendCommands;
std::vector<uint8_t> sendCommand;

static bool busReadyCallback();
static void busWriteCallback(const uint8_t byte);
static void writeCallback(const uint8_t byte);
static int readBufferCallback();

static void activeCallback(const std::vector<uint8_t> &master,
const std::vector<uint8_t> &slave);
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lib_deps =
https://github.com/prampec/IotWebConf#v3.2.1
heman/AsyncMqttClient-esphome@^2.1.0
bblanchon/ArduinoJson@^7.2.0
https://github.com/yuhu-/ebus#7a8b223
https://github.com/yuhu-/ebus#56e782c

build_flags =
-DIOTWEBCONF_CONFIG_DONT_USE_MDNS=1
Expand Down
8 changes: 5 additions & 3 deletions src/schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Track<uint32_t> errorsActiveSlaveACK("ebus/errors/active/slaveACK", 10);
// resets
Track<uint32_t> resetsTotal("ebus/resets/total", 10);
Track<uint32_t> resetsPassive00("ebus/resets/passive00", 10);
Track<uint32_t> resetsPassive0704("ebus/resets/passive0704", 10);
Track<uint32_t> resetsPassive("ebus/resets/passive", 10);
Track<uint32_t> resetsActive("ebus/resets/active", 10);

Expand All @@ -56,7 +57,7 @@ Track<uint32_t> requestsError("ebus/requests/error", 10);
Schedule schedule;

Schedule::Schedule()
: ebusHandler(0xff, &busReadyCallback, &busWriteCallback, &activeCallback,
: ebusHandler(0xff, &writeCallback, &readBufferCallback, &activeCallback,
&passiveCallback, &reactiveCallback) {
ebusHandler.setErrorCallback(errorCallback);
}
Expand Down Expand Up @@ -186,6 +187,7 @@ void Schedule::publishCounters() {
// resets
resetsTotal = counters.resetsTotal;
resetsPassive00 = counters.resetsPassive00;
resetsPassive0704 = counters.resetsPassive0704;
resetsPassive = counters.resetsPassive;
resetsActive = counters.resetsActive;

Expand All @@ -197,9 +199,9 @@ void Schedule::publishCounters() {
requestsError = counters.requestsError;
}

bool Schedule::busReadyCallback() { return Bus.availableForWrite(); }
void Schedule::writeCallback(const uint8_t byte) { Bus.write(byte); }

void Schedule::busWriteCallback(const uint8_t byte) { Bus.write(byte); }
int Schedule::readBufferCallback() { return Bus.available(); }

void Schedule::activeCallback(const std::vector<uint8_t> &master,
const std::vector<uint8_t> &slave) {
Expand Down
Loading