diff --git a/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.cpp b/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.cpp index f8fc226..ff6f740 100644 --- a/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.cpp +++ b/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.cpp @@ -353,7 +353,7 @@ void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *xbm) { int16_t widthInXbm = (width + 7) / 8; - uint8_t data; + uint8_t data = 0; for(int16_t y = 0; y < height; y++) { for(int16_t x = 0; x < width; x++ ) { @@ -388,6 +388,7 @@ void OLEDDisplay::drawStringInternal(int16_t xMove, int16_t yMove, char* text, u case TEXT_ALIGN_RIGHT: xMove -= textWidth; break; + case TEXT_ALIGN_LEFT:; } // Don't draw anything if it is not on the screen. @@ -719,7 +720,7 @@ void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t widt int16_t xPos = xMove + (i / rasterHeight); int16_t yPos = ((yMove >> 3) + (i % rasterHeight)) * DISPLAY_WIDTH; - int16_t yScreenPos = yMove + yOffset; + //int16_t yScreenPos = yMove + yOffset; int16_t dataPos = xPos + yPos; if (dataPos >= 0 && dataPos < DISPLAY_BUFFER_SIZE && diff --git a/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.h b/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.h index 81537a2..a3b162e 100644 --- a/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.h +++ b/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.h @@ -247,10 +247,10 @@ class OLEDDisplay : public Print { char *logBuffer = NULL; // Send a command to the display (low level function) - virtual void sendCommand(uint8_t com) {}; + virtual void sendCommand(uint8_t com) { (void)com; }; // Connect to the display - virtual bool connect() {}; + virtual bool connect() { return false; }; // Send all the init commands void sendInitCommands(); diff --git a/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplayUi.cpp b/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplayUi.cpp index 3fb4326..a9f348b 100644 --- a/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplayUi.cpp +++ b/lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplayUi.cpp @@ -277,6 +277,8 @@ void OLEDDisplayUi::drawFrame(){ x1 = 0; y1 = y - 64; break; + default: + return; } // Invert animation if direction is reversed. @@ -331,7 +333,7 @@ void OLEDDisplayUi::drawIndicator() { return; } - uint8_t posOfHighlightFrame; + uint8_t posOfHighlightFrame = 0; float indicatorFadeProgress = 0; // if the indicator needs to be slided in we want to diff --git a/lib/Streaming/src/Streaming.h b/lib/Streaming/src/Streaming.h index 73afdf6..68c448f 100644 --- a/lib/Streaming/src/Streaming.h +++ b/lib/Streaming/src/Streaming.h @@ -100,6 +100,6 @@ inline Print &operator <<(Print &obj, const _FLOAT &arg) enum _EndLineCode { endl }; inline Print &operator <<(Print &obj, _EndLineCode arg) -{ obj.println(); return obj; } +{ (void)arg; obj.println(); return obj; } #endif diff --git a/lib/aes/AES-128_V10.cpp b/lib/aes/AES-128_V10.cpp index 734e013..221adad 100644 --- a/lib/aes/AES-128_V10.cpp +++ b/lib/aes/AES-128_V10.cpp @@ -77,7 +77,7 @@ static unsigned char AES_Sub_Byte(unsigned char Byte); static void AES_Shift_Rows(); static void AES_Mix_Collums(); static void AES_Calculate_Round_Key(unsigned char Round, unsigned char *Round_Key); -static void Send_State(); +//static void Send_State(); /* ***************************************************************************************** diff --git a/src/ESP-sc-gway.ino b/src/ESP-sc-gway.ino index 0d7c96e..6a12937 100644 --- a/src/ESP-sc-gway.ino +++ b/src/ESP-sc-gway.ino @@ -140,7 +140,7 @@ uint8_t pdebug= P_MAIN ; // Initially only MAIN and GUI # endif //_GPS #endif //_GATEWAYNODE -using namespace std; +//using namespace std; byte currentMode = 0x81; bool sx1272 = false; // Actually we use sx1276/RFM95 uint8_t MAC_array[6]; @@ -238,7 +238,7 @@ int sendPacket(uint8_t *buf, uint8_t length); // _txRx.ino forward void printIP(IPAddress ipa, const char sep, String & response); // _wwwServer.ino void setupWWW(); // _wwwServer.ino forward -void mPrint(String txt); // _utils.ino +void mPrint(const String& txt); // _utils.ino int getNtpTime(time_t *t); // _utils.ino int mStat(uint8_t intr, String & response); // _utils.ino void SerialStat(uint8_t intr); // _utils.ino @@ -292,7 +292,7 @@ void setup() { char MAC_char[19]; // XXX Unbelievable MAC_char[18] = 0; - char hostname[12]; // hostname space + char hostname[32]; // hostname space initConfig(&gwayConfig); @@ -363,14 +363,14 @@ void setup() { // if (readGwayCfg(_CONFIGFILE, &gwayConfig) > 0) { // read the Gateway Config # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("readGwayCfg:: return OK"); } # endif } else { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("setup:: readGwayCfg: ERROR readGwayCfg Failed"); } # endif @@ -402,7 +402,7 @@ void setup() { // Setup WiFi UDP connection. Give it some time and retry x times. '0' means try forever while (WlanConnect(0) <= 0) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_MAIN)) { + if ((debug>=1) && (pdebug & P_MAIN)) { mPrint("setup:: Error Wifi network connect(0)"); } # endif //_MONITOR @@ -429,7 +429,7 @@ void setup() { # endif //ESP32_ARCH # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { String response = "Host="; # if defined(ESP32_ARCH) response += String(WiFi.getHostname()); @@ -487,7 +487,7 @@ void setup() { // display results of getting hardware address // # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { String response= "Gateway ID: "; printHexDigit(MAC_array[0], response); printHexDigit(MAC_array[1], response); @@ -531,8 +531,8 @@ void setup() { time_t newTime; if (getNtpTime(&newTime)<=0) { # if _MONITOR>=1 - if (debug>=0) { - mPrint("setup:: ERROR Time not set (yet). Time="+String(newTime) ); + if (debug>=1) { + mPrint("setup:: ERROR Time not set (yet). Time="+String((int)newTime) ); } # endif //_MONITOR response += "."; @@ -549,7 +549,7 @@ void setup() { // When we are here we succeeded in getting the time startTime = now(); // Time in seconds # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { String response= "Time set="; stringTime(now(),response); mPrint(response); @@ -670,7 +670,7 @@ void loop () // We will not read Udp in this loop cycle if not connected to Wlan if (WlanConnect(1) < 0) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_MAIN)) { + if ((debug>=1) && (pdebug & P_MAIN)) { mPrint("loop:: ERROR reconnect WLAN"); } # endif //_MONITOR @@ -701,7 +701,7 @@ void loop () // if (readUdp(packetSize) < 0) { # if _MONITOR>=1 - if (debug>=0) + if (debug>=1) mPrint("v readUdp ERROR, returning < 0"); # endif //_MONITOR break; @@ -882,7 +882,7 @@ void loop () if (getNtpTime(&newTime)<=0) { # if _MONITOR>=1 if (debug>=2) { - mPrint("loop:: WARNING Time not set (yet). Time="+String(newTime) ); + mPrint("loop:: WARNING Time not set (yet). Time="+String((int)newTime) ); } # endif //_MONITOR } diff --git a/src/_WiFi.ino b/src/_WiFi.ino index f322eff..b065d00 100644 --- a/src/_WiFi.ino +++ b/src/_WiFi.ino @@ -45,7 +45,7 @@ int WlanStatus() { // The ESP is configured to reconnect to the last router in memory. case WL_DISCONNECTED: # if _MONITOR>=1 - if ( debug>=0 ) { + if ( debug>=1 ) { mPrint("WlanStatus:: DISCONNECTED, IP=" + String(WiFi.localIP().toString())); // 6 } # endif @@ -58,7 +58,7 @@ int WlanStatus() { // When still pocessing case WL_IDLE_STATUS: # if _MONITOR>=1 - if ( debug>=0 ) { + if ( debug>=1 ) { mPrint("WlanStatus:: IDLE"); // 0 } # endif //_MONITOR @@ -68,14 +68,14 @@ int WlanStatus() { // Whene detected, the program will search for a better AP in range case WL_NO_SSID_AVAIL: # if _MONITOR>=1 - if ( debug>=0 ) + if ( debug>=1 ) mPrint("WlanStatus:: NO SSID"); // 1 # endif //_MONITOR break; case WL_CONNECT_FAILED: # if _MONITOR>=1 - if ( debug>=0 ) + if ( debug>=1 ) mPrint("WlanStatus:: Connect FAILED"); // 4 # endif //_MONITOR break; @@ -83,7 +83,7 @@ int WlanStatus() { // Never seen this code case WL_SCAN_COMPLETED: # if _MONITOR>=1 - if ( debug>=0 ) + if ( debug>=1 ) mPrint("WlanStatus:: SCAN COMPLETE"); // 2 # endif //_MONITOR break; @@ -91,7 +91,7 @@ int WlanStatus() { // Never seen this code case WL_CONNECTION_LOST: # if _MONITOR>=1 - if ( debug>=0 ) + if ( debug>=1 ) mPrint("WlanStatus:: Connection LOST"); // 5 # endif //_MONITOR break; @@ -100,14 +100,14 @@ int WlanStatus() { // before accessing WiFi functions case WL_NO_SHIELD: # if _MONITOR>=1 - if ( debug>=0 ) + if ( debug>=1 ) mPrint("WlanStatus:: WL_NO_SHIELD"); // # endif //_MONITOR break; default: # if _MONITOR>=1 - if ( debug>=0 ) { + if ( debug>=1 ) { mPrint("WlanStatus Error:: code=" + String(WiFi.status())); // 255 means ERROR } # endif //_MONITOR @@ -286,7 +286,7 @@ int WlanConnect(int maxTry) { agains++; delay(8000); // delay(agains*500); # if _MONITOR>=1 - if ( debug>=0 ) { + if ( debug>=1 ) { Serial.print("."); // Serial only } # endif //_MONITOR diff --git a/src/_loraFiles.ino b/src/_loraFiles.ino index 5209847..49ebcfd 100644 --- a/src/_loraFiles.ino +++ b/src/_loraFiles.ino @@ -46,7 +46,7 @@ int initMonitor(struct moniLine *monitor) void id_print (String id, String val) { #if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_MAIN)) { + if ((debug>=1) && (pdebug & P_MAIN)) { Serial.print(id); Serial.print(F("=\t")); Serial.println(val); @@ -172,7 +172,7 @@ int readConfig(const char *fn, struct espGwayConfig *c) while (f.available()) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_MAIN)) { + if ((debug>=1) && (pdebug & P_MAIN)) { Serial.print('.'); } # endif //_MONITOR @@ -183,7 +183,7 @@ int readConfig(const char *fn, struct espGwayConfig *c) if (tries >= 15) { f.close(); # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("readConfig:: Formatting"); } # endif //_MONITOR @@ -494,7 +494,10 @@ int addLog(const unsigned char * line, int cnt) f.close(); // Close the file after appending to it -#endif //_STAT_LOG +#else //!_STAT_LOG + (void)line; + (void)cnt; +#endif //!_STAT_LOG gwayConfig.logFileRec++; diff --git a/src/_loraModem.ino b/src/_loraModem.ino index 40138e7..021a013 100644 --- a/src/_loraModem.ino +++ b/src/_loraModem.ino @@ -430,7 +430,7 @@ uint8_t receivePkt(uint8_t *payload) if (irqflags & IRQ_LORA_CRCERR_MASK) // Is CRC error? { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_RADIO)) { + if ((debug>=1) && (pdebug & P_RADIO)) { String response=("rxPkt:: Err CRC, t="); stringTime(now(), response); mPrint(response); @@ -445,7 +445,7 @@ uint8_t receivePkt(uint8_t *payload) else if ((irqflags & IRQ_LORA_HEADER_MASK) == false) // Header not ok? { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_RADIO)) { + if ((debug>=1) && (pdebug & P_RADIO)) { mPrint("rxPkt:: Err HEADER"); } # endif //_MONITOR @@ -484,7 +484,7 @@ uint8_t receivePkt(uint8_t *payload) if (receivedCount > PAYLOAD_LENGTH) { # if _MONITOR>=1 - if ((debug>=0) & (pdebug & P_RADIO)) { + if ((debug>=1) & (pdebug & P_RADIO)) { mPrint("rxPkt:: ERROR Payliad receivedCount="+String(receivedCount)); } # endif //_MONITOR diff --git a/src/_stateMachine.ino b/src/_stateMachine.ino index 073ece6..3d2c24d 100644 --- a/src/_stateMachine.ino +++ b/src/_stateMachine.ino @@ -133,7 +133,7 @@ void stateMachine() default: doneWait *= 1; # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_PRE)) { + if ((debug>=1) && (pdebug & P_PRE)) { mPrint("StateMachine:: PRE: DEF set"); } # endif //_MONITOR @@ -374,7 +374,7 @@ void stateMachine() // else { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_SCAN)) { + if ((debug>=1) && (pdebug & P_SCAN)) { String response = "SCAN unknown:: "; mStat(intr, response); mPrint(response); @@ -529,7 +529,7 @@ void stateMachine() // else { # if _MONITOR>=1 - if ( debug>=0) { + if ( debug>=1) { mPrint("ERROR CAD: Unknown::" + String(intr) ); } # endif //_MONITOR @@ -565,7 +565,7 @@ void stateMachine() // if (intr & IRQ_LORA_CRCERR_MASK) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_RX)) { + if ((debug>=1) && (pdebug & P_RX)) { String response = "^ CRC ERROR:: "; mStat(intr, response); } @@ -612,7 +612,7 @@ void stateMachine() if((LoraUp.size = receivePkt(LoraUp.payLoad)) <= 0) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_RX)) { + if ((debug>=1) && (pdebug & P_RX)) { String response = "sMachine:: ERROR S-RX: size=" + String(LoraUp.size); mPrint(response); } @@ -663,7 +663,7 @@ void stateMachine() // if (receivePacket() <= 0) { // read is not successful # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_RX)) { + if ((debug>=1) && (pdebug & P_RX)) { mPrint("sMach:: ERROR receivePacket"); } # endif //_MONITOR @@ -760,7 +760,7 @@ void stateMachine() // as HEADER interrupt comes just before RXDONE else { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_RX)) { + if ((debug>=1) && (pdebug & P_RX)) { mPrint("R S_RX:: no RXDONE, RXTOUT, HEADER:: " + String(intr)); } # endif //_MONITOR @@ -880,7 +880,7 @@ void stateMachine() if (Udp.write((unsigned char *)buff, 12) != 12) { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("^ readUdp:: ERROR: PULL_ACK write"); } # endif //_MONITOR @@ -895,7 +895,7 @@ void stateMachine() if (!Udp.endPacket()) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_TX)) { + if ((debug>=1) && (pdebug & P_TX)) { mPrint("^ readUdp:: PULL_ACK: ERROR Udp.endPacket"); } # endif //_MONITOR @@ -906,7 +906,7 @@ void stateMachine() // If a soft _event==0 interrupt and no transmission finished: else if ( intr != 0 ) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_TX)) { + if ((debug>=1) && (pdebug & P_TX)) { String response = "TXDONE:: ERROR unknown intr="; mStat(intr, response); mPrint(response); @@ -965,14 +965,14 @@ void stateMachine() // make sure that we pick up next interrupt default: # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_PRE)) { + if ((debug>=1) && (pdebug & P_PRE)) { mPrint("ERR state=" + String(_state)); } # endif //_MONITOR if ((gwayConfig.cad) || (gwayConfig.hop)) { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { String response = "default:: Unknown _state "; mStat(intr, response); mPrint(response); diff --git a/src/_txRx.ino b/src/_txRx.ino index 2913b5a..a9213fc 100644 --- a/src/_txRx.ino +++ b/src/_txRx.ino @@ -94,7 +94,7 @@ int sendPacket(uint8_t *buf, uint8_t len) auto error = deserializeJson(jsonBuffer, bufPtr); if (error) { # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_TX)) { + if ((debug>=1) && (pdebug & P_TX)) { mPrint("v sendPacket:: ERROR: Json Decode: " + String(bufPtr) ); } # endif //_MONITOR @@ -115,7 +115,7 @@ int sendPacket(uint8_t *buf, uint8_t len) const char * datr = root["txpk"]["datr"]; // eg "SF7BW125" const char * codr = root["txpk"]["codr"]; // "4/5" const char * modu = root["txpk"]["modu"]; - const char * time = root["txpk"]["time"]; // Time is a string in UTC + //const char * time = root["txpk"]["time"]; // Time is a string in UTC LoraDown.modu = (char *) modu; // =="LORA" LoraDown.codr = (char *) codr; // e.g. "4/5" @@ -152,7 +152,7 @@ int sendPacket(uint8_t *buf, uint8_t len) } else { // There is data! # if _MONITOR>=1 - if ((debug>=0) && (pdebug & P_TX)) { + if ((debug>=1) && (pdebug & P_TX)) { mPrint("v sendPacket:: ERROR: data is NULL"); } # endif //_MONITOR @@ -193,7 +193,7 @@ int sendPacket(uint8_t *buf, uint8_t len) uint32_t fff = (uint32_t)(root["txpk"]["freq"].as() * 1000000); - if (abs(freqs[gwayConfig.ch].dwnFreq - fff) < 100000) { + if ((freqs[gwayConfig.ch].dwnFreq - fff) < 100000) { LoraDown.freq = (uint32_t) (freqs[gwayConfig.ch].dwnFreq) & 0xFFFFFFFF ; } else { @@ -225,7 +225,7 @@ int sendPacket(uint8_t *buf, uint8_t len) if (LoraDown.size != psize) { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("v sendPacket:: WARNING size=" + String(LoraDown.size) + ", psize=" + String(psize) ); } # endif //_MONITOR diff --git a/src/_udpSemtech.ino b/src/_udpSemtech.ino index f8d8f4a..2dcab84 100644 --- a/src/_udpSemtech.ino +++ b/src/_udpSemtech.ino @@ -63,7 +63,7 @@ bool connectUdp() } else{ # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("Connection failed"); } # endif //_MONITOR @@ -135,7 +135,7 @@ int readUdp(int packetSize) if (remotePortNo == 123) { // NTP message arriving, not expected // This is an NTP message arriving # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("v readUdp:: NTP msg rcvd"); } # endif //_MONITOR @@ -151,7 +151,9 @@ int readUdp(int packetSize) // First 4 butes are very important, rest is data // Especially the 2 token bytes should be watched. protocol= buff_down[0]; +# ifdef _PROFILER uint16_t token= buff_down[2]*256 + buff_down[1]; // LSB first [1], MSB [2] comes after +# endif //_PROFILER uint8_t ident= buff_down[3]; // uint8_t *data = (uint8_t *) ((uint8_t *)buff_down + 4); @@ -283,7 +285,9 @@ int readUdp(int packetSize) case PULL_RESP: // 0x03 DOWN if (protocol==0x01) { // If protocol version is 0x01 +# ifdef _PROFILER token = 0; // Use token 0 in that case +# endif//_PROFILER buff_down[2]=0; buff_down[1]=0; } @@ -314,7 +318,7 @@ int readUdp(int packetSize) // as described in the specs. This function fills LoraDown struct. if (sendPacket(buff_down, packetSize) < 0) { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("v readUdp:: ERROR: PULL_RESP sendPacket failed"); } # endif //_MONITOR @@ -585,7 +589,7 @@ int sendUdp(IPAddress server, int port, uint8_t *msg, uint16_t length) if (!Udp.beginPacket(server, (int) port)) { # if _MONITOR>=1 - if ( debug>=0 ) { + if ( debug>=1 ) { mPrint("M sendUdp:: ERROR Udp.beginPacket"); } # endif //_MONITOR @@ -596,7 +600,7 @@ int sendUdp(IPAddress server, int port, uint8_t *msg, uint16_t length) if (Udp.write((unsigned char *)msg, length) != length) { # if _MONITOR>=1 - if ( debug>=0 ) { + if ( debug>=1 ) { mPrint("sendUdp:: ERROR Udp write"); } # endif //_MONITOR @@ -608,7 +612,7 @@ int sendUdp(IPAddress server, int port, uint8_t *msg, uint16_t length) if (!Udp.endPacket()) { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("sendUdp:: ERROR Udp.endPacket"); } # endif //_MONITOR diff --git a/src/_utils.ino b/src/_utils.ino index 6ff8a1f..e6f46b5 100644 --- a/src/_utils.ino +++ b/src/_utils.ino @@ -45,6 +45,8 @@ void printInt (uint32_t i, String & response) void printRegs(struct LoraDown *LoraDown, String & response) { + (void)LoraDown; + response += "v FIFO (0x00)=0x" + String(readRegister(REG_FIFO),HEX); response += "v OPMODE (0x01)=0x" + String(readRegister(REG_OPMODE),HEX); @@ -168,7 +170,7 @@ void printIP(IPAddress ipa, const char sep, String & response) void printHex(uint32_t hexa, const char sep, String & response) { # if _MONITOR>=1 - if ((debug>=0) && (hexa==0)) { + if ((debug>=1) && (hexa==0)) { mPrint("printHex:: hexa amount to convert is 0"); } # endif @@ -209,7 +211,7 @@ void printHexDigit(uint8_t digit, String & response) // return: // // ---------------------------------------------------------------------------------------- -void mPrint(String txt) +void mPrint(const String& txt) { # if _DUSB>=1 @@ -252,7 +254,7 @@ int mStat(uint8_t intr, String & response) { #if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { response += "I="; @@ -461,7 +463,7 @@ int getNtpTime(time_t *t) if (!sendNtpRequest(ntpServer)) // Send the request for new time { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("utils:: ERROR getNtpTime: sendNtpRequest failed"); } # endif //_MONITOR @@ -481,7 +483,7 @@ int getNtpTime(time_t *t) if (Udp.read(packetBuffer, NTP_PACKET_SIZE) < NTP_PACKET_SIZE) { # if _MONITOR>=1 - if (debug>=0) { + if (debug>=1) { mPrint("getNtpTime:: ERROR packetsize too low"); } # endif //_MONITOR diff --git a/src/_wwwServer.ino b/src/_wwwServer.ino index cd14989..05d7fd3 100644 --- a/src/_wwwServer.ino +++ b/src/_wwwServer.ino @@ -145,7 +145,9 @@ void wwwFile(String fn) # endif //_MONITOR -#endif //_STAT_LOG +#else //!_STAT_LOG + (void)fn; +#endif //!_STAT_LOG return; diff --git a/src/configGway.h b/src/configGway.h index b69e58b..a60c5b9 100644 --- a/src/configGway.h +++ b/src/configGway.h @@ -33,6 +33,10 @@ // // ======================================================================================== +// esp8266 arduino core is deprecating SPIFFS +#if !defined _USE_LITTLEFS +# define _USE_LITTLEFS 0 +#endif // Define whether we should do a formatting of SPIFFS when starting the gateway // This is usually a good idea if the webserver is interrupted halfway a writing @@ -126,15 +130,17 @@ // continuous listen mode. // Using this function means that we HAVE to use more dio pins on the RFM95/sx1276 // device and also connect enable dio1 to detect this state. +#ifndef _CAD #define _CAD 1 - +#endif // CRCCHECK // Defines whether we should check on the CRC of RXDONE messages (see stateMachine.ino) // This should prevent us from getting a lot os stranges messgages of unknown nodes. // Note: DIO3 must be connected for this to work (Heltec and later Wemos gateways). +#ifndef _CRCCHECK #define _CRCCHECK 1 - +#endif // Definitions for the admin webserver. // _SERVER determines whether or not the admin webpage is included in the sketch. @@ -290,8 +296,9 @@ // 1: Use the nodes as a translation table for hex codes to names (in TLN) // 2: Same as 1, but is nodes NOT in the nodes list below they are NOT shown // NOTE: We probably will make this list dynamic! +#ifndef _TRUSTED_NODES #define _TRUSTED_NODES 1 - +#endif // ======================================================================== // DO NOT CHANGE BELOW THIS LINE @@ -362,4 +369,9 @@ #if _REPEATER==0 # define _TTNSERVER "router.eu.thethings.network" # define _TTNPORT 1700 // Standard port for TTN -#endif \ No newline at end of file +#endif + +#if _USE_LITTLEFS==1 +#include +#define SPIFFS LittleFS +#endif diff --git a/src/configNode.h b/src/configNode.h index 1a6f27b..ee13fc4 100644 --- a/src/configNode.h +++ b/src/configNode.h @@ -109,8 +109,14 @@ struct wpas { // Please fill in at least ONE valid SSID and password from your own WiFI network // below. This is needed to get the gateway working // + +#ifndef STASSID +#define STASSID "yourSSID" +#define STAPSK "yourPassword" +#endif + wpas wpa[] = { - { "yourSSID", "yourPassword" }, + { STASSID, STAPSK }, { "Your2SSID", "your2Password" } }; diff --git a/src/oLED.h b/src/oLED.h index b8ee697..2e0ee00 100644 --- a/src/oLED.h +++ b/src/oLED.h @@ -50,6 +50,10 @@ #define OLED_SDA 21 // GPIO21 / SDA #define OLED_RST 16 // Reset pin (Some OLED displays do not have it) +#elif defined(ARDUINO_ARCH_ESP8266) +#define OLED_SCL 5 // GPIO5 / D1 +#define OLED_SDA 4 // GPIO4 / D2 + #endif