Browse Source

Version 6.1.8; repair wifimanager for ESP8266

platenspeler 5 years ago
parent
commit
903bb9c8dd

+ 10 - 1
CHANGELOG.md

@@ -1,6 +1,6 @@
 # Single Channel LoRaWAN Gateway
 
-Version 6.1.5, December 20, 2019	  
+Version 6.1.8, December 28, 2019	  
 Author: M. Westenberg (mw12554@hotmail.com)  
 Copyright: M. Westenberg (mw12554@hotmail.com)  
 
@@ -16,6 +16,15 @@ Maintained by Maarten Westenberg (mw12554@hotmail.com)
 
 # Release Notes
 
+Features release 6.1.8 (December 28, 2019)
+- Repair wifimanager from ESP8266
+
+
+Features release 6.1.7 (December 27, 2019)
+- Repair bugs for DNS
+- Enable internal T-Beam sensors to output values in "raw" format. 
+See configNode.h and _sensors.ino
+
 Features release 6.1.5 (December 20, 2019)
 - Bug fix for "#define _DUSB 0"
 - Added number of times a node has been called to the history records listSeen

+ 23 - 26
ESP-sc-gway/ESP-sc-gway.ino

@@ -1,7 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
-// Version 6.1.5
-// Date: 2019-12-20
 // Author: Maarten Westenberg (mw12554@hotmail.com)
 //
 // Based on work done by Thomas Telkamp for Raspberry PI 1-ch gateway and many others.
@@ -263,12 +261,12 @@ void die(String s)
 {
 #	if _MONITOR>=1
 	mPrint(s);
-#	endif
+#	endif //_MONITOR
 
 #	if _DUSB>=1
 	Serial.println(s);
 	if (debug>=2) Serial.flush();
-#	endif //_DUSB _MONITOR
+#	endif //_DUSB
 
 	delay(50);
 	// system_restart();									// SDK function
@@ -455,7 +453,7 @@ void setup() {
 
 #if _GPS==1
 	// Pins are define in LoRaModem.h together with other pins
-	sGps.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);// PIN 12-TX 15-RX
+	sGps.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);			// PIN 12-TX 15-RX
 #endif //_GPS
 
 #ifdef ESP32
@@ -470,10 +468,10 @@ void setup() {
 #	endif //_MONITOR
 #endif //ARDUINO_ARCH_ESP32
 
-
 #	if _DUSB>=1
 		Serial.flush();
 #	endif //_DUSB
+
 	delay(500);
 
 	if (SPIFFS.begin()) {
@@ -555,7 +553,7 @@ void setup() {
 #endif	//ESP32_ARCH
 
 #	if _DUSB>=1
-		Serial.print(F("Host "));
+		Serial.print(F("Host="));
 #if ESP32_ARCH==1
 		Serial.print(WiFi.getHostname());
 #else
@@ -853,7 +851,7 @@ void loop ()
 			// Packet may be PKT_PUSH_ACK (0x01), PKT_PULL_ACK (0x03) or PKT_PULL_RESP (0x04)
 			// This command is found in byte 4 (buffer[3])
 			if (readUdp(packetSize) <= 0) {
-				#if _MONITOR>=1
+#				if _MONITOR>=1
 				if ( debug>=0 )
 					mPrint("readUdp ERROR, retuning <=0");
 #				endif //_MONITOR
@@ -884,7 +882,7 @@ void loop ()
 		// The Gateway node emessage has nothing to do with the STAT_INTERVAL
 		// message but we schedule it in the same frequency.
 		//
-#if GATEWAYNODE==1
+#		if GATEWAYNODE==1
 		if (gwayConfig.isNode) {
 			// Give way to internal some Admin if necessary
 			yield();
@@ -893,14 +891,14 @@ void loop ()
 			// could be battery but also other status info or sensor info
 		
 			if (sensorPacket() < 0) {
-#			if _MONITOR>=1
+#				if _MONITOR>=1
 				if ((debug>=1) || (pdebug & P_MAIN)) {
 					mPrint("sensorPacket: Error");
 				}
-#			endif// _MONITOR
+#				endif// _MONITOR
 			}
 		}
-#endif//GATEWAYNODE
+#		endif//GATEWAYNODE
 		statTime = nowSeconds;
     }
 	
@@ -926,19 +924,18 @@ void loop ()
 	// If we do our own NTP handling (advisable)
 	// We do not use the timer interrupt but use the timing
 	// of the loop() itself which is better for SPI
-#if NTP_INTR==0
-	// Set the time in a manual way. Do not use setSyncProvider
-	// as this function may collide with SPI and other interrupts
-	yield();												// 26/12/2017
-	nowSeconds = now();
-	if (nowSeconds - ntptimer >= _NTP_INTERVAL) {
-		yield();
-		time_t newTime;
-		newTime = (time_t)getNtpTime();
-		if (newTime != 0) setTime(newTime);
-		ntptimer = nowSeconds;
-	}
-#endif//NTP_INTR
-	
+#	if NTP_INTR==0
+		// Set the time in a manual way. Do not use setSyncProvider
+		// as this function may collide with SPI and other interrupts
+		yield();												// 26/12/2017
+		nowSeconds = now();
+		if (nowSeconds - ntptimer >= _NTP_INTERVAL) {
+			yield();
+			time_t newTime;
+			newTime = (time_t)getNtpTime();
+			if (newTime != 0) setTime(newTime);
+			ntptimer = nowSeconds;
+		}
+#	endif//NTP_INTR
 
 }//loop

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

@@ -1,7 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
-// Version 6.1.5
-// Date: 2019-12-20
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.
@@ -172,7 +170,7 @@ int WlanWriteWpa( char* ssid, char *pass) {
 
 #	if _MONITOR>=1
 	if (( debug >=0 ) && ( pdebug & P_MAIN )) {
-		mPrint("WlanWriteWpa:: ssid="+mPrint(ssid)+", pass="+mPrint(pass)); 
+		mPrint("WlanWriteWpa:: ssid="+String(ssid)+", pass="+String(pass)); 
 	}
 #	endif //_MONITOR
 	// Version 3.3 use of config file
@@ -329,8 +327,8 @@ int WlanConnect(int maxTry) {
 #if _WIFIMANAGER==1
 #		if _MONITOR>=1
 		if (debug>=1) {
-			mPrint("Starting Access Point Mode"));
-			mPrint("Connect Wifi to accesspoint: "+mPrint(AP_NAME)+" and connect to IP: 192.168.4.1");
+			mPrint("Starting Access Point Mode");
+			mPrint("Connect Wifi to accesspoint: "+String(AP_NAME)+" and connect to IP: 192.168.4.1");
 		}
 #		endif //_MONITOR
 		wifiManager.autoConnect(AP_NAME, AP_PASSWD );

+ 0 - 2
ESP-sc-gway/_gatewayMgt.ino

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

+ 2 - 4
ESP-sc-gway/_loraFiles.ino

@@ -1,7 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
-// Version 6.1.5		
-// Date: 2019-12-20	
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many others.
@@ -494,7 +492,7 @@ void printLog()
 } //printLog
 
 
-#if _SEENMAX>=1
+#if _SEENMAX >= 1
 
 
 // ----------------------------------------------------------------------------
@@ -700,4 +698,4 @@ void listDir(char * dir)
 
 
 
-#endif //_SEENMAX>0 End of File
+#endif //_SEENMAX>=1 End of File

+ 0 - 2
ESP-sc-gway/_loraModem.ino

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

+ 0 - 2
ESP-sc-gway/_oLED.ino

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

+ 0 - 2
ESP-sc-gway/_otaServer.ino

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

+ 0 - 2
ESP-sc-gway/_repeater.ino

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

+ 128 - 68
ESP-sc-gway/_sensor.ino

@@ -1,7 +1,5 @@
 // sensor.ino; 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
-// Verison 6.1.5
-// Date: 2019-12-20
 //
 // All rights reserved. This program and the accompanying materials
 // are made available under the terms of the MIT License
@@ -71,48 +69,126 @@ static void smartDelay(unsigned long ms)
 //	and a parity value in byte[0] bit 7.
 // ----------------------------------------------------------------------------
 static int LoRaSensors(uint8_t *buf) {
-	
-	uint8_t tchars = 1;
-	buf[0] = 0x86;									// 134; User code <lCode + len==3 + Parity
-
-#	if _MONITOR>=1
-	if (debug>=0) {
-		mPrint("LoRaSensors:: ");
-	}
-#	endif //_MONITOR
 
-#if _BATTERY==1
-#	if _MONITOR>=1
-	if (debug>=0) {
-		mPrint("Battery ");
-	}
-#	endif //_MONITOR
-
-#if defined(ARDUINO_ARCH_ESP8266) || defined(ESP32)
-	// For ESP there is no standard battery library
-	// What we do is to measure GPIO35 pin which has a 100K voltage divider
-	pinMode(35, INPUT);
-#if defined(ESP32)
-	int devider=4095;
-#else
-	int devider=1023;
-#endif //ESP32
-	float volts=3.3 * analogRead(35) / 4095 * 2;	// T_Beam connects to GPIO35
-#else
-	// For ESP8266 no sensor defined
-	float volts=0;
-#endif
-	tchars += lcode.eBattery(volts, buf + tchars);
-#endif
+#	if defined(_LCODE)
+#		if defined(_RAW) 
+#		error "Only define ONE encoding in configNode.h, _LOCDE or _RAW"
+#		endif
 
-#if _GPS==1
-#	if _MONITOR>=1
-	if (debug>=1)
-		mPrint("GPS sensor");
-#	endif //_MONITOR
+		uint8_t tchars = 1;
+		buf[0] = 0x86;				// 134; User code <lCode + len==3 + Parity
+		
+#		if _MONITOR>=1
+		if (debug>=0) {
+			mPrint("LoRaSensors:: ");
+		}
+#		endif //_MONITOR
 
-#	if _DUSB>=1
+#		if _BATTERY==1
+#			if defined(ARDUINO_ARCH_ESP8266) || defined(ESP32)
+				// For ESP there is no standard battery library
+				// What we do is to measure GPIO35 pin which has a 100K voltage divider
+				pinMode(35, INPUT);
+				float volts=3.3 * analogRead(35) / 4095 * 2;	// T_Beam connects to GPIO35
+#			else
+				// For ESP8266 no sensor defined
+				float volts=0;
+#			endif // ARDUINO_ARCH_ESP8266 || ESP32
+#			if _MONITOR>=1
+			if ((debug>=1) && ( pdebug & P_MAIN )){
+				mPrint("Battery lcode="+String(volts));
+			}
+#			endif //_MONITOR
+
+			tchars += lcode.eBattery(volts, buf + tchars);
+#		endif //_BATTERY
+
+		// GPS sensor is the second server we check for
+#		if _GPS==1
+			smartDelay(1000);\
+			if (millis() > 5000 && gps.charsProcessed() < 10) {
+#				if _MONITOR>=1
+					mPrint("No GPS data received: check wiring");
+#				endif //_MONITOR
+				return(0);
+			}
+			// Assuming we have a value, put it in the buf
+			// The layout of this message is specific to the user,
+			// so adapt as needed.
+
+			// Use lcode to code messages to server
+#			if _MONITOR>=1
+			if ((debug>=1) && ( pdebug & P_MAIN )){
+				mPrint("gps lcode:: lat="+String(gps.location.lat())+", lng="+String(gps.location.lng())+", alt="+String(gps.altitude.feet()/3.2808)+", sats="+String(gps.satellites.value()) );
+			}
+#			endif //_MONITOR
+			tchars += lcode.eGpsL(gps.location.lat(), gps.location.lng(), gps.altitude.value(), gps.satellites.value(), buf + tchars);
+#		endif //_GPS
+		// If all sensor data is encoded, we encode the buffer
+		lcode.eMsg(buf, tchars);								// Fill byte 0 with bytecount and Parity
+
+
+// Second encoding option is RAW format. 
+// We do not use the lcode format but write all teh values to the output
+// buffer and we need to get them in sequence out off the buffer.
+#	elif defined(_RAW)
+		uint8_t tchars = 0;
+
+#		if _BATTERY==1
+#			if defined(ARDUINO_ARCH_ESP8266) || defined(ESP32)
+				// For ESP there is no standard battery library
+				// What we do is to measure GPIO35 pin which has a 100K voltage divider
+				pinMode(35, INPUT);
+				float volts=3.3 * analogRead(35) / 4095 * 2;	// T_Beam connects to GPIO35
+#			else
+				// For ESP8266 no sensor defined
+				float volts=0;
+#			endif // ARDUINO_ARCH_ESP8266 || ESP32
+			memcpy((buf+tchars), &volts, sizeof(float)); tchars += sizeof(float);
+			
+#			if _MONITOR>=1
+			if ((debug>=1) && ( pdebug & P_MAIN )){
+				mPrint("Battery raw="+String(volts));
+			}
+#			endif //_MONITOR
+#		endif //_BATTERY
+
+		// GPS sensor is the second server we check for
+#		if _GPS==1
+			smartDelay(1000);
+			if (millis() > 5000 && gps.charsProcessed() < 10) {
+#				if _MONITOR>=1
+					mPrint("No GPS data received: check wiring");
+#				endif //_MONITOR
+				return(0);
+			}
+			// Raw coding of LoRa messages to server so add the GPS data raw to the string
+#			if _MONITOR>=1
+			if ((debug>=1) && ( pdebug & P_MAIN )){
+				mPrint("Gps raw:: lat="+String(gps.location.lat())+", lng="+String(gps.location.lng())+", alt="+String(gps.altitude.feet()/3.2808)+", sats="+String(gps.satellites.value()) );
+				//mPrint("Gps raw:: sizeof double="+String(sizeof(double)) );
+			}
+#			endif // _MONITOR
+			// Length of lat and lng is double
+			double lat = gps.location.lat();
+			double lng = gps.location.lng();
+			double alt = gps.altitude.feet() / 3.2808;
+			memcpy((buf+tchars), &lat, sizeof(double)); tchars += sizeof(double);
+			memcpy((buf+tchars), &lng, sizeof(double)); tchars += sizeof(double);
+			memcpy((buf+tchars), &alt, sizeof(double)); tchars += sizeof(double);
+#		endif //_GPS
+
+
+// If neither _LCODE or _RAW is defined this is an error
+#	else
+#		error "Please define an encoding format as in configNode.h"
+#	endif
+
+
+// GENERAL part
+#	if _DUSB>=1 && _GPS==1
 	if (( debug>=2 ) && ( pdebug & P_MAIN )) {
+		Serial.print("GPS sensor");
 		Serial.print("\tLatitude  : ");
 		Serial.println(gps.location.lat(), 5);
 		Serial.print("\tLongitude : ");
@@ -129,30 +205,12 @@ static int LoRaSensors(uint8_t *buf) {
 		Serial.print(":");
 		Serial.println(gps.time.second());
 	}
-#	endif //_DUSB
+#	endif //_DUSB _GPS
 
-	smartDelay(1000);
-	
-	if (millis() > 5000 && gps.charsProcessed() < 10) {
-#		if _MONITOR>=1
-			mPrint("No GPS data received: check wiring");
-#		endif //_MONITOR
-		return(0);
-	}
-	
-	// Assuming we have a value, put it in the buf
-	// The layout of this message is specific to the user,
-	// so adapt as needed.
-	tchars += lcode.eGpsL(gps.location.lat(), gps.location.lng(), gps.altitude.value(),
-                       gps.satellites.value(), buf + tchars);
+	return(tchars);	// return the number of bytes added to payload
+}	
 
-#endif
 
-	// If all sensor data is encoded, we encode the buffer	
-	lcode.eMsg(buf, tchars);								// Fill byte 0 with bytecount and Parity
-	
-	return(tchars);	// return the number of bytes added to payload
-}
 
 
 // ----------------------------------------------------------------------------
@@ -479,7 +537,7 @@ int sensorPacket() {
 		}
 		Serial.println();
 	}
-#endif	
+#endif	//_DUSB
 	
 	// we have to include the AES functions at this stage in order to generate LoRa Payload.
 	uint8_t CodeLength = encodePacket((uint8_t *)(LUP.payLoad + LUP.payLength), PayLength, (uint16_t)frameCount, DevAddr, AppSKey, 0);
@@ -493,7 +551,7 @@ int sensorPacket() {
 		}
 		Serial.println();
 	}
-#endif
+#endif //_DUSB
 
 	LUP.payLength += CodeLength;								// length inclusive sensor data
 	
@@ -514,7 +572,7 @@ int sensorPacket() {
 		}
 		Serial.println();
 	}
-#endif
+#endif //_DUSB
 
 	// So now our package is ready, and we can send it up through the gateway interface
 	// Note: Be aware that the sensor message (which is bytes) in message will be
@@ -547,12 +605,13 @@ int sensorPacket() {
 	if (!sendUdp(ttnServer, _TTNPORT, buff_up, buff_index)) {
 		return(-1);
 	}
-#endif
+#endif //_TTNSERVER
+
 #ifdef _THINGSERVER
 	if (!sendUdp(thingServer, _THINGPORT, buff_up, buff_index)) {
 		return(-1);
 	}
-#endif
+#endif //_THINGSERVER
 
 #if _DUSB>=1
 	// If all is right, we should after decoding (which is the same as encoding) get
@@ -571,7 +630,7 @@ int sensorPacket() {
 		}
 		Serial.println();
 	}
-#endif
+#endif // _DUSB
 
 	if (_cad) {
 		// Set the state to CAD scanning after sending a packet
@@ -590,6 +649,7 @@ int sensorPacket() {
 
 #endif //GATEWAYNODE==1
 
+
 #if (GATEWAYNODE==1) || (_LOCALSERVER==1)
 // ----------------------------------------------------------------------------
 // ENCODEPACKET
@@ -625,7 +685,7 @@ uint8_t encodePacket(uint8_t *Data, uint8_t DataLength, uint16_t FrameCount, uin
 		for (int i=0; i<16; i++ ) { Serial.print(AppSKey[i],HEX); Serial.print(' '); }
 		Serial.println();
 	}
-#endif
+#endif // _DUSB
 
 	//unsigned char AppSKey[16] = _APPSKEY ;	// see configGway.h
 	uint8_t i, j;

+ 0 - 2
ESP-sc-gway/_stateMachine.ino

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

+ 0 - 2
ESP-sc-gway/_tcpTTN.ino

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

+ 0 - 2
ESP-sc-gway/_txRx.ino

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

+ 0 - 2
ESP-sc-gway/_udpSemtech.ino

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

+ 0 - 2
ESP-sc-gway/_utils.ino

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

+ 9 - 10
ESP-sc-gway/_wwwServer.ino

@@ -1,7 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
-// Version 6.1.5
-// Date: 2019-12-20
 //
 // 	based on work done by many people and making use of several libraries.
 //
@@ -127,9 +125,9 @@ void wwwFile(String fn) {
 #		endif
 		return;
 	} // _MONITOR
-#	if _MONITOR>=2
-	else {
-		mPrint("wwwFile:: SPIFFS File existist= " + String(fn));
+#	if _MONITOR>=1
+	else if (debug>=2) {
+		mPrint("wwwFile:: SPIFFS Filesystem existist= " + String(fn));
 	}
 #	endif //_MONITOR
 
@@ -215,8 +213,8 @@ static void wwwButtons()
 {
 	String response = "";
 	String mode = (gwayConfig.expert ? "Basic Mode" : "Expert Mode");
-	String moni = (gwayConfig.monitor ? "Hide Monitor" : "Show Monitor");
-	String seen = (gwayConfig.seen ? "Hide Last Seen" : "Show Last Seen");
+	String moni = (gwayConfig.monitor ? "Hide Monitor" : "Monitor ON");
+	String seen = (gwayConfig.seen ? "Seen OFF" : "Node last seen");
 
 	YesNo();												// Init the Yes/No function
 	buttonDocu();
@@ -228,8 +226,9 @@ static void wwwButtons()
 #	if _MONITOR>=1
 	response += "<a href=\"MONITOR\" download><button type=\"button\">" +moni+ "</button></a>";
 #	endif
+#	if _SEENMAX>=1
 	response += "<a href=\"SEEN\" download><button type=\"button\">" +seen+ "</button></a>";
-
+#	endif
 	server.sendContent(response);							// Send to the screen
 }
 
@@ -534,8 +533,8 @@ static void gatewaySettings()
 	response +="</tr>";
 #endif
 
-	// Debugging options, only when _DUSB is set, otherwise no
-	// serial activity
+	// Debugging options, only when _DUSB of _MONITOR is set, otherwise no
+	// serial or minotoring activity
 #if _DUSB>=1 || _MONITOR>=1
 	response +="<tr><td class=\"cell\">Debug Level</td><td class=\"cell\" colspan=\"2\">"; 
 	response +=debug; 

+ 1 - 7
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.1.7.E.EU868; 191228a"
+#define VERSION "V.6.1.8.E.EU868; 191229a"
 
 //
 // Based on work done by Thomas Telkamp for Raspberry PI 1ch gateway and many others.
@@ -163,12 +163,6 @@
 #define _WIFIMANAGER 0
 
 
-// Define the name of the accesspoint if the gateway is in accesspoint mode (is
-// getting WiFi SSID and password using WiFiManager)
-#define AP_NAME "ESP8266-Gway-Things4U"
-#define AP_PASSWD "ttnAutoPw"
-
-
 // This section defines whether we use the gateway as a repeater
 // For his, we use another output channel as the channel (default==0) we are 
 // receiving the messages on.

+ 32 - 23
ESP-sc-gway/configNode.h

@@ -39,31 +39,9 @@
 #define _GPS 1
 #define _BATTERY 1
 
-#endif
-
-// Wifi definitions
-// WPA is an array with SSID and password records. Set WPA size to number of entries in array
-// When using the WiFiManager, we will overwrite the first entry with the 
-// accesspoint we last connected to with WifiManager
-// NOTE: Structure needs at least one (empty) entry.
-//		So WPASIZE must be >= 1
-struct wpas {
-	char login[32];							// Maximum Buffer Size (and allocated memory)
-	char passw[64];
-};
+#endif //GATEWAYNODE
 
 
-// Please fill in at least ONE SSID and password from your own WiFI network
-// below. This is needed to get the gateway working
-// Note: DO NOT use the first and the last line of the stucture, these should be empty strings and
-//	the first line in te struct is reserved for WifiManager.
-//
-wpas wpa[] = {
-	{ "" , "" },							// Reserved for WiFi Manager
-	{ "yourSSID", "yourPassword" },
-	{ "Your2SSID", "your2Password" }
-};
-
 #if _TRUSTED_NODES >= 1
 struct nodex {
 	uint32_t id;				// This is the LoRa ID (coded in 4 bytes uint32_t
@@ -127,6 +105,37 @@ codex decodes[] = {
 // #define _THINGPORT 1700						// Port 1700 is old compatibility
 
 
+// Wifi definitions
+// WPA is an array with SSID and password records. Set WPA size to number of entries in array
+// When using the WiFiManager, we will overwrite the first entry with the 
+// accesspoint we last connected to with WifiManager
+// NOTE: Structure needs at least one (empty) entry.
+//		So WPASIZE must be >= 1
+struct wpas {
+	char login[32];							// Maximum Buffer Size (and allocated memory)
+	char passw[64];
+};
+
+
+// Please fill in at least ONE SSID and password from your own WiFI network
+// below. This is needed to get the gateway working
+// Note: DO NOT use the first and the last line of the stucture, these should be empty strings and
+//	the first line in te struct is reserved for WifiManager.
+//
+wpas wpa[] = {
+	{ "" , "" },							// Reserved for WiFi Manager
+	{ "yourSSID", "yourPassword" },
+	{ "Your2SSID", "your2Password" }
+};
+
+
+// Define the name of the accesspoint if the gateway is in accesspoint mode (is
+// getting WiFi SSID and password using WiFiManager)
+#define AP_NAME "ESP8266-Gway-Things4U"
+#define AP_PASSWD "ttnAutoPw"
+
+
+
 // For asserting and testing the following defines are used.
 //
 #if !defined(CFG_noassert)

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

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

+ 7 - 8
ESP-sc-gway/loraModem.h

@@ -1,7 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
-// Version 6.1.5
-// Date: 2019-12-20
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 //	and many other contributors.
@@ -225,6 +223,7 @@ struct pins {
 // MISO == GPIO19/ PIN19
 // MOSI == GPIO27/ PIN27
 // RST  == GPIO14/ PIN14
+// This Pinning is not used and is under construction
 struct pins {
 	uint8_t dio0=26;		// GPIO26 / Dio0 used for one frequency and one SF
 	uint8_t dio1=26;		// GPIO26 / Used for CAD, may or not be shared with DIO0
@@ -237,17 +236,17 @@ struct pins {
 #elif _PIN_OUT==4
 // ----------------------------------------------------------------------------
 // For ESP32/TTGO based board.
-// SCK  == GPIO5/ PIN5
-// SS   == GPIO18/PIN18 CS
+// SCK  == GPIO5/  PIN5
+// SS   == GPIO18/ PIN18 CS
 // MISO == GPIO19/ PIN19
 // MOSI == GPIO27/ PIN27
 // RST  == GPIO14/ PIN14
 struct pins {
 	uint8_t dio0=26;		// GPIO26 / Dio0 used for one frequency and one SF
-	uint8_t dio1=33;		// GPIO26 / Used for CAD, may or not be shared with DIO0
-	uint8_t dio2=32;		// GPIO26 / Used for frequency hopping, don't care
-	uint8_t ss=18;			// GPIO18 / Dx. Select pin connected to GPIO18
-	uint8_t rst=14;			// GPIO0  / D3. Reset pin not used	
+	uint8_t dio1=33;		// GPIO33 / Used for CAD, may or not be shared with DIO0
+	uint8_t dio2=32;		// GPIO32 / Used for frequency hopping, don't care
+	uint8_t ss=18;			// GPIO18 / CS. Select pin connected to GPIO18
+	uint8_t rst=14;			// GPIO14 / D3. Reset pin not used	
 } pins;
 #define SCK 5
 #define MISO 19

+ 3 - 5
ESP-sc-gway/oLED.h

@@ -1,7 +1,5 @@
 // 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
-// Version 6.1.5
-// Date: 2019-12-20
 //
 // based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
 // and many others.
@@ -47,9 +45,9 @@
 #define OLED_SDA 4								// GPIO4 / 
 #define OLED_RST 16								// Reset pin (Some OLED displays do not have it)
 
-#elif _PIN_OUT==5								// TTGO (onboard version used, also for DIY)
-#define OLED_SCL 15								// GPIO15 / 
-#define OLED_SDA 4								// GPIO4 / 
+#elif _PIN_OUT==5								// TTGO with external OLED
+#define OLED_SCL 22								// GPIO22 / SCL
+#define OLED_SDA 21								// GPIO21 / SDA
 #define OLED_RST 16								// Reset pin (Some OLED displays do not have it)
 
 #endif

+ 5 - 3
README.md

@@ -1,7 +1,7 @@
 # Single Channel LoRaWAN Gateway
 
-Version 6.1.5, 
-Data: December 20, 2019  
+Version 6.1.7, 
+Data: December 28, 2019  
 Author: M. Westenberg (mw12554@hotmail.com)  
 Copyright: M. Westenberg (mw12554@hotmail.com)  
 
@@ -90,7 +90,7 @@ compiler.
 Goto <Sketch><Include Library><Manage Libraries...> in the IDE to do so. Most of the include files 
 can be loaded through this library section. Some cannot and are shipped with the Gateway.
 
-- WifiManager (Version 0.12.0 by Tzapu)
+
 - LoRaCode (Version 1.0.0, see library shipped)
 - gBase64 (changed name from Adam Rudd's Base64 version)
 - TinyGPS++ (Version 1.0.0)
@@ -111,6 +111,8 @@ Through Library Manager:
 - WifiEsp (Version 2.2.2)
 - Wire (Version 1.0.1)
 
+- WifiManager (Version 0.12.0 by Tzapu) for ESP8266 
+
 8. Compile the code and download the executable over USB to the gateway. If all is right, you should
 see the gateway starting up on the Serial Monitor.
 9. Note the IP address that the device receives from your router. Use that IP address in a browser on 

+ 3 - 3
TODO.md

@@ -1,6 +1,6 @@
 # Single Channel LoRaWAN Gateway
 
-Last Updated: November 29, 2019	  
+Last Updated: December 29, 2019	  
 Author: M. Westenberg (mw12554@hotmail.com)  
 Copyright: M. Westenberg (mw12554@hotmail.com)  
 
@@ -16,11 +16,11 @@ Maintained by Maarten Westenberg (mw12554@hotmail.com)
 
 # ToDo Functions
 
-Features not in release 6.1.5
+Features not in release 6.1.8
 
 
 - Frequency: Support for eu433 frequencies
-- Testing and timing of downlink functions (I need a quiet area)
+- Testing and timing of downlink functions (need quiet area)
 - Get HOP frequency functions to work on three frequencies
 - Security: Enable passwords for GUI access and WiFi upload (may not be necessary for normal home router use)
 - Enable remote updating through GUI