reduce buffer size for arduino compilation when using ZaddonDHT
This commit is contained in:
1 parent
07810d5f61
commit
118bcf2c18
1 file changed
+10
-9
+10
-9
@@ -16,6 +16,7 @@
|
||||
- 1technophile
|
||||
- crankyoldgit
|
||||
- Spudtater
|
||||
- prahjister
|
||||
- rickybrent
|
||||
- ekim from Home assistant forum
|
||||
- ronvl from Home assistant forum
|
||||
@@ -37,7 +38,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT
|
||||
#include <PubSubClient.h>
|
||||
|
||||
// array to store previous received RFs, IRs codes and their timestamps
|
||||
unsigned long ReceivedSignal[10][2] ={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
|
||||
unsigned long ReceivedSignal[8][2] ={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
//adding this to bypass the problem of the arduino builder issue 50
|
||||
@@ -163,7 +164,7 @@ void loop()
|
||||
{
|
||||
//MQTT client connexion management
|
||||
if (!client.connected()) { // not connected
|
||||
long now = millis();
|
||||
unsigned long now = millis();
|
||||
if (now - lastReconnectAttempt > 5000) {
|
||||
lastReconnectAttempt = now;
|
||||
trc(F("client mqtt not connected, trying to connect"));
|
||||
@@ -183,7 +184,7 @@ void loop()
|
||||
#ifdef ZgatewayRF
|
||||
boolean resultRF = RFtoMQTT();
|
||||
if(resultRF)
|
||||
trc(F("RF successfully sent by MQTT"));
|
||||
trc(F("RF successfully sent by MQTT"));
|
||||
#endif
|
||||
#ifdef ZgatewayIR
|
||||
boolean resultIR = IRtoMQTT();
|
||||
@@ -196,7 +197,7 @@ void loop()
|
||||
}
|
||||
|
||||
void storeValue(long MQTTvalue){
|
||||
long now = millis();
|
||||
unsigned long now = millis();
|
||||
// find oldest value of the buffer
|
||||
int o = getMin();
|
||||
trc(F("Minimum index: "));
|
||||
@@ -207,7 +208,7 @@ void storeValue(long MQTTvalue){
|
||||
trc(F("store this code :"));
|
||||
trc(String(ReceivedSignal[o][0])+"/"+String(ReceivedSignal[o][1]));
|
||||
trc(F("Col: value/timestamp"));
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
trc(String(i) + ":" + String(ReceivedSignal[i][0])+"/"+String(ReceivedSignal[i][1]));
|
||||
}
|
||||
@@ -216,7 +217,7 @@ void storeValue(long MQTTvalue){
|
||||
int getMin(){
|
||||
int minimum = ReceivedSignal[0][1];
|
||||
int minindex=0;
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (ReceivedSignal[i][1] < minimum) {
|
||||
minimum = ReceivedSignal[i][1];
|
||||
@@ -229,11 +230,11 @@ int getMin(){
|
||||
boolean isAduplicate(long value){
|
||||
trc(F("isAduplicate"));
|
||||
// check if the value has been already sent during the last time_avoid_duplicate
|
||||
for (int i=0; i<10;i++){
|
||||
for (int i=0; i<8;i++){
|
||||
if (ReceivedSignal[i][0] == value){
|
||||
long now = millis();
|
||||
unsigned long now = millis();
|
||||
if (now - ReceivedSignal[i][1] < time_avoid_duplicate){ // change
|
||||
trc(F("--------------don't send the received code--------------"));
|
||||
trc(F("--------------don't publish the received code duplicate--------------"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user