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() {
}
#if defined(ESP32)
if (config::lorawan_active()) {
if (config::is_lorawan_active()) {
lorawan::initialize();
}
#endif
......@@ -109,7 +109,7 @@ void setup() {
*****************************************************************/
void loop() {
#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.
lorawan::process();
......@@ -140,7 +140,7 @@ void loop() {
}
#if defined(ESP32)
if (config::lorawan_active()) {
if (config::is_lorawan_active()) {
lorawan::preparePayloadIfTimeHasCome(sensor::co2, sensor::temperature, sensor::humidity);
}
#endif
......
......@@ -206,14 +206,19 @@ namespace lorawan {
// Prepare upstream data transmission at the next possible time.
LMIC_setTxData2(1, buff, sizeof(buff), 0);
//NOTE: To decode in TheThingsNetwork:
//function Decoder(bytes, port) {
// return {
// co2: bytes[0] * 20,
// temp: bytes[1] / 5.0 - 10,
// rh: bytes[2] / 2.0
// };
//}
// function decodeUplink(input) {
// return {
// data: {
// co2: input.bytes[0] * 20,
// temp: input.bytes[1] / 5.0 - 10,
// rh: input.bytes[2] / 2.0
// },
// warnings: [],
// errors: []
// };
// }
}
}
......
......@@ -348,7 +348,7 @@ namespace config {
// LORAWAN
#if defined(ESP32)
bool lorawan_active() {
bool is_lorawan_active() {
return web_config::loraParams.isActive();
}
#endif
......
......@@ -53,7 +53,7 @@ namespace config {
// LORAWAN
#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
// 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