[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
@@ -106,7 +106,7 @@ void RFtoMQTTdiscovery(uint64_t MQTTvalue) {
}
# endif
void RFtoMQTT() {
void RFtoX() {
if (mySwitch.available()) {
StaticJsonDocument<JSON_MSG_BUFFER> RFdataBuffer;
JsonObject RFdata = RFdataBuffer.to<JsonObject>();
@@ -160,7 +160,7 @@ void RFtoMQTT() {
}
# if simpleReceiving
void MQTTtoRF(char* topicOri, char* datacallback) {
void XtoRF(const char* topicOri, const char* datacallback) {
# ifdef ZradioCC1101 // set Receive off and Transmitt on
disableCurrentReceiver();
ELECHOUSE_cc1101.SetTx(RFConfig.frequency);
@@ -224,7 +224,7 @@ void MQTTtoRF(char* topicOri, char* datacallback) {
# endif
# if jsonReceiving
void MQTTtoRF(char* topicOri, JsonObject& RFdata) { // json object decoding
void XtoRF(const char* topicOri, JsonObject& RFdata) { // json object decoding
if (cmpToMainTopic(topicOri, subjectMQTTtoRF)) {
Log.trace(F("MQTTtoRF json" CR));
uint64_t data = RFdata["value"];
@@ -252,7 +252,8 @@ void MQTTtoRF(char* topicOri, JsonObject& RFdata) { // json object decoding
mySwitch.send(data, valueBITS);
Log.notice(F("MQTTtoRF OK" CR));
// 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(subjectGTWRFtoMQTT, RFdata);
RFdata["origin"] = subjectGTWRFtoMQTT;
enqueueJsonObject(RFdata);
mySwitch.setRepeatTransmit(RF_EMITTER_REPEAT); // Restore the default value
}