sram optimization following platform
This commit is contained in:
1 parent
3a3b7d6482
commit
cdc3791817
2 files changed
+30
-13
No files matched your search
+10
-4
@@ -39,7 +39,13 @@ 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[8][2] ={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
|
||||
#ifdef ESP8266
|
||||
#define array_size 12
|
||||
unsigned long ReceivedSignal[array_size][2] ={{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
|
||||
#else
|
||||
#define array_size 4
|
||||
unsigned long ReceivedSignal[array_size][2] ={{0,0},{0,0},{0,0},{0,0}};
|
||||
#endif
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
//adding this to bypass the problem of the arduino builder issue 50
|
||||
@@ -217,7 +223,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 < 8; i++)
|
||||
for (int i = 0; i < array_size; i++)
|
||||
{
|
||||
trc(String(i) + ":" + String(ReceivedSignal[i][0])+"/"+String(ReceivedSignal[i][1]));
|
||||
}
|
||||
@@ -226,7 +232,7 @@ void storeValue(long MQTTvalue){
|
||||
int getMin(){
|
||||
int minimum = ReceivedSignal[0][1];
|
||||
int minindex=0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < array_size; i++)
|
||||
{
|
||||
if (ReceivedSignal[i][1] < minimum) {
|
||||
minimum = ReceivedSignal[i][1];
|
||||
@@ -239,7 +245,7 @@ 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<8;i++){
|
||||
for (int i = 0; i < array_size;i++){
|
||||
if (ReceivedSignal[i][0] == value){
|
||||
unsigned long now = millis();
|
||||
if (now - ReceivedSignal[i][1] < time_avoid_duplicate){ // change
|
||||
|
||||
+20
-9
@@ -103,15 +103,26 @@ RF supported protocols
|
||||
#define subjectMultiGTWIR "+/IRtoMQTT"
|
||||
|
||||
#define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)
|
||||
//IR supported protocols uncomment if you want to send with this protocol, NEC protocol is available per default
|
||||
#define IR_COOLIX
|
||||
#define IR_Whynter
|
||||
#define IR_LG
|
||||
#define IR_Sony
|
||||
#define IR_DISH
|
||||
#define IR_RC5
|
||||
#define IR_Sharp
|
||||
#define IR_SAMSUNG
|
||||
|
||||
#ifdef ESP8266 //IR supported protocols on ESP8266, all supported per default
|
||||
#define IR_COOLIX
|
||||
#define IR_Whynter
|
||||
#define IR_LG
|
||||
#define IR_Sony
|
||||
#define IR_DISH
|
||||
#define IR_RC5
|
||||
#define IR_Sharp
|
||||
#define IR_SAMSUNG
|
||||
#else //IR supported protocols on arduino uncomment if you want to send with this protocol, NEC protocol is available per default
|
||||
//#define IR_COOLIX
|
||||
//#define IR_Whynter
|
||||
//#define IR_LG
|
||||
//#define IR_Sony
|
||||
//#define IR_DISH
|
||||
//#define IR_RC5
|
||||
//#define IR_Sharp
|
||||
#define IR_SAMSUNG
|
||||
#endif
|
||||
|
||||
/*----------------------BT topics-------------------------*/
|
||||
#define subjectBTtoMQTT "home/BTtoMQTT/"
|
||||
|
||||
Reference in new issue
Block a user