Skip to content

Commit

Permalink
Version 6.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
platenspeler committed Nov 27, 2019
1 parent 82fe24f commit acf49f5
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 63 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ Maintained by Maarten Westenberg (mw12554@hotmail.com)
Features release 6.1.4 (November 29, 2019)
- Compacting Code and Solve Errors
- Look at _DUSB define and add to Serial.print directive where not found
- Renewed the GPS functions, changed "Serial1" to "sGps" to avoid double definitions.
- Downloaded TinyGPS++ library. All working on my T-Beam again.

Features release 6.1.3 (November 20, 2019)
- Made changes to _TRUSTED_NODES in _wwwServer.ino to make sure only named nodes are
displayed when the value of trusted nodes in "Gateways Settings" has value 2.
displayed when the value of trusted nodes in "Gateways Settings" has value 2.
The value of this vaiable is stored in the filesystem of the Gateway SPIFFS andwith every startup of
the Gateway it is read so that users can access when sensors last were seen by the Gateway
even after reboots.
Expand Down
2 changes: 1 addition & 1 deletion ESP-sc-gway/ESP-sc-gway.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
// Version 6.1.4
// Date: 2019-11-29
// Author: Maarten Westenberg (mw12554@hotmail.com)
Expand Down
4 changes: 2 additions & 2 deletions ESP-sc-gway/_gatewayMgt.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg
// Version 6.1.3
// Date: 2019-11-20
// Version 6.1.4
// Date: 2019-11-29
//
// Based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
// and many others.
Expand Down
43 changes: 16 additions & 27 deletions ESP-sc-gway/_loraFiles.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
// Version 6.1.3
// Date: 2019-11-20
// Version 6.1.4
// Date: 2019-11-29
//
// based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
// and many others.
Expand Down Expand Up @@ -486,9 +486,9 @@ int readSeen(const char *fn, struct nodeSeen *listSeen) {
#endif
}
val=f.readStringUntil('\t'); listSeen[i].timSeen = (uint32_t) val.toInt();
val=f.readStringUntil('\t');
listSeen[i].idSeen = (uint32_t) val.toInt();
//listSeen[i].idSeen = strtoul(val, val.length()+1, 10);
val=f.readStringUntil('\t'); listSeen[i].idSeen = (uint32_t) val.toInt();
val=f.readStringUntil('\t'); listSeen[i].cntSeen = (uint32_t) val.toInt();
val=f.readStringUntil('\t'); listSeen[i].chnSeen = (uint8_t) val.toInt();
val=f.readStringUntil('\n'); listSeen[i].sfSeen = (uint8_t) val.toInt();
}
f.close();
Expand Down Expand Up @@ -531,7 +531,8 @@ int writeSeen(const char *fn, struct nodeSeen *listSeen) {
// Typecast to long to avoid errors in unsigned conversion.
f.print((long) listSeen[i].idSeen); f.print('\t');
//f.print(listSeen[i].datSeen); f.print('\t');
//f.print(listSeen[i].chanSeen); f.print('\t');
f.print(listSeen[i].cntSeen); f.print('\t');
f.print(listSeen[i].chnSeen); f.print('\t');
//f.print(listSeen[i].rssiSeen); f.print('\t');
f.print(listSeen[i].sfSeen); f.print('\n');
}
Expand Down Expand Up @@ -579,27 +580,13 @@ int printSeen(struct nodeSeen *listSeen) {
// message. If not, create new record.
// - With this record, update the SF settings
// ----------------------------------------------------------------------------
int addSeen(struct nodeSeen *listSeen, uint32_t idSeen, uint8_t sfSeen, unsigned long timSeen) {
int addSeen(struct nodeSeen *listSeen, struct stat_t stat) {
int i;

// ( message[4]<<24 | message[3]<<16 | message[2]<<8 | message[1] )

#if _DUSB>=2
if (( debug>=1 ) && ( pdebug & P_MAIN )) {
Serial.print(F("addSeen:: "));
// Serial.print(F(" listSeen[0]="));
// Serial.print(listSeen[0].idSeen,HEX);
// Serial.print(F(", "));

Serial.print(F("tim=")); Serial.print(timSeen);
Serial.print(F(", idSeen=")); Serial.print(idSeen,HEX);
Serial.print(F(", sfSeen=")); Serial.print(sfSeen,HEX);
Serial.println();
}
#endif

for (i=0; i< _SEENMAX; i++) {
if ((listSeen[i].idSeen==idSeen) ||
if ((listSeen[i].idSeen==stat.node) ||
(listSeen[i].idSeen==0))
{
#if _DUSB>=2
Expand All @@ -608,9 +595,11 @@ int addSeen(struct nodeSeen *listSeen, uint32_t idSeen, uint8_t sfSeen, unsigned
Serial.print(i);
}
#endif
listSeen[i].idSeen = idSeen;
listSeen[i].sfSeen |= sfSeen;
listSeen[i].timSeen = timSeen;
listSeen[i].idSeen = stat.node;
listSeen[i].chnSeen = stat.ch;
listSeen[i].sfSeen |= stat.sf; // Or the argument
listSeen[i].timSeen = stat.tmst;
listSeen[i].cntSeen++; // Not included on functiin paras

writeSeen(_SEENFILE, listSeen);
break;
Expand All @@ -624,11 +613,9 @@ int addSeen(struct nodeSeen *listSeen, uint32_t idSeen, uint8_t sfSeen, unsigned
Serial.println(i);
}
#endif

return(0);
}


return(1);
}

Expand All @@ -642,6 +629,8 @@ int initSeen(struct nodeSeen *listSeen) {
for (i=0; i< _SEENMAX; i++) {
listSeen[i].idSeen=0;
listSeen[i].sfSeen=0;
listSeen[i].cntSeen=0;
listSeen[i].chnSeen=0;
listSeen[i].timSeen=0;
}
return(1);
Expand Down
14 changes: 7 additions & 7 deletions ESP-sc-gway/_loraModem.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
// Version 6.1.3
// Date: 2019-11-20
// Version 6.1.4
// Date: 2019-11-29
//
// based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
// and many others.
Expand Down Expand Up @@ -1042,11 +1042,11 @@ void initLoraModem(
#if _DUSB>=1
Serial.print(F("Unknown transceiver="));
Serial.print(version,HEX);
Serial.print(F(", pins.rst =")); Serial.print(pins.rst);
Serial.print(F(", pins.ss =")); Serial.print(pins.ss);
Serial.print(F(", pins.dio0 =")); Serial.print(pins.dio0);
Serial.print(F(", pins.dio1 =")); Serial.print(pins.dio1);
Serial.print(F(", pins.dio2 =")); Serial.print(pins.dio2);
Serial.print(F(", pins.rst =")); Serial.print(pins.rst);
Serial.print(F(", pins.ss =")); Serial.print(pins.ss);
Serial.print(F(", pins.dio0 =")); Serial.print(pins.dio0);
Serial.print(F(", pins.dio1 =")); Serial.print(pins.dio1);
Serial.print(F(", pins.dio2 =")); Serial.print(pins.dio2);
Serial.println();
Serial.flush();
#endif
Expand Down
4 changes: 2 additions & 2 deletions ESP-sc-gway/_oLED.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
// Version 6.1.3
// Date: 2019-11-20
// Version 6.1.4
// Date: 2019-11-29
//
// based on work done by Thomas Telkamp for Raspberry PI 1ch gateway
// and many others.
Expand Down
4 changes: 2 additions & 2 deletions ESP-sc-gway/_otaServer.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
// Version 6.1.3
// Date: 2019-11-20
// Version 6.1.4
// Date: 2019-11-29
//
//
// All rights reserved. This program and the accompanying materials
Expand Down
2 changes: 1 addition & 1 deletion ESP-sc-gway/_stateMachine.ino
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ void stateMachine()
// coming on this frequency so we wait on CDECT.
//
else if (intr == 0x00) {
#if _DUSB>=0
#if _DUSB>=1
if (( debug>=3 ) && ( pdebug & P_CAD )) {
Serial.println("Err CAD:: intr is 0x00");
}
Expand Down
4 changes: 2 additions & 2 deletions ESP-sc-gway/_txRx.ino
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ int buildPacket(uint32_t tmst, uint8_t *buff_up, struct LoraUp LoraUp, bool inte
statr[0].tmst = now();
statr[0].ch= ifreq;
statr[0].prssi = prssi - rssicorr;
statr[0].sf = LoraUp.sf;
#if RSSI==1
statr[0].rssi = _rssi - rssicorr;
#endif // RSII
statr[0].sf = LoraUp.sf;
#if _DUSB>=2
if (debug>=0) {
if ((message[4] != 0x26) || (message[1]==0x99)) {
Expand Down Expand Up @@ -602,7 +602,7 @@ int buildPacket(uint32_t tmst, uint8_t *buff_up, struct LoraUp LoraUp, bool inte
// When we have the node address and the SF, fill the array
// listSeen with the required data. SEENMAX must be >0 for this to happen.
#if _SEENMAX > 0
addSeen(listSeen, statr[0].node, statr[0].sf, now());
addSeen(listSeen, statr[0] );
#endif

#if _DUSB>=1
Expand Down
15 changes: 10 additions & 5 deletions ESP-sc-gway/_wwwServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void buttonLog()
// BUTTONSEEN
// List the listSeen array.
// Read the logfiles and display info about nodes (last seend, SF used etc).
// This is a button on the top of the GUI screen
// This is a button on the top of the USB GUI screen
// --------------------------------------------------------------------------------
void buttonSeen()
{
Expand Down Expand Up @@ -916,6 +916,7 @@ static void messageHistory()
#if _DUSB>=1
Serial.println("Unknow value for gwayConfig.trusted");
#endif
break;
}

#else // _TRUSTED_NODES
Expand Down Expand Up @@ -976,6 +977,7 @@ static void nodeHistory()
response += "<tr>";
response += "<th class=\"thead\" style=\"width: 220px;\">Time</th>";
response += "<th class=\"thead\">Node</th>";
response += "<th class=\"thead\">Count</th>";
//#if _LOCALSERVER==1
// response += "<th class=\"thead\">Data</th>";
//#endif
Expand Down Expand Up @@ -1013,17 +1015,20 @@ static void nodeHistory()
default:
#if _DUSB>=1
Serial.println("Unknow value for gwayConfig.trusted");
#endif
#endif
break;
}
#else // _TRUSTED_NODES
printHEX((char *)(& (listSeen[i].idSeen)),' ',response);
#endif // _TRUSTED_NODES

response += "</td>";

response += String() + "<td class=\"cell\">" + listSeen[i].cntSeen + "</td>"; // Counter

response += String() + "<td class=\"cell\">" + 0 + "</td>"; // Channel
response += String() + "<td class=\"cell\">" + listSeen[i].chnSeen + "</td>"; // Channel

response += String() + "<td class=\"cell\">" + listSeen[i].sfSeen + "</td>";
response += String() + "<td class=\"cell\">" + listSeen[i].sfSeen + "</td>"; // SF

server.sendContent(response);
}
Expand Down Expand Up @@ -1314,7 +1319,7 @@ void setupWWW()
// Set Frequency of the GateWay node
server.on("/FREQ=1", []() {
uint8_t nf = sizeof(freqs)/sizeof(freqs[0]); // Number of elements in array
#if _DUSB==2
#if _DUSB>=2
Serial.print("FREQ==1:: For freq[0] sizeof vector=");
Serial.print(sizeof(freqs[0]));
Serial.println();
Expand Down
26 changes: 18 additions & 8 deletions ESP-sc-gway/configGway.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017, 2018, 2019 Maarten Westenberg version for ESP8266
// Version 6.1.4 E EU868
// Date: 2019-11-25
// Date: 2019-11-29
//
// 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.
Expand Down Expand Up @@ -31,7 +31,7 @@

// Specify the correct version and date of your gateway here.
// Normally it is provided with teh GitHub version
#define VERSION "V.6.1.4.E.EU868; 191125a"
#define VERSION "V.6.1.4.E.EU868; 191129a"

// This value of DEBUG determines whether some parts of code get compiled.
// Also this is the initial value of debug parameter.
Expand All @@ -54,9 +54,18 @@
#define _SPIFF_FORMAT 0


// Define the frequency band the gateway will listen on. Valid options are
// EU863_870 (Europe), US902_928 (North America) & AU925_928 (Australia), CN470_510 (China).
// Define the frequency band the gateway will listen on. Valid options are:
// EU863_870 Europe
// US902_928 North America
// AU925_928 Australia
// CN470_510 China
// IN865_867 India
// CN779-787 (Not Used!)
// EU433 Europe
// AS923 (Not Used)
// See https://www.thethingsnetwork.org/docs/lorawan/frequency-plans.html
// You can find the definitions in "loraModem.h" and frequencies in

#define EU863_870 1


Expand Down Expand Up @@ -114,7 +123,7 @@
// 4: ESP32 TTGO pinning (should work for 433 and OLED too).
// 5: ESP32 TTGO EU868/EU433 MHz with OLED
// 6: Other, define your own in loraModem.h
#define _PIN_OUT 5
#define _PIN_OUT 4

// Gather statistics on sensor and Wifi status
// 0= No statistics
Expand Down Expand Up @@ -228,6 +237,7 @@

// lora sensor code definitions
// Defines whether the gateway will also report sensor/status value on MQTT
// such as GPS, battery or temperature.
// after all, a gateway can be a node to the system as well. Some sensors like GPS can be
// sent to the backend as a parameter, some (like humidity for example) can only be sent
// as a regular sensor value.
Expand All @@ -238,7 +248,7 @@


// We can put the gateway in such a mode that it will (only) recognize
// nodes that are put in a list of trusted nodes
// nodes that are put in a list of trusted nodes.
// Values:
// 0: Do not use names for trusted Nodes
// 1: Use the nodes as a translation table for hex codes to names (in TLN)
Expand Down Expand Up @@ -266,8 +276,8 @@
// - node Number, or known node name
// - Last seen 'seconds since 1/1/1970'
// - SF seen (8-bit integer with SF per bit)
// The initial version _NUMMAX stores max this many nodes, please make
// _SEENMAX==0 when not used
// The initial version _NUMMAX stores max this many nodes, please
// "define _SEENMAX 0" when not used
#define _SEENMAX 25
#define _SEENFILE "/gwayNum.txt"

Expand Down
2 changes: 2 additions & 0 deletions ESP-sc-gway/loraFiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ struct espGwayConfig {
struct nodeSeen {
unsigned long timSeen;
uint32_t idSeen;
uint32_t cntSeen;
uint8_t chnSeen;
uint8_t sfSeen;
};
struct nodeSeen listSeen[_SEENMAX];
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ can be loaded through this library section. Some cannot and are shipped with the
- 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)

Through Library Manager:

Expand All @@ -104,7 +105,6 @@ Through Library Manager:
- Streaming (Version 5.0.0)
- Ticker (Version 1.1.0)
- Time (Version 1.5.0)
- TinyGPS++ (Version 1.0.0)
- Update (Version 1.0.0)
- Webserver (Version 1.0.0)
- WiFiClientSecure (Version 1.0.0)
Expand Down
8 changes: 4 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Single Channel LoRaWAN Gateway

Version 6.1.2, November 14, 2019
Last Updated: November 25, 2019
Author: M. Westenberg (mw12554@hotmail.com)
Copyright: M. Westenberg (mw12554@hotmail.com)

Expand All @@ -16,12 +16,12 @@ Maintained by Maarten Westenberg (mw12554@hotmail.com)

# ToDo Functions

Features not in release 6.1.2
Features not in release 6.1.4

- Support FSK
- Support for eu433 frequencies
- Better testeing for uplink functions
- Get HOP functions to work on yhree frequencies
- Testing and timing of downlink functions (quiet area)
- Get HOP functions to work on three frequencies



Expand Down

0 comments on commit acf49f5

Please sign in to comment.