2018-04-19 15:17:23 +02:00
|
|
|
// ----- Paxcounter user config file ------
|
|
|
|
//
|
|
|
|
// --> adapt to your needs and use case <--
|
2018-06-16 20:25:49 +02:00
|
|
|
//
|
|
|
|
// Note: After editing, before "build", use "clean" button in PlatformIO!
|
2018-04-19 15:17:23 +02:00
|
|
|
|
2018-09-17 17:23:02 +02:00
|
|
|
#define PRODUCTNAME "PAXCNT"
|
|
|
|
|
2018-04-19 15:17:23 +02:00
|
|
|
// Verbose enables serial output
|
|
|
|
#define VERBOSE 1 // comment out to silence the device, for mute use build option
|
|
|
|
|
2018-07-21 17:14:27 +02:00
|
|
|
// Payload send cycle and encoding
|
2018-07-22 20:27:58 +02:00
|
|
|
#define SEND_SECS 30 // payload send cycle [seconds/2] -> 60 sec.
|
2018-08-12 15:42:58 +02:00
|
|
|
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed
|
2018-07-21 17:14:27 +02:00
|
|
|
|
|
|
|
// Set this to include BLE counting and vendor filter functions
|
2018-08-04 18:29:44 +02:00
|
|
|
#define VENDORFILTER 1 // comment out if you want to count things, not people
|
2018-05-20 13:50:00 +02:00
|
|
|
#define BLECOUNTER 1 // comment out if you don't want BLE count, saves power & memory
|
2018-04-19 15:17:23 +02:00
|
|
|
|
|
|
|
// BLE scan parameters
|
2018-05-19 16:55:18 +02:00
|
|
|
#define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below
|
2018-05-20 21:21:47 +02:00
|
|
|
#define BLESCANWINDOW 80 // [milliseconds] scan window, see below, 3 .. 10240, default 80ms
|
|
|
|
#define BLESCANINTERVAL 80 // [illiseconds] scan interval, see below, 3 .. 10240, default 80ms = 100% duty cycle
|
2018-04-19 15:17:23 +02:00
|
|
|
|
|
|
|
/* Note: guide for setting bluetooth parameters
|
|
|
|
*
|
2018-05-19 16:55:18 +02:00
|
|
|
* |< Scan Window > |< Scan Window > | ... |< Scan Window > |
|
|
|
|
* |< Scan Interval >|< Scan Interval >| ... |< Scan Interval >|
|
|
|
|
* |< Scan duration >|
|
2018-04-19 15:17:23 +02:00
|
|
|
*
|
2018-05-19 16:55:18 +02:00
|
|
|
* Scan duration sets how long scanning should be going on, before starting a new scan cycle. 0 means infinite (default).
|
|
|
|
* Scan window sets how much of the interval should be occupied by scanning. Should be >= BLESCANINTERVAL.
|
2018-04-19 15:17:23 +02:00
|
|
|
* Scan interval is how long scanning should be done on each channel. BLE uses 3 channels for advertising.
|
|
|
|
* -> Adjust these values with power consumption in mind if power is limited.
|
2018-05-20 13:50:00 +02:00
|
|
|
* -> Scan interval can be changed during runtime by remote comammand.
|
2018-04-19 15:17:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
// WiFi scan parameters
|
|
|
|
#define WIFI_CHANNEL_MIN 1 // start channel number where scan begings
|
|
|
|
#define WIFI_CHANNEL_MAX 13 // total channel number to scan
|
|
|
|
#define WIFI_MY_COUNTRY "EU" // select locale for Wifi RF settings
|
|
|
|
#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec.
|
|
|
|
|
2018-07-14 19:12:20 +02:00
|
|
|
// LoRa payload default parameters
|
2018-04-28 14:33:27 +02:00
|
|
|
#define MEM_LOW 2048 // [Bytes] low memory threshold triggering a send cycle
|
2018-06-08 22:41:37 +02:00
|
|
|
#define RETRANSMIT_RCMD 5 // [seconds] wait time before retransmitting rcommand results
|
2018-06-16 19:50:36 +02:00
|
|
|
#define PAYLOAD_BUFFER_SIZE 51 // maximum size of payload block per transmit
|
2018-04-19 15:17:23 +02:00
|
|
|
#define LORASFDEFAULT 9 // 7 ... 12 SF, according to LoRaWAN specs
|
|
|
|
#define MAXLORARETRY 500 // maximum count of TX retries if LoRa busy
|
2018-08-03 23:50:04 +02:00
|
|
|
#define SEND_QUEUE_SIZE 10 // maximum number of messages in payload send queue
|
2018-07-15 19:08:18 +02:00
|
|
|
|
|
|
|
// Ports on which the device sends and listenes on LoRaWAN and SPI
|
2018-07-21 18:25:03 +02:00
|
|
|
#define COUNTERPORT 1 // Port on which device sends counts
|
2018-07-15 19:08:18 +02:00
|
|
|
#define RCMDPORT 2 // Port on which device listenes for remote commands
|
|
|
|
#define STATUSPORT 2 // Port on which device sends remote command results
|
|
|
|
#define CONFIGPORT 3 // Port on which device sends gps query results
|
|
|
|
#define GPSPORT 4 // Port on which device sends gps query results
|
2018-07-21 18:25:03 +02:00
|
|
|
#define BUTTONPORT 5 // Port on which device sends button pressed signal
|
2018-07-22 18:13:21 +02:00
|
|
|
#define LPP1PORT 1 // Port for Cayenne LPP 1.0 dynamic sensor encoding
|
|
|
|
#define LPP2PORT 2 // Port for Cayenne LPP 2.0 packed sensor encoding
|
2018-07-24 18:44:13 +02:00
|
|
|
#define BEACONPORT 6 // Port on which device sends beacon alarms
|
2018-04-19 15:17:23 +02:00
|
|
|
|
2018-07-22 11:08:55 +02:00
|
|
|
// Some hardware settings
|
|
|
|
#define RGBLUMINOSITY 30 // RGB LED luminosity [default = 30%]
|
|
|
|
#define DISPLAYREFRESH_MS 40 // OLED refresh cycle in ms [default = 40] -> 1000/40 = 25 frames per second
|
2018-07-25 00:17:31 +02:00
|
|
|
#define HOMECYCLE 30 // house keeping cycle in seconds [default = 30 secs]
|
2018-04-19 15:17:23 +02:00
|
|
|
|
2018-09-16 12:18:11 +02:00
|
|
|
// OTA settings
|
2018-09-24 16:36:11 +02:00
|
|
|
#define USE_OTA 1 // Comment out to disable OTA update
|
2018-09-16 12:18:11 +02:00
|
|
|
#define WIFI_MAX_TRY 20 // maximum number of wifi connect attempts for OTA update [default = 20]
|
2018-09-18 22:58:02 +02:00
|
|
|
#define FLASH_MAX_TRY 3 // maximum number of attempts for writing update binary to flash [default = 3]
|
2018-09-23 18:45:46 +02:00
|
|
|
#define OTA_MIN_BATT 3700 // minimum battery level vor OTA [millivolt]
|
2018-09-16 12:18:11 +02:00
|
|
|
|
2018-04-19 15:17:23 +02:00
|
|
|
// LMIC settings
|
|
|
|
// define hardware independent LMIC settings here, settings of standard library in /lmic/config.h will be ignored
|
|
|
|
// define hardware specifics settings in platformio.ini as build_flag for hardware environment
|
|
|
|
|
|
|
|
// Select frequency band here according to national regulations
|
|
|
|
#define CFG_eu868 1
|
|
|
|
//#define CFG_us915 1
|
|
|
|
|
|
|
|
// This is the SX1272/SX1273 radio, which is also used on the HopeRF
|
|
|
|
// RFM92 boards.
|
|
|
|
//#define CFG_sx1272_radio 1
|
|
|
|
// This is the SX1276/SX1277/SX1278/SX1279 radio, which is also used on
|
|
|
|
// the HopeRF RFM95 boards.
|
|
|
|
//#define CFG_sx1276_radio 1
|
|
|
|
|
|
|
|
// 16 μs per tick
|
|
|
|
// LMIC requires ticks to be 15.5μs - 100 μs long
|
|
|
|
#define US_PER_OSTICK_EXPONENT 4
|
|
|
|
#define US_PER_OSTICK (1 << US_PER_OSTICK_EXPONENT)
|
|
|
|
#define OSTICKS_PER_SEC (1000000 / US_PER_OSTICK)
|
|
|
|
|
|
|
|
// Set this to 1 to enable some basic debug output (using printf) about
|
|
|
|
// RF settings used during transmission and reception. Set to 2 to
|
|
|
|
// enable more verbose output. Make sure that printf is actually
|
|
|
|
// configured (e.g. on AVR it is not by default), otherwise using it can
|
|
|
|
// cause crashing.
|
2018-04-28 12:14:22 +02:00
|
|
|
//#define LMIC_DEBUG_LEVEL 1
|
2018-04-19 15:17:23 +02:00
|
|
|
|
|
|
|
// Enable this to allow using printf() to print to the given serial port
|
|
|
|
// (or any other Print object). This can be easy for debugging. The
|
|
|
|
// current implementation only works on AVR, though.
|
|
|
|
//#define LMIC_PRINTF_TO Serial
|
|
|
|
|
|
|
|
// Any runtime assertion failures are printed to this serial port (or
|
|
|
|
// any other Print object). If this is unset, any failures just silently
|
|
|
|
// halt execution.
|
|
|
|
#define LMIC_FAILURE_TO Serial
|
|
|
|
|
|
|
|
// Uncomment this to disable all code related to joining
|
|
|
|
//#define DISABLE_JOIN
|
|
|
|
// Uncomment this to disable all code related to ping
|
|
|
|
#define DISABLE_PING
|
|
|
|
// Uncomment this to disable all code related to beacon tracking.
|
|
|
|
// Requires ping to be disabled too
|
|
|
|
#define DISABLE_BEACONS
|
|
|
|
|
|
|
|
// Uncomment these to disable the corresponding MAC commands.
|
|
|
|
// Class A
|
|
|
|
//#define DISABLE_MCMD_DCAP_REQ // duty cycle cap
|
|
|
|
//#define DISABLE_MCMD_DN2P_SET // 2nd DN window param
|
|
|
|
//#define DISABLE_MCMD_SNCH_REQ // set new channel
|
|
|
|
// Class B
|
|
|
|
//#define DISABLE_MCMD_PING_SET // set ping freq, automatically disabled by DISABLE_PING
|
|
|
|
//#define DISABLE_MCMD_BCNI_ANS // next beacon start, automatical disabled by DISABLE_BEACON
|
|
|
|
|
|
|
|
// In LoRaWAN, a gateway applies I/Q inversion on TX, and nodes do the
|
|
|
|
// same on RX. This ensures that gateways can talk to nodes and vice
|
|
|
|
// versa, but gateways will not hear other gateways and nodes will not
|
|
|
|
// hear other nodes. By uncommenting this macro, this inversion is
|
|
|
|
// disabled and this node can hear other nodes. If two nodes both have
|
|
|
|
// this macro set, they can talk to each other (but they can no longer
|
|
|
|
// hear gateways). This should probably only be used when debugging
|
|
|
|
// and/or when talking to the radio directly (e.g. like in the "raw"
|
|
|
|
// example).
|
|
|
|
//#define DISABLE_INVERT_IQ_ON_RX
|
|
|
|
|
|
|
|
// This allows choosing between multiple included AES implementations.
|
|
|
|
// Make sure exactly one of these is uncommented.
|
|
|
|
//
|
|
|
|
// This selects the original AES implementation included LMIC. This
|
|
|
|
// implementation is optimized for speed on 32-bit processors using
|
|
|
|
// fairly big lookup tables, but it takes up big amounts of flash on the
|
|
|
|
// AVR architecture.
|
|
|
|
#define USE_ORIGINAL_AES
|
|
|
|
//
|
|
|
|
// This selects the AES implementation written by Ideetroon for their
|
|
|
|
// own LoRaWAN library. It also uses lookup tables, but smaller
|
|
|
|
// byte-oriented ones, making it use a lot less flash space (but it is
|
|
|
|
// also about twice as slow as the original).
|
|
|
|
// #define USE_IDEETRON_AES
|