[SERIAL] Enable SERIAL to X communication (#2068)

Add Serial as a communication layer so as to transmit data to/from serial
Enable discovery of BT sensors through serial
Add serial heartbeat

Change discovery principle for interval and intervalacts, keep them always discovered and deactivate adaptivescan when changed. Instead of removing their discovery when adaptive scan is activated

Increase JSON_MSG_BUFFER_MAX as we are now using const char* and it requires more memory for Arduino Json Deserialization

Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
FlorianandFlorian authored and GitHub committed 2024-09-26 06:55:26 -05:00
1 parent a89ff43900
commit 3187ed6154
52 files changed
+588 -459

No files matched your search

+5 -4
View File
@@ -149,11 +149,11 @@ void loadPilightConfig() {
}
}
void PilighttoMQTT() {
void PilighttoX() {
rf.loop();
}
void MQTTtoPilight(char* topicOri, JsonObject& Pilightdata) {
void XtoPilight(const char* topicOri, JsonObject& Pilightdata) {
if (cmpToMainTopic(topicOri, subjectMQTTtoPilightProtocol)) {
bool success = false;
if (Pilightdata.containsKey("reset")) {
@@ -189,7 +189,8 @@ void MQTTtoPilight(char* topicOri, JsonObject& Pilightdata) {
if (success) {
// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
pub(subjectGTWPilighttoMQTT, Pilightdata);
Pilightdata["origin"] = subjectGTWPilighttoMQTT;
enqueueJsonObject(Pilightdata);
} else {
pub(subjectGTWPilighttoMQTT, "{\"Status\": \"Error\"}"); // Fail feedback
Log.error(F("MQTTtoPilightProtocol Fail json" CR));
@@ -251,7 +252,7 @@ void MQTTtoPilight(char* topicOri, JsonObject& Pilightdata) {
Log.trace(F("MQTTtoPilight msg & protocol ok" CR));
int msgLength = rf.send(protocol, message);
if (msgLength > 0) {
Log.trace(F("Adv data MQTTtoPilight push state via PilighttoMQTT" CR));
Log.trace(F("Adv data XtoPilight push state via PilighttoMQTT" CR));
// Acknowledgement
pub(subjectGTWPilighttoMQTT, message);
success = true;