Commit 049d6bab authored by Eric Duminil's avatar Eric Duminil
Browse files

Updated decode lorawan

parent 067cca9b
Pipeline #5820 passed with stage
in 2 minutes and 39 seconds
...@@ -98,7 +98,7 @@ void setup() { ...@@ -98,7 +98,7 @@ void setup() {
} }
#if defined(ESP32) #if defined(ESP32)
if (config::lorawan_active()) { if (config::is_lorawan_active()) {
lorawan::initialize(); lorawan::initialize();
} }
#endif #endif
...@@ -109,7 +109,7 @@ void setup() { ...@@ -109,7 +109,7 @@ void setup() {
*****************************************************************/ *****************************************************************/
void loop() { void loop() {
#if defined(ESP32) #if defined(ESP32)
if (config::lorawan_active()) { if (config::is_lorawan_active()) {
//LMIC Library seems to be very sensitive to timing issues, so run it first. //LMIC Library seems to be very sensitive to timing issues, so run it first.
lorawan::process(); lorawan::process();
...@@ -140,7 +140,7 @@ void loop() { ...@@ -140,7 +140,7 @@ void loop() {
} }
#if defined(ESP32) #if defined(ESP32)
if (config::lorawan_active()) { if (config::is_lorawan_active()) {
lorawan::preparePayloadIfTimeHasCome(sensor::co2, sensor::temperature, sensor::humidity); lorawan::preparePayloadIfTimeHasCome(sensor::co2, sensor::temperature, sensor::humidity);
} }
#endif #endif
......
...@@ -206,14 +206,19 @@ namespace lorawan { ...@@ -206,14 +206,19 @@ namespace lorawan {
// Prepare upstream data transmission at the next possible time. // Prepare upstream data transmission at the next possible time.
LMIC_setTxData2(1, buff, sizeof(buff), 0); LMIC_setTxData2(1, buff, sizeof(buff), 0);
//NOTE: To decode in TheThingsNetwork: //NOTE: To decode in TheThingsNetwork:
//function Decoder(bytes, port) { // function decodeUplink(input) {
// return { // return {
// co2: bytes[0] * 20, // data: {
// temp: bytes[1] / 5.0 - 10, // co2: input.bytes[0] * 20,
// rh: bytes[2] / 2.0 // temp: input.bytes[1] / 5.0 - 10,
// }; // rh: input.bytes[2] / 2.0
//} // },
// warnings: [],
// errors: []
// };
// }
} }
} }
......
...@@ -348,7 +348,7 @@ namespace config { ...@@ -348,7 +348,7 @@ namespace config {
// LORAWAN // LORAWAN
#if defined(ESP32) #if defined(ESP32)
bool lorawan_active() { bool is_lorawan_active() {
return web_config::loraParams.isActive(); return web_config::loraParams.isActive();
} }
#endif #endif
......
...@@ -53,7 +53,7 @@ namespace config { ...@@ -53,7 +53,7 @@ namespace config {
// LORAWAN // LORAWAN
#if defined(ESP32) #if defined(ESP32)
bool lorawan_active(); // also defined for ESP8266, and set to false bool is_lorawan_active(); // also defined for ESP8266, and set to false
#endif #endif
// Transmission rate // Transmission rate
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment