-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba63780
commit 85d37b8
Showing
11 changed files
with
111 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
/* | ||
* Copyright (C) 2023-2024 Mathieu Carbou | ||
*/ | ||
#include <YaSolR.h> | ||
|
||
Mycila::DS18* ds18O1; | ||
Mycila::DS18* ds18O2; | ||
Mycila::DS18* ds18Sys; | ||
Mycila::Task* ds18Task; | ||
|
||
void yasolr_start_ds18() { | ||
if (config.getBool(KEY_ENABLE_DS18_SYSTEM)) { | ||
if (!ds18Sys) { | ||
ds18Sys = new Mycila::DS18(); | ||
ds18Sys->listen([](float temperature, bool changed) { | ||
if (changed) { | ||
logger.info(TAG, "Router Temperature changed to %.02f °C", temperature); | ||
mqttPublishTask.requestEarlyRun(); | ||
} | ||
}); | ||
} | ||
ds18Sys->begin(config.getLong(KEY_PIN_ROUTER_DS18)); | ||
} | ||
|
||
if (config.getBool(KEY_ENABLE_OUTPUT1_DS18)) { | ||
if (!ds18O1) { | ||
ds18O1 = new Mycila::DS18(); | ||
ds18O1->listen([](float temperature, bool changed) { | ||
output1.temperature().update(temperature); | ||
if (changed) { | ||
logger.info(TAG, "Output 1 Temperature changed to %.02f °C", temperature); | ||
mqttPublishTask.requestEarlyRun(); | ||
} | ||
}); | ||
} | ||
ds18O1->begin(config.getLong(KEY_PIN_OUTPUT1_DS18)); | ||
} | ||
|
||
if (config.getBool(KEY_ENABLE_OUTPUT2_DS18)) { | ||
if (!ds18O2) { | ||
ds18O2 = new Mycila::DS18(); | ||
ds18O2->listen([](float temperature, bool changed) { | ||
output2.temperature().update(temperature); | ||
if (changed) { | ||
logger.info(TAG, "Output 2 Temperature changed to %.02f °C", temperature); | ||
mqttPublishTask.requestEarlyRun(); | ||
} | ||
}); | ||
ds18O2 = new Mycila::DS18(); | ||
} | ||
ds18O2->begin(config.getLong(KEY_PIN_OUTPUT2_DS18)); | ||
} | ||
|
||
if (ds18Sys || ds18O1 || ds18O2) { | ||
ds18Task = new Mycila::Task("DS18", [](void* params) { | ||
if (ds18Sys) { | ||
ds18Sys->read(); | ||
yield(); | ||
} | ||
if (ds18O1) { | ||
ds18O1->read(); | ||
yield(); | ||
} | ||
if (ds18O2) { | ||
ds18O2->read(); | ||
yield(); | ||
} | ||
}); | ||
ds18Task->setInterval(10 * Mycila::TaskDuration::SECONDS); | ||
ds18Task->setManager(coreTaskManager); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters