Commit 0c4e9f87 authored by Eric Duminil's avatar Eric Duminil
Browse files

Add 'lora 300' command

parent 90d94b88
......@@ -47,11 +47,12 @@ namespace lorawan {
LMIC_reset();
// Join, but don't send anything yet.
LMIC_startJoining();
sensor_commands::defineIntCallback("lora", setLoRaInterval, " 300 (Sets LoRaWAN sending interval, in s)");
}
// Checks if OTAA is connected, or if payload should be sent.
// NOTE: while a transaction is in process (i.e. until the TXcomplete event has been received, no blocking code (e.g. delay loops etc.) are allowed, otherwise the LMIC/OS code might miss the event.
// If this rule is not followed, a typical symptom is that the first send is ok and all following ones end with the TX not complete failure.
// If this rule is not followed, a typical symptom is that the first send is ok and all following ones end with the 'TX not complete' failure.
void process() {
os_runloop_once();
}
......@@ -189,6 +190,17 @@ namespace lorawan {
preparePayload(co2, temperature, humidity);
}
}
/*****************************************************************
* Callbacks for sensor commands *
*****************************************************************/
void setLoRaInterval(int32_t sending_interval) {
config::lorawan_sending_interval = sending_interval;
Serial.print(F("Setting LoRa sending interval to : "));
Serial.print(config::lorawan_sending_interval);
Serial.println("s.");
led_effects::showKITTWheel(color::green, 1);
}
}
void onEvent(ev_t ev) {
......
......@@ -13,7 +13,7 @@
#include <SPI.h>
#include "led_effects.h"
#include "sensor_commands.h"
#include "util.h"
namespace config {
......@@ -43,6 +43,8 @@ namespace lorawan {
void initialize();
void process();
void preparePayloadIfTimeHasCome(const int16_t &co2, const float &temp, const float &hum);
void setLoRaInterval(int32_t sending_interval);
}
#endif
......
......@@ -142,7 +142,7 @@ namespace mqtt {
*****************************************************************/
void setMQTTinterval(int32_t sending_interval) {
config::sending_interval = sending_interval;
Serial.print(F("Setting Sending Interval to : "));
Serial.print(F("Setting MQTT sending interval to : "));
Serial.print(config::sending_interval);
Serial.println("s.");
led_effects::showKITTWheel(color::green, 1);
......
Supports Markdown
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