to facilitate development make radio optional for now
This commit is contained in:
parent
8863cb7d5c
commit
5a11a7a880
@ -64,10 +64,13 @@ void ttn_register(void (*callback)(uint8_t message));
|
|||||||
#define LORAWAN_CONFIRMED_EVERY 0 // Send confirmed message every these many messages (0 means never)
|
#define LORAWAN_CONFIRMED_EVERY 0 // Send confirmed message every these many messages (0 means never)
|
||||||
#define LORAWAN_SF DR_SF7 // Spreading factor
|
#define LORAWAN_SF DR_SF7 // Spreading factor
|
||||||
#define LORAWAN_ADR 0 // Enable ADR
|
#define LORAWAN_ADR 0 // Enable ADR
|
||||||
#define GPS_WAIT_FOR_LOCK 5000 // Wait 5s after every boot for GPS lock
|
#define REQUIRE_RADIO false // If true, we will fail to start if the radio is not found
|
||||||
|
|
||||||
|
// If not defined, we will wait for lock forever
|
||||||
|
// #define GPS_WAIT_FOR_LOCK 5000 // Wait 5s after every boot for GPS lock
|
||||||
|
|
||||||
// If defined, we will enter deep sleep after sending our packet. We will sleep until this interval expires or the user presses the button
|
// If defined, we will enter deep sleep after sending our packet. We will sleep until this interval expires or the user presses the button
|
||||||
#define DEEPSLEEP_INTERVAL (60 * 60 * 1000ULL) // sleep after we've received one message from the server (or we ran out of time), sleep for this many msecs
|
// #define DEEPSLEEP_INTERVAL (60 * 60 * 1000ULL) // sleep after we've received one message from the server (or we ran out of time), sleep for this many msecs
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// DEBUG
|
// DEBUG
|
||||||
|
@ -280,8 +280,8 @@ void setup() {
|
|||||||
|
|
||||||
// FIXME - remove once we know dynamic probing is working
|
// FIXME - remove once we know dynamic probing is working
|
||||||
#ifdef T_BEAM_V10
|
#ifdef T_BEAM_V10
|
||||||
axp192_found = true;
|
// axp192_found = true;
|
||||||
ssd1306_found = true;
|
// ssd1306_found = true;
|
||||||
#endif
|
#endif
|
||||||
axp192Init();
|
axp192Init();
|
||||||
|
|
||||||
@ -315,14 +315,18 @@ void setup() {
|
|||||||
// TTN setup
|
// TTN setup
|
||||||
if (!ttn_setup()) {
|
if (!ttn_setup()) {
|
||||||
screen_print("[ERR] Radio module not found!\n");
|
screen_print("[ERR] Radio module not found!\n");
|
||||||
|
|
||||||
|
if(REQUIRE_RADIO) {
|
||||||
delay(MESSAGE_TO_SLEEP_DELAY);
|
delay(MESSAGE_TO_SLEEP_DELAY);
|
||||||
screen_off();
|
screen_off();
|
||||||
sleep_forever();
|
sleep_forever();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
ttn_register(callback);
|
ttn_register(callback);
|
||||||
ttn_join();
|
ttn_join();
|
||||||
ttn_adr(LORAWAN_ADR);
|
ttn_adr(LORAWAN_ADR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEEPSLEEP_INTERVAL
|
#ifdef DEEPSLEEP_INTERVAL
|
||||||
@ -387,9 +391,11 @@ void deepSleepLoop() {
|
|||||||
screen_print("Waiting GPS lock\n");
|
screen_print("Waiting GPS lock\n");
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
#ifdef GPS_WAIT_FOR_LOCK
|
||||||
if (millis() > GPS_WAIT_FOR_LOCK) { // we never found a GPS lock, just go back to sleep
|
if (millis() > GPS_WAIT_FOR_LOCK) { // we never found a GPS lock, just go back to sleep
|
||||||
doDeepSleep();
|
doDeepSleep();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,9 +422,11 @@ void nonDeepSleepLoop() {
|
|||||||
screen_print("Waiting GPS lock\n");
|
screen_print("Waiting GPS lock\n");
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
#ifdef GPS_WAIT_FOR_LOCK
|
||||||
if (millis() > GPS_WAIT_FOR_LOCK) {
|
if (millis() > GPS_WAIT_FOR_LOCK) {
|
||||||
sleep();
|
sleep();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user