Bläddra i källkod

Version 6.2.0; Removed typos, repaired header and prepared for PlatformIO

platenspeler 5 år sedan
förälder
incheckning
cd4236b933

+ 2 - 8
ESP-sc-gway/ESP-sc-gway.ino

@@ -65,17 +65,12 @@ extern "C" {
 // ----------- Specific ESP32 stuff --------------
 #if defined (ARDUINO_ARCH_ESP32) || defined(ESP32)
 #	define ESP32_ARCH 1
-
-//#	include <esp_wifi.h>
-//#	include <WiFi.h>
 #	include <ESPmDNS.h>
 #	include <SPIFFS.h>
 
 #	if _WIFIMANAGER==1
 #		define ESP_getChipId()   ((uint32_t)ESP.getEfuseMac())
 #		include <ESP_WiFiManager.h>							// Library for ESP WiFi config through an AP
-//#		include <WebServer.h>
-//#		include <HttpClient.h>
 #	endif //_WIFIMANAGER
 
 #	if A_SERVER==1
@@ -222,12 +217,12 @@ void mPrint(String txt);												// _utils.ino
 int getNtpTime(time_t *t);												// _utils.ino
 int mStat(uint8_t intr, String & response);								// _utils.ini
 void SerialStat(uint8_t intr);											// _utils.ino
-void printHexDigit(uint8_t digit, String & response);				// _utils.ino
+void printHexDigit(uint8_t digit, String & response);					// _utils.ino
 int inDecodes(char * id);												// _utils.ino
 static void stringTime(time_t t, String & response);					// _urils.ino
 
 int initMonitor(struct moniLine *monitor);								// _loraFiles.ino
-int initConfig(struct espGwayConfig *c);								// _loraFiles.ino
+void initConfig(struct espGwayConfig *c);								// _loraFiles.ino
 int writeSeen(const char *fn, struct nodeSeen *listSeen);				// _loraFiles.ino
 int readGwayCfg(const char *fn, struct espGwayConfig *c);				// _loraFiles.ino
 
@@ -635,7 +630,6 @@ void setup() {
 // ----------------------------------------------------------------------------
 void loop ()
 {
-	uint32_t uSeconds;										// micro seconds
 	int packetSize;
 	uint32_t nowSeconds = now();
 	

+ 3 - 2
ESP-sc-gway/_WiFi.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.
@@ -138,7 +138,7 @@ int wifiMgr()
 	String ssid = String(AP_NAME) + "-" + String(ESP_getChipId(), HEX);
 	char s [ssid.length() + 1];
 	strncpy(s, ssid.c_str(), ssid.length());
-	s[ssid.length()]=0;
+	s[ssid.length()]= 0;
 	ESP_wifiManager.setConfigPortalTimeout(120);
 	ESP_wifiManager.startConfigPortal(s, AP_PASSWD );
 		
@@ -167,6 +167,7 @@ int wifiMgr()
 		wifi_station_get_config(&sta_conf);
 #	endif //ESP32_ARCH
 #endif //_WIFIMANAGER
+	return 1;
 }
 
 

+ 1 - 1
ESP-sc-gway/_gatewayMgt.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg 
+// Copyright (c) 2016-2020 Maarten Westenberg 
 //
 // Based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 // and many others.

+ 9 - 11
ESP-sc-gway/_loraFiles.ino

@@ -62,7 +62,7 @@ void id_print (String id, String val)
 // which is not very well defined. This function will init some of the settings
 // to well known settings.
 // ----------------------------------------------------------------------------
-int initConfig(struct espGwayConfig *c)
+void initConfig(struct espGwayConfig *c)
 {
 	(*c).ch = 0;
 	(*c).sf = _SPREADING;
@@ -408,8 +408,8 @@ int addLog(const unsigned char * line, int cnt)
 		return(0);								// If file open failed, return
 	}
 	
-	int i;
-#if _MONITOR>=1
+	int i=0;
+#	if _MONITOR>=1
 	if (( debug>=2 ) && ( pdebug & P_GUI )) {
 		Serial.print(F("addLog:: fileno="));
 		Serial.print(gwayConfig.logFileNo);
@@ -428,7 +428,7 @@ int addLog(const unsigned char * line, int cnt)
 		Serial.print((char *) &line[i]);	// The rest if the buffer contains ascii
 		Serial.println();
 	}
-#endif //_MONITOR
+#	endif //_MONITOR
 
 	for (i=0; i< 12; i++) {					// The first 12 bytes contain non printable characters
 	//	f.print(line[i],HEX);
@@ -456,16 +456,15 @@ void printLog()
 #if _STAT_LOG==1
 	char fn[16];
 
-#if _DUSB>=1
+#	if _DUSB>=1
 	for (int i=0; i< LOGFILEMAX; i++ ) {
 		sprintf(fn,"/log-%d", gwayConfig.logFileNo - i);
 		if (!SPIFFS.exists(fn)) break;		// break the loop
 
 		// Open the file for reading
 		File f = SPIFFS.open(fn, "r");
-		
-		int j;
-		for (j=0; j<LOGFILEREC; j++) {
+
+		for (int j=0; j<LOGFILEREC; j++) {
 			
 			String s=f.readStringUntil('\n');
 			if (s.length() == 0) break;
@@ -473,9 +472,8 @@ void printLog()
 			Serial.println(s.substring(12));			// Skip the first 12 Gateway specific binary characters
 			yield();
 		}
-
 	}
-#endif //_DUSB
+#	endif //_DUSB
 #endif //_STAT_LOG
 } //printLog
 
@@ -680,7 +678,7 @@ int addSeen(struct nodeSeen *listSeen, struct stat_t stat)
 			listSeen[i].cntSeen++;					// Not included on function para
 			listSeen[i].idSeen = stat.node;
 			listSeen[i].chnSeen = stat.ch;
-			listSeen[i].sfSeen |= stat.sf;			// Or the argument
+			listSeen[i].sfSeen = stat.sf;			// Or the argument
 	
 			writeSeen(_SEENFILE, listSeen);
 

+ 1 - 4
ESP-sc-gway/_loraModem.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.
@@ -214,9 +214,6 @@ void setRate(uint8_t sf, uint8_t crc)
 	
 	// For sx1276 chips is the CRC ON is 
 	else {
-		uint8_t bw = 0;				// bw setting is in freqs[gwayConfig.ch].dwnBw
-		uint8_t cr = 0;				// cr settings dependent on SF setting
-		//switch (
 		
 		if (sf==SF8) {
 			mc1= 0x78;				// SX1276_MC1_BW_125==0x70 | SX1276_MC1_CR_4_8==0x08

+ 1 - 1
ESP-sc-gway/_oLED.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.

+ 1 - 1
ESP-sc-gway/_otaServer.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 //
 // All rights reserved. This program and the accompanying materials

+ 1 - 1
ESP-sc-gway/_repeater.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
+// Copyright (c) 2016-2020 Maarten Westenberg
 //
 // All rights reserved. This program and the accompanying materials
 // are made available under the terms of the MIT License

+ 17 - 11
ESP-sc-gway/_sensor.ino

@@ -1,5 +1,5 @@
 // sensor.ino; 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
+// Copyright (c) 2016-2020 Maarten Westenberg
 //
 // All rights reserved. This program and the accompanying materials
 // are made available under the terms of the MIT License
@@ -32,7 +32,7 @@ unsigned char DevAddr[4]  = _DEVADDR ;				// see configGway.h
 // Smartdelay is a function to delay processing but in the loop get info 
 // from the GPS device
 // ----------------------------------------------------------------------------
-static void smartDelay(uint32_t ms)                
+void smartDelay(uint32_t ms)                
 {
 	uint32_t start = millis();
 	do
@@ -70,7 +70,7 @@ static void smartDelay(uint32_t ms)
 //	id and a value, and the total message contains its length (less than 64 bytes)
 //	and a parity value in byte[0] bit 7.
 // ----------------------------------------------------------------------------
-static int LoRaSensors(uint8_t *buf) {
+int LoRaSensors(uint8_t *buf) {
 
 #	if defined(_LCODE)
 #		if defined(_RAW) 
@@ -121,7 +121,7 @@ static int LoRaSensors(uint8_t *buf) {
 #			endif // ARDUINO_ARCH_ESP8266 || ESP32
 #			if _MONITOR>=1
 			if ((debug>=1) && (pdebug & P_MAIN)){
-				response += "Battery lcode="+String(volts);
+				response += ", Battery V="+String(volts);
 			}
 #			endif //_MONITOR
 
@@ -228,7 +228,8 @@ static int LoRaSensors(uint8_t *buf) {
 // Since we do this ONLY for keys and X, Y we know that we need to XOR 16 bytes.
 //
 // ----------------------------------------------------------------------------
-static void mXor(uint8_t *buf, uint8_t *key) {
+void mXor(uint8_t *buf, uint8_t *key) 
+{
 	for (uint8_t i = 0; i < 16; ++i) buf[i] ^= key[i];
 }
 
@@ -240,7 +241,8 @@ static void mXor(uint8_t *buf, uint8_t *key) {
 //	- buf: An array of uint8_t bytes
 //	- len: Length of the array in bytes
 // ----------------------------------------------------------------------------
-static void shift_left(uint8_t * buf, uint8_t len) {
+void shift_left(uint8_t * buf, uint8_t len) 
+{
     while (len--) {
         uint8_t next = len ? buf[1] : 0;			// len 0 to 15
 
@@ -254,8 +256,9 @@ static void shift_left(uint8_t * buf, uint8_t len) {
 // ----------------------------------------------------------------------------
 // generate_subkey
 // RFC 4493, para 2.3
-// ----------------------------------------------------------------------------
-static void generate_subkey(uint8_t *key, uint8_t *k1, uint8_t *k2) {
+// -----------------------------------------------------------------------------
+void generate_subkey(uint8_t *key, uint8_t *k1, uint8_t *k2) 
+{
 
 	memset(k1, 0, 16);								// Fill subkey1 with 0x00
 	
@@ -309,7 +312,8 @@ static void generate_subkey(uint8_t *key, uint8_t *k1, uint8_t *k2) {
 // MIC is cmac [0:3] of ( aes128_cmac(NwkSKey, B0 | Data )
 //
 // ----------------------------------------------------------------------------
-uint8_t micPacket(uint8_t *data, uint8_t len, uint16_t FrameCount, uint8_t * NwkSKey, uint8_t dir) {
+uint8_t micPacket(uint8_t *data, uint8_t len, uint16_t FrameCount, uint8_t * NwkSKey, uint8_t dir)
+{
 
 
 	//uint8_t NwkSKey[16] = _NWKSKEY;
@@ -432,7 +436,8 @@ uint8_t micPacket(uint8_t *data, uint8_t len, uint16_t FrameCount, uint8_t * Nwk
 //	- key: Key to use for MIC. Normally this is the NwkSKey
 //
 // ----------------------------------------------------------------------------
-static void checkMic(uint8_t *buf, uint8_t len, uint8_t *key) {
+void checkMic(uint8_t *buf, uint8_t len, uint8_t *key)
+{
 	uint8_t cBuf[len+1];
 	uint8_t NwkSKey[16] = _NWKSKEY;
 
@@ -697,7 +702,8 @@ int sensorPacket() {
 //
 // cmac = aes128_encrypt(K, Block_A[i])
 // ----------------------------------------------------------------------------
-uint8_t encodePacket(uint8_t *Data, uint8_t DataLength, uint16_t FrameCount, uint8_t *DevAddr, uint8_t *AppSKey, uint8_t Direction) {
+uint8_t encodePacket(uint8_t *Data, uint8_t DataLength, uint16_t FrameCount, uint8_t *DevAddr, uint8_t *AppSKey, uint8_t Direction)
+{
 
 #if _DUSB>=1
 	if (( debug>=2 ) && ( pdebug & P_GUI )) {

+ 1 - 1
ESP-sc-gway/_stateMachine.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.

+ 1 - 1
ESP-sc-gway/_tcpTTN.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.

+ 10 - 22
ESP-sc-gway/_txRx.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.
@@ -93,7 +93,7 @@ int sendPacket(uint8_t *buf, uint8_t length)
 	bool ipol			= root["txpk"]["ipol"];
 	uint8_t powe		= root["txpk"]["powe"];			// power, e.g. 14 or 27
 	LoraDown.tmst		= (uint32_t) root["txpk"]["tmst"].as<unsigned long>();
-	const float ff		= root["txpk"]["freq"];			// eg 869.525
+	//const float ff		= root["txpk"]["freq"];			// eg 869.525
 	
 	// Not used in the protocol of Gateway TTN:
 	const char * datr	= root["txpk"]["datr"];			// eg "SF7BW125"
@@ -434,8 +434,6 @@ int buildPacket(uint32_t tmst, uint8_t *buff_up, struct LoraUp LoraUp, bool inte
     display.clear();
     display.setFont(ArialMT_Plain_16);
     display.setTextAlignment(TEXT_ALIGN_LEFT);
-
-//	msg_oLED(timBuff, prssi-rssicorr, SNR, message)
 	
     display.drawString(0, 0, "Time: " );
     display.drawString(40, 0, timBuff);
@@ -556,22 +554,16 @@ int buildPacket(uint32_t tmst, uint8_t *buff_up, struct LoraUp LoraUp, bool inte
             memcpy((void *)(buff_up + buff_index), (void *)",\"datr\":\"SF?", 12);
             buff_index += 12;
 	}
-	memcpy((void *)(buff_up + buff_index), (void *)"BW125\"", 6);
-	buff_index += 6;
-	memcpy((void *)(buff_up + buff_index), (void *)",\"codr\":\"4/5\"", 13);
-	buff_index += 13;
-	j = snprintf((char *)(buff_up + buff_index), TX_BUFF_SIZE-buff_index, ",\"lsnr\":%li", SNR);
-	buff_index += j;
-	j = snprintf((char *)(buff_up + buff_index), TX_BUFF_SIZE-buff_index, ",\"rssi\":%d,\"size\":%u", prssi-rssicorr, messageLength);
-	buff_index += j;
-	memcpy((void *)(buff_up + buff_index), (void *)",\"data\":\"", 9);
-	buff_index += 9;
+	memcpy((void *)(buff_up + buff_index), (void *)"BW125\"", 6); buff_index += 6;
+	memcpy((void *)(buff_up + buff_index), (void *)",\"codr\":\"4/5\"", 13); buff_index += 13;
+	buff_index += snprintf((char *)(buff_up + buff_index), TX_BUFF_SIZE-buff_index, ",\"lsnr\":%li", (long)SNR);
+	buff_index += snprintf((char *)(buff_up + buff_index), TX_BUFF_SIZE-buff_index, ",\"rssi\":%d,\"size\":%u", prssi-rssicorr, messageLength);
+	memcpy((void *)(buff_up + buff_index), (void *)",\"data\":\"", 9); buff_index += 9;
 
 	// Use gBase64 library to fill in the data string
 	encodedLen = base64_enc_len(messageLength);			// max 341
-	j = base64_encode((char *)(buff_up + buff_index), (char *) message, messageLength);
+	buff_index += base64_encode((char *)(buff_up + buff_index), (char *) message, messageLength);
 
-	buff_index += j;
 	buff_up[buff_index] = '"';
 	++buff_index;
 
@@ -630,19 +622,15 @@ int buildPacket(uint32_t tmst, uint8_t *buff_up, struct LoraUp LoraUp, bool inte
 int receivePacket()
 {
 	uint8_t buff_up[TX_BUFF_SIZE]; 						// buffer to compose the upstream packet to backend server
-	long SNR;
-	uint8_t message[128] = { 0x00 };					// MSG size is 128 bytes for rx
-	uint8_t messageLength = 0;
 	
 	// Regular message received, see SX1276 spec table 18
 	// Next statement could also be a "while" to combine several messages received
 	// in one UDP message as the Semtech Gateway spec does allow this.
-	// XXX Not yet supported
+	// XXX Bit ... Not yet supported
 
 		// Take the timestamp as soon as possible, to have accurate reception timestamp
 		// TODO: tmst can jump if micros() overflow.
 		uint32_t tmst = (uint32_t) micros();			// Only microseconds, rollover in 5X minutes
-		//lastTmst = tmst;								// Following/according to spec
 		
 		// Handle the physical data read from LoraUp
 		if (LoraUp.payLength > 0) {
@@ -706,7 +694,7 @@ int receivePacket()
 				DevAddr[1]= LoraUp.payLoad[3];
 				DevAddr[2]= LoraUp.payLoad[2];
 				DevAddr[3]= LoraUp.payLoad[1];
-				uint16_t frameCount=LoraUp.payLoad[7]*256 + LoraUp.payLoad[6];
+				//uint16_t frameCount=LoraUp.payLoad[7]*256 + LoraUp.payLoad[6];
 
 #if _DUSB>=1
 				if (( debug>=1 ) && ( pdebug & P_RX )) {

+ 5 - 20
ESP-sc-gway/_udpSemtech.ino

@@ -91,10 +91,7 @@ bool connectUdp()
 //
 // ----------------------------------------------------------------------------
 int readUdp(int packetSize)
-{
-	uint8_t protocol;
-	uint16_t token;
-	uint8_t ident; 
+{ 
 	uint8_t buff[32]; 						// General buffer to use for UDP, set to 64
 	uint8_t buff_down[RX_BUFF_SIZE];		// Buffer for downstream
 
@@ -147,9 +144,9 @@ int readUdp(int packetSize)
 	// If it is not NTP it must be a LoRa message for gateway or node
 	else {
 		uint8_t *data = (uint8_t *) ((uint8_t *)buff_down + 4);
-		protocol = buff_down[0];
-		token = buff_down[2]*256 + buff_down[1];
-		ident = buff_down[3];
+		//uint8_t protocol= buff_down[0];
+		//uint16_t token= buff_down[2]*256 + buff_down[1];
+		uint8_t ident= buff_down[3];
 
 #		if _MONITOR>=1
 		if ((debug>1) && (pdebug & P_MAIN)) {
@@ -167,15 +164,6 @@ int readUdp(int packetSize)
 #			if _MONITOR>=1
 			if (debug >=1) {
 				mPrint("PKT_PUSH_DATA:: size "+String(packetSize)+" From "+String(remoteIpNo.toString()));
-
-//				Serial.print(F(", port ")); Serial.print(remotePortNo);
-//				Serial.print(F(", data: "));
-//				for (int i=0; i<packetSize; i++) {
-//					Serial.print(buff_down[i],HEX);
-//					Serial.print(':');
-//				}
-//				Serial.println();
-//				if (debug>=2) Serial.flush();
 			}
 #			endif //_MONITOR
 		break;
@@ -478,8 +466,7 @@ void pullData() {
 void sendstat() {
 
     uint8_t status_report[STATUS_SIZE]; 					// status report as a JSON object
-    char stat_timestamp[32];								// XXX was 24
-    time_t t;
+    char stat_timestamp[32];								// 
 	char clat[10]={0};
 	char clon[10]={0};
 
@@ -505,8 +492,6 @@ void sendstat() {
 
     stat_index = 12;										// 12-byte header
 	
-    t = now();												// get timestamp for statistics
-	
 	// XXX Using CET as the current timezone. Change to your timezone	
 	sprintf(stat_timestamp, "%04d-%02d-%02d %02d:%02d:%02d CET", year(),month(),day(),hour(),minute(),second());
 	yield();

+ 4 - 3
ESP-sc-gway/_utils.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.
@@ -432,7 +432,7 @@ int SerialName(uint32_t a, String & response)
 
 		if (id == nodes[i].id) {
 #			if _MONITOR>=1
-			if ((debug>=2) && (pdebug & P_MAIN )) {
+			if ((debug>=3) && (pdebug & P_MAIN )) {
 				mPrint("SerialName:: i="+String(i)+", Name="+String(nodes[i].nm)+". for node=0x"+String(nodes[i].id,HEX));
 			}
 #			endif //_MONITOR
@@ -446,8 +446,9 @@ int SerialName(uint32_t a, String & response)
 	return(-1);									// If no success OR is TRUSTED NODES not defined
 } //SerialName
 
-
 #if _LOCALSERVER==1
+
+
 // ----------------------------------------------------------------------------
 // inDecodes(id)
 // Find the id in Decodes array, and return the index of the item

+ 6 - 11
ESP-sc-gway/_wwwServer.ino

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by many people and making use of several libraries.
 //
@@ -107,7 +107,8 @@ boolean YesNo()
 // Returns:
 //		<none>
 // --------------------------------------------------------------------------------
-void wwwFile(String fn) {
+void wwwFile(String fn)
+{
 
 #if _STAT_LOG == 1
 
@@ -128,9 +129,8 @@ void wwwFile(String fn) {
 	File f = SPIFFS.open(fn, "r");					// Open the file for reading
 	
 	// MMM Change LOGFILEREC to file available
-	int j;
 	while (f.available()) {
-//	for (j=0; j<LOGFILEREC; j++) {
+//	for (int j=0; j<LOGFILEREC; j++) {
 			
 		String s=f.readStringUntil('\n');
 		if (s.length() == 0) {
@@ -185,16 +185,12 @@ void buttonDocu()
 void buttonLog() 
 {
 #if _STAT_LOG == 1	
-//	String response = "";
-	String fn = "";
-	int i = 0;
 	
 	for (int i=0; i< LOGFILEMAX; i++ ) {
-		fn = "/log-" + String(gwayConfig.logFileNo - i);
+		String fn = "/log-" + String(gwayConfig.logFileNo - i);
 		wwwFile(fn);									// Display the file contents in the browser
 	}
 	
-//	server.sendContent(response);
 #endif //_STAT_LOG
 }
 
@@ -296,7 +292,6 @@ static void setVariables(const char *cmd, const char *arg) {
 	// SF; Handle Spreading Factor Settings
 	//
 	if (strcmp(cmd, "SF")==0) {
-		uint8_t sfi = sf;
 		if (atoi(arg) == 1) {
 			if (sf>=SF12) sf=SF7; else sf= (sf_t)((int)sf+1);
 		}	
@@ -1055,7 +1050,7 @@ static void nodeHistory()
 // If less then nothing will be displayed.
 // XXX We have to make the function such that when printed, the webpage refreshes.
 // --------------------------------------------------------------------------------
-int monitorData() 
+void monitorData() 
 {
 #	if _MONITOR>=1
 	if (gwayConfig.monitor) {

+ 1 - 1
ESP-sc-gway/configGway.h

@@ -3,7 +3,7 @@
 
 // Specify the correct version and date of your gateway here.
 // Normally it is provided with the GitHub version
-#define VERSION "V.6.2.0.E.EU868; 200129b"
+#define VERSION "V.6.2.0.E.EU868; 200129c"
 //
 // Based on work done by Thomas Telkamp for Raspberry PI 1ch gateway and many others.
 // Contibutions of Dorijan Morelj and Andreas Spies for OLED support.

+ 2 - 2
ESP-sc-gway/loraFiles.h

@@ -113,13 +113,13 @@ struct espGwayConfig {
 #define nSF12	0x40
 #define nFSK	0x80
 
-// define the Seen functon as when we have seen seen last time nodes last time
+// define the Seen functon as when we have seen seen nodes last time
 struct nodeSeen {
 	time_t timSeen;
 	uint32_t idSeen;
 	uint32_t cntSeen;
 	uint8_t chnSeen;
-	uint8_t sfSeen;
+	uint8_t sfSeen;				// Encode the SF seen.This might differ per message!
 };
 struct nodeSeen listSeen[_MAXSEEN];
 

+ 1 - 1
ESP-sc-gway/loraModem.h

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many other contributors.

+ 1 - 1
ESP-sc-gway/oLED.h

@@ -1,5 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
-// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
+// Copyright (c) 2016-2020 Maarten Westenberg version for ESP8266
 //
 // based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 // and many others.