[RF] handle 64 bits values (except for UNO) (#698)

* handle 64 bits values, except for UNO
Arduino UNO is not enough powerfull to handle properly uint64_t in terms of memory so differenciate the variable type depending on the board type
With this configuration ATMega will not be able to receive with simpleReceiving 64 bits values. Of course Json will work with 64 bits values for this board.
* Simplify jsondata.success() condition
* Renamings and optimize deduplication functions
* replace 2 dimensions array by a structure so as to handle the time with an uint32_t  when using an ESP (instead of a uint64_t)
* change storeValue and isAduplicate function names
* point to the rcswitch revision with the new 40 bits protocol

Co-authored-by: Leon Kiefer <leon.k97@gmx.de>
This commit is contained in:
FlorianandLeon Kiefer authored and GitHub committed 2020-07-18 17:14:19 -05:00
1 parent b66d72ac99
commit 6e9b170c00
10 files changed
+115 -73

No files matched your search

+5 -5
View File
@@ -122,7 +122,7 @@ void IRtoMQTT() {
# ifdef ESP32
Log.trace(F("IR Task running on core :%d" CR), xPortGetCoreID());
# endif
IRdata.set("value", (unsigned long long)(results.value));
IRdata.set("value", (SIGNAL_SIZE_UL_ULL)(results.value));
IRdata.set("protocol", (int)(results.decode_type));
IRdata.set("bits", (int)(results.bits));
# if defined(ESP8266) || defined(ESP32) //resultToHexidecimal is only available with IRremoteESP8266
@@ -162,15 +162,15 @@ void IRtoMQTT() {
Log.trace(F("raw redirected" CR));
# endif
irrecv.resume(); // Receive the next value
unsigned long long MQTTvalue = IRdata.get<unsigned long long>("value");
SIGNAL_SIZE_UL_ULL MQTTvalue = IRdata.get<SIGNAL_SIZE_UL_ULL>("value");
//trc(MQTTvalue);
if ((pubIRunknownPrtcl == false && IRdata.get<int>("protocol") == -1)) { // don't publish unknown IR protocol
Log.notice(F("--no pub unknwn prt--" CR));
} else if (!isAduplicate(MQTTvalue) && MQTTvalue != 0) { // conditions to avoid duplications of IR -->MQTT
} else if (!isAduplicateSignal(MQTTvalue) && MQTTvalue != 0) { // conditions to avoid duplications of IR -->MQTT
Log.trace(F("Adv data IRtoMQTT" CR));
pub(subjectIRtoMQTT, IRdata);
Log.trace(F("Store val: %D" CR), MQTTvalue);
storeValue(MQTTvalue);
storeSignalValue(MQTTvalue);
if (repeatIRwMQTT) {
Log.trace(F("Pub. IR for rpt" CR));
pubMQTT(subjectForwardMQTTtoIR, MQTTvalue);
@@ -281,7 +281,7 @@ void MQTTtoIR(char* topicOri, JsonObject& IRdata) {
}
# endif
bool sendIdentifiedProtocol(const char* protocol_name, unsigned long long data, const char* hex, unsigned int valueBITS, uint16_t valueRPT) {
bool sendIdentifiedProtocol(const char* protocol_name, SIGNAL_SIZE_UL_ULL data, const char* hex, unsigned int valueBITS, uint16_t valueRPT) {
uint8_t dataarray[valueBITS];
if (hex) {
const char* ptr = NULL;