瀏覽代碼

Version 1.0, extra config changes and 1 bug solved.

platenspeler 5 年之前
父節點
當前提交
3035c68bdc

+ 2 - 1
CHANGELOG.md

@@ -17,7 +17,8 @@ Maintained by Maarten Westenberg (mw12554@hotmail.com)
 # Release Notes
 
 Make ready for Publishing (October 20, 2019)
--Edit all files and make ready for publising to Github
+- Edit all files and make ready for publising to Github
+- Change the country/region setting of the Gateway (As a result you probably have to update most of the package).
 
 New features in version 5.3.4 (March 25, 2019)
 - Make use of the latest Arduino IDE available version 1.8.21

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

@@ -213,8 +213,6 @@
 //
 // Default for testing: Switched off
 #define _THINGSERVER "westenberg.org"		// Server URL of the LoRa-udp.js handler
-//#define _THINGPORT 57084					// dash.westenberg.org:8057
-//#define _THINGSERVER "capgemini.thethings.industries"		// Server URL of the LoRa-udp.js handler
 #define _THINGPORT 1700						// Port 1700 is old compatibility
 
 

+ 11 - 3
ESP-sc-gway/ESP-sc-gway.ino

@@ -26,6 +26,8 @@
 //
 // ----------------------------------------------------------------------------------------
 
+// The followion file contains most of the definitions
+// used in other files. It should be the first file.
 #include "ESP-sc-gway.h"									// This file contains configuration of GWay
 
 #if defined (ARDUINO_ARCH_ESP32) || defined(ESP32)
@@ -217,7 +219,9 @@ void setupWWW();											// _wwwServer.ino forward
 static void printIP(IPAddress ipa, const char sep, String& response);	// _wwwServer.ino
 
 void SerialTime();											// _utils.ino forward
-
+void SerialStat(uint8_t intr);								// _utils.ino
+void printHexDigit(uint8_t digit);							// XXX utils.ino
+int inDecodes(char * id);									// XXX
 
 void init_oLED();											// oLED.ino
 void acti_oLED();
@@ -232,7 +236,11 @@ void cadScanner();											// _loraModem.ino
 
 void stateMachine();										// _stateMachine.ino
 
-void SerialStat(uint8_t intr);								// _utils.ino
+bool connectUdp();											// _udpSemtech.ino
+int readUdp(int packetSize);								// XXX
+int sendUdp(IPAddress server, int port, uint8_t *msg, int length);
+void sendstat();											// XXX
+void pullData();											// XXX
 
 #if MUTEX==1
 // Forward declarations
@@ -242,7 +250,7 @@ void ICACHE_FLASH_ATTR ReleaseMutex(int *mutex);
 #endif
 
 // ----------------------------------------------------------------------------
-// DIE is not use actively in the source code anymore.
+// DIE is not used actively in the source code anymore.
 // It is replaced by a Serial.print command so we know that we have a problem
 // somewhere.
 // There are at least 3 other ways to restart the ESP. Pick one if you want.

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

@@ -725,7 +725,9 @@ int receivePacket()
 					}
 					Serial.println();
 				}
+#endif //DUSB
 			}
+#if DUSB>=1
 			else if (( debug>=2 ) && ( pdebug & P_RX )) {
 					Serial.println(F("receivePacket:: No Index"));
 			}

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

@@ -28,11 +28,11 @@
 #error "Please make sure that either _UDPROUTER or _TTNROUTER are defined but not both"
 #endif
 
-// The following functions ae defined in this modue:
+// The following functions ae defined in this module:
 // int readUdp(int Packetsize)
 // int sendUdp(IPAddress server, int port, uint8_t *msg, int length)
-// bool connectUdp()
-// void pullData()
+// bool connectUdp();
+// void pullData();
 // void sendstat();
 
 // ----------------------------------------------------------------------------
@@ -44,7 +44,8 @@
 // Returns
 //	Boollean indicating success or not
 // ----------------------------------------------------------------------------
-bool connectUdp() {
+bool connectUdp() 
+{
 
 	bool ret = false;
 	unsigned int localPort = _LOCUDPPORT;			// To listen to return messages from WiFi
@@ -68,6 +69,7 @@ bool connectUdp() {
 	return(ret);
 }// connectUdp
 
+
 // ----------------------------------------------------------------------------
 // readUdp()
 // Read DOWN a package from UDP socket, can come from any server
@@ -150,11 +152,11 @@ int readUdp(int packetSize)
 		ident = buff_down[3];
 
 #if DUSB>=1
-	if ((debug>1) && (pdebug & P_MAIN)) {
-		Serial.print(F("M readUdp:: message waiting="));
-		Serial.print(ident);
-		Serial.println();
-	}
+		if ((debug>1) && (pdebug & P_MAIN)) {
+			Serial.print(F("M readUdp:: message waiting="));
+			Serial.print(ident);
+			Serial.println();
+		}
 #endif
 		// now parse the message type from the server (if any)
 		switch (ident) {

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

@@ -135,20 +135,20 @@ void wwwFile(String fn) {
 #endif
 
 #if DUSB>=1
-		File f = SPIFFS.open(fn, "r");					// Open the file for reading
+	File f = SPIFFS.open(fn, "r");					// Open the file for reading
 		
-		int j;
-		for (j=0; j<LOGFILEREC; j++) {
+	int j;
+	for (j=0; j<LOGFILEREC; j++) {
 			
-			String s=f.readStringUntil('\n');
-			if (s.length() == 0) {
-				Serial.print(F("wwwFile:: String length 0"));
-				break;
-			}
-			server.sendContent(s.substring(12));		// Skip the first 12 Gateway specific binary characters
-			server.sendContent("\n");
-			yield();
+		String s=f.readStringUntil('\n');
+		if (s.length() == 0) {
+			Serial.print(F("wwwFile:: String length 0"));
+			break;
 		}
+		server.sendContent(s.substring(12));		// Skip the first 12 Gateway specific binary characters
+		server.sendContent("\n");
+		yield();
+	}
 #endif
 	
 }

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

@@ -21,6 +21,7 @@
 //
 // ----------------------------------------------------------------------------------------
 
+// This file describes the includes necessary for ESP Filesystem.
 // At this moment there is only one record written to the ESP8266
 // filesystem. We can add more info, which makes the gateway even more usable,
 // however for large data we should only append to the existing file used.

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

@@ -1,6 +1,6 @@
 // sensor.h; 1-channel LoRa Gateway for ESP8266
 // Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
-// Version 6.1.0
+// Version 6.1.0 a
 // Date: 2019-10-20
 //
 // 	based on work done by Thomas Telkamp for Raspberry PI 1ch gateway

+ 6 - 1
README.md

@@ -103,7 +103,7 @@ There are two ways of changing the configuration of the single channel gateway:
 
 ## Editing the ESP-sc-gway.h file
 
-The ESP-sc-gway.h file contains all the user configurable settings. All have their definitions set through #define statements. 
+The ESP-sc-gway.h file contains the user configurable settings. All have their definitions set through #define statements. 
 In general, setting a #define to 1 will enable the function and setting it to 0 will disable it. 
 
 Also, some settings cn be initialised by setting their value with a #define but can be changed at runtime in the web interface.
@@ -114,6 +114,11 @@ However the memory available for heap and variables is limited to about 80K byte
 The user is advised to turn off functions not used in order to save on memory usage. 
 If the heap drops below 18 KBytes some functions may not behave as expected (in extreme case the program may crash).
 
+## Editing the sensor.h file
+
+The sensor.h file is used to set the structure of known sensors to the 1-channel gateway.
+When the gateway is not just used as a gateway but also for debugging purposes, the used can specify not only
+the name of the sensor node but also decrypt for certain nodes the message.
 
 ### Setting USB