2018-03-18 19:45:17 +01:00
|
|
|
// The mother of all embedded development...
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
// std::set for unified array functions
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
// OLED Display
|
|
|
|
#include <U8x8lib.h>
|
|
|
|
|
|
|
|
// LMIC-Arduino LoRaWAN Stack
|
|
|
|
#include <lmic.h>
|
|
|
|
#include <hal/hal.h>
|
|
|
|
|
2018-03-21 17:34:11 +01:00
|
|
|
// Struct holding devices's runtime configuration
|
|
|
|
typedef struct {
|
|
|
|
int8_t lorasf; // 7-12, lora spreadfactor
|
|
|
|
int8_t txpower; // 2-15, lora tx power
|
|
|
|
int8_t adrmode; // 0=disabled, 1=enabled
|
|
|
|
int8_t screensaver; // 0=disabled, 1=enabled
|
|
|
|
int8_t screenon; // 0=disabled, 1=enabled
|
|
|
|
int8_t countermode; // 0=cyclic unconfirmed, 1=cumulative, 2=cyclic confirmed
|
|
|
|
int16_t rssilimit; // threshold for rssilimiter, negative value!
|
|
|
|
int8_t wifiscancycle; // wifi scan cycle [seconds/2]
|
|
|
|
int8_t wifichancycle; // wifi channel switch cycle [seconds/100]
|
|
|
|
int8_t blescancycle; // BLE scan cycle [seconds]
|
|
|
|
int8_t blescan; // 0=disabled, 1=enabled
|
2018-03-24 13:38:43 +01:00
|
|
|
int8_t wifiant; // 0=internal, 1=external (for LoPy/LoPy4)
|
2018-03-21 17:34:11 +01:00
|
|
|
char version[10]; // Firmware version
|
|
|
|
} configData_t;
|
2018-03-18 19:45:17 +01:00
|
|
|
|
2018-03-21 17:34:11 +01:00
|
|
|
extern configData_t cfg;
|
2018-03-18 19:45:17 +01:00
|
|
|
extern uint8_t mydata[];
|
|
|
|
extern uint64_t uptimecounter;
|
2018-03-21 17:34:11 +01:00
|
|
|
extern osjob_t sendjob;
|
2018-03-31 18:17:13 +02:00
|
|
|
extern int macnum, blenum, countermode, screensaver, adrmode, lorasf, txpower, rlim, salt;
|
2018-03-18 19:45:17 +01:00
|
|
|
extern bool joinstate;
|
2018-03-31 13:54:40 +02:00
|
|
|
extern std::set<uint32_t> macs;
|
2018-03-18 19:45:17 +01:00
|
|
|
|
2018-03-21 17:34:11 +01:00
|
|
|
#ifdef HAS_DISPLAY
|
|
|
|
extern HAS_DISPLAY u8x8;
|
|
|
|
#else
|
|
|
|
extern U8X8_NULL u8x8;
|
|
|
|
#endif
|
2018-03-18 19:45:17 +01:00
|
|
|
|
|
|
|
#ifdef BLECOUNTER
|
|
|
|
extern int scanTime;
|
|
|
|
#endif
|