commit
0e0717c51a
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
// Debug message will be put on Serial is this one is set.
|
// Debug message will be put on Serial is this one is set.
|
||||||
// If set to 0, not USB Serial prints are done
|
// If set to 0, not USB Serial prints are done
|
||||||
// Set to 1 it will prinr all user level messages (with correct debug set)
|
// Set to 1 it will print all user level messages (with correct debug set)
|
||||||
// If set to 2 it will also print interrupt messages (not recommended)
|
// If set to 2 it will also print interrupt messages (not recommended)
|
||||||
#define DUSB 1
|
#define DUSB 1
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
// Normally, value 0 is a good default.
|
// Normally, value 0 is a good default.
|
||||||
#define _SPIFF_FORMAT 0
|
#define _SPIFF_FORMAT 0
|
||||||
|
|
||||||
// Define the LoRa Frequncy band that is used. TTN Supported values are 925MHz, 868MHz and 433MHz.
|
// Define the LoRa Frequncy band that is used. TTN Supported values are 915MHz, 868MHz and 433MHz.
|
||||||
// So supported values are: 433 868 915
|
// So supported values are: 433 868 915
|
||||||
#define _LFREQ 868
|
#define _LFREQ 868
|
||||||
|
|
||||||
|
@ -270,4 +270,4 @@ wpas wpa[] = {
|
||||||
#define ASSERT(cond) if(!(cond)) gway_failed(__FILE__, __LINE__)
|
#define ASSERT(cond) if(!(cond)) gway_failed(__FILE__, __LINE__)
|
||||||
#else
|
#else
|
||||||
#define ASSERT(cond) /**/
|
#define ASSERT(cond) /**/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@ int sendPacket(uint8_t *buf, uint8_t length)
|
||||||
// CFList (fill to 16 bytes)
|
// CFList (fill to 16 bytes)
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
StaticJsonBuffer<312> jsonBuffer;
|
StaticJsonDocument<312> jsonBuffer;
|
||||||
char * bufPtr = (char *) (buf);
|
char * bufPtr = (char *) (buf);
|
||||||
buf[length] = 0;
|
buf[length] = 0;
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ int sendPacket(uint8_t *buf, uint8_t length)
|
||||||
#endif
|
#endif
|
||||||
// Use JSON to decode the string after the first 4 bytes.
|
// Use JSON to decode the string after the first 4 bytes.
|
||||||
// The data for the node is in the "data" field. This function destroys original buffer
|
// The data for the node is in the "data" field. This function destroys original buffer
|
||||||
JsonObject& root = jsonBuffer.parseObject(bufPtr);
|
auto error = deserializeJson(jsonBuffer, bufPtr);
|
||||||
|
|
||||||
if (!root.success()) {
|
if (error) {
|
||||||
#if DUSB>=1
|
#if DUSB>=1
|
||||||
if (( debug>=1) && (pdebug & P_TX)) {
|
if (( debug>=1) && (pdebug & P_TX)) {
|
||||||
Serial.print (F("T sendPacket:: ERROR Json Decode"));
|
Serial.print (F("T sendPacket:: ERROR Json Decode"));
|
||||||
|
@ -94,6 +94,7 @@ int sendPacket(uint8_t *buf, uint8_t length)
|
||||||
// {"txpk":{"codr":"4/5","data":"YCkEAgIABQABGmIwYX/kSn4Y","freq":868.1,"ipol":true,"modu":"LORA","powe":14,"rfch":0,"size":18,"tmst":1890991792,"datr":"SF7BW125"}}
|
// {"txpk":{"codr":"4/5","data":"YCkEAgIABQABGmIwYX/kSn4Y","freq":868.1,"ipol":true,"modu":"LORA","powe":14,"rfch":0,"size":18,"tmst":1890991792,"datr":"SF7BW125"}}
|
||||||
|
|
||||||
// Used in the protocol of Gateway:
|
// Used in the protocol of Gateway:
|
||||||
|
JsonObject root = jsonBuffer.to<JsonObject>();
|
||||||
const char * data = root["txpk"]["data"]; // Downstream Payload
|
const char * data = root["txpk"]["data"]; // Downstream Payload
|
||||||
uint8_t psize = root["txpk"]["size"];
|
uint8_t psize = root["txpk"]["size"];
|
||||||
bool ipol = root["txpk"]["ipol"];
|
bool ipol = root["txpk"]["ipol"];
|
||||||
|
@ -710,4 +711,3 @@ int receivePacket()
|
||||||
return(0); // failure no message read
|
return(0); // failure no message read
|
||||||
|
|
||||||
}//receivePacket
|
}//receivePacket
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
static void printIP(IPAddress ipa, const char sep, String& response)
|
static void printIP(IPAddress ipa, const char sep, String& response)
|
||||||
{
|
{
|
||||||
response+=(IPAddress)ipa[0]; response+=sep;
|
response+=ipa[0]; response+=sep;
|
||||||
response+=(IPAddress)ipa[1]; response+=sep;
|
response+=ipa[1]; response+=sep;
|
||||||
response+=(IPAddress)ipa[2]; response+=sep;
|
response+=ipa[2]; response+=sep;
|
||||||
response+=(IPAddress)ipa[3];
|
response+=ipa[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Ładowanie…
Reference in New Issue