Compatible with ESP32

This commit is contained in:
Yurii
2023-11-11 05:01:36 +03:00
parent 6de6f7d138
commit a255dda8dd
13 changed files with 264 additions and 66 deletions

View File

@@ -7,7 +7,14 @@ class OpenThermTask : public Task {
public:
OpenThermTask(bool _enabled = false, unsigned long _interval = 0) : Task(_enabled, _interval) {}
void static IRAM_ATTR handleInterrupt() {
ot->handleInterrupt();
}
protected:
const char* taskName = "OpenTherm task";
const int taskCore = 2;
void setup() {
vars.parameters.heatingMinTemp = settings.heating.minTemp;
vars.parameters.heatingMaxTemp = settings.heating.maxTemp;
@@ -16,8 +23,12 @@ protected:
ot = new CustomOpenTherm(settings.opentherm.inPin, settings.opentherm.outPin);
ot->begin(handleInterrupt, responseCallback);
ot->setHandleSendRequestCallback(sendRequestCallback);
ot->setHandleSendRequestCallback(this->sendRequestCallback);
ot->begin(OpenThermTask::handleInterrupt, this->responseCallback);
ot->setYieldCallback([](void* self) {
static_cast<OpenThermTask*>(self)->yield();
}, this);
#ifdef LED_OT_RX_PIN
pinMode(LED_OT_RX_PIN, OUTPUT);
@@ -160,10 +171,6 @@ protected:
}
}
void static IRAM_ATTR handleInterrupt() {
ot->handleInterrupt();
}
void static sendRequestCallback(unsigned long request, unsigned long response, OpenThermResponseStatus status, byte attempt) {
printRequestDetail(ot->getDataID(request), status, request, response, attempt);
}