2020-09-27 23:15:50 +02:00
|
|
|
// clang-format off
|
|
|
|
|
|
|
|
// ----- Paxcounter user config file ------
|
|
|
|
//
|
|
|
|
// --> adapt to your needs and use case <--
|
|
|
|
//
|
2022-02-27 18:04:31 +01:00
|
|
|
// Notes:
|
|
|
|
// 1. After editing, before "build", use "clean" button in PlatformIO!
|
|
|
|
// 2. Clear NVRAM of the board to delete previous stored runtime settings (pio run -t erase)
|
2020-09-27 23:15:50 +02:00
|
|
|
|
2021-03-04 21:24:00 +01:00
|
|
|
// Device options
|
|
|
|
#define VERBOSE 1 // set to 0 to silence the device, 1 enables additional debug output
|
2021-03-05 17:00:28 +01:00
|
|
|
#define BOOTMENU 0 // 0 = no bootmenu, 1 = device brings up boot menu before starting application
|
|
|
|
#define BOOTDELAY 30 // time [seconds] while devices waits in boot menue for input
|
|
|
|
#define BOOTTIMEOUT 300 // time [seconds] while devices waits to finish upload a firmware file
|
2020-09-27 23:15:50 +02:00
|
|
|
|
|
|
|
// Payload send cycle and encoding
|
|
|
|
#define SENDCYCLE 30 // payload send cycle [seconds/2], 0 .. 255
|
2022-01-30 23:32:09 +01:00
|
|
|
#define SLEEPCYCLE 0 // sleep time after a send cycle [seconds/10], 0 .. 65535; 0 means no sleep [default = 0]
|
2020-09-27 23:15:50 +02:00
|
|
|
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=Cayenne LPP dynamic, 4=Cayenne LPP packed
|
2020-10-02 22:58:41 +02:00
|
|
|
#define COUNTERMODE 0 // 0=cyclic, 1=cumulative, 2=cyclic confirmed
|
2020-09-27 23:15:50 +02:00
|
|
|
|
2022-01-30 15:29:52 +01:00
|
|
|
// default settings for transmission of sensor data (first list = data on / second line = data off)
|
|
|
|
#define PAYLOADMASK \
|
2022-01-30 23:32:09 +01:00
|
|
|
((GPS_DATA | MEMS_DATA | COUNT_DATA | SENSOR1_DATA | SENSOR2_DATA | SENSOR3_DATA) & \
|
2022-01-31 09:24:47 +01:00
|
|
|
(~BATT_DATA) & (~RESERVED_DATA))
|
2022-01-30 15:29:52 +01:00
|
|
|
|
2020-11-08 22:14:28 +01:00
|
|
|
// MAC sniffing parameters
|
2021-03-23 15:52:20 +01:00
|
|
|
#define BLECOUNTER 1 // set to 0 if you do not want to install the BLE sniffer
|
2020-09-27 23:15:50 +02:00
|
|
|
#define WIFICOUNTER 1 // set to 0 if you do not want to install the WIFI sniffer
|
2022-11-13 22:27:32 +01:00
|
|
|
#define RSSILIMIT 0 // 0...-128, set to 0 if you do not want to filter signals
|
2020-09-27 23:15:50 +02:00
|
|
|
|
|
|
|
// BLE scan parameters
|
|
|
|
#define BLESCANTIME 0 // [seconds] scan duration, 0 means infinite [default], see note below
|
|
|
|
#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
|
|
|
|
|
|
|
|
/* Note: guide for setting bluetooth parameters
|
|
|
|
*
|
|
|
|
* |< Scan Window > |< Scan Window > | ... |< Scan Window > |
|
|
|
|
* |< Scan Interval >|< Scan Interval >| ... |< Scan Interval >|
|
|
|
|
* |< Scan duration >|
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* -> Scan interval can be changed during runtime by remote comammand.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// WiFi scan parameters
|
2022-10-19 22:55:22 +02:00
|
|
|
#define WIFI_MY_COUNTRY "01" // select 2-letter locale for Wifi RF settings, e.g. "DE"; use "01" for world safe mode
|
2020-09-27 23:15:50 +02:00
|
|
|
#define WIFI_CHANNEL_SWITCH_INTERVAL 50 // [seconds/100] -> 0,5 sec.
|
|
|
|
|
|
|
|
// LoRa payload default parameters
|
|
|
|
#define MEM_LOW 2048 // [Bytes] low memory threshold triggering a send cycle
|
|
|
|
#define RETRANSMIT_RCMD 5 // [seconds] wait time before retransmitting rcommand results
|
|
|
|
#define PAYLOAD_BUFFER_SIZE 51 // maximum size of payload block per transmit
|
|
|
|
#define PAYLOAD_OPENSENSEBOX 0 // send payload compatible to sensebox.de (swap geo position and pax data)
|
|
|
|
#define LORADRDEFAULT 5 // 0 .. 15, LoRaWAN datarate, according to regional LoRaWAN specs [default = 5]
|
|
|
|
#define LORATXPOWDEFAULT 14 // 0 .. 255, LoRaWAN TX power in dBm [default = 14]
|
|
|
|
#define MAXLORARETRY 500 // maximum count of TX retries if LoRa busy
|
|
|
|
#define SEND_QUEUE_SIZE 10 // maximum number of messages in payload send queue [1 = no queue]
|
|
|
|
|
|
|
|
// 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
|
|
|
|
#define DISPLAYCONTRAST 80 // 0 .. 255, OLED display contrast [default = 80]
|
|
|
|
#define DISPLAYCYCLE 3 // Auto page flip delay in sec [default = 2] for devices without button
|
|
|
|
#define HOMECYCLE 30 // house keeping cycle in seconds [default = 30 secs]
|
|
|
|
|
|
|
|
// Settings for BME680 environmental sensor
|
|
|
|
#define BME_TEMP_OFFSET 5.0f // Offset sensor on chip temp <-> ambient temp [default = 5°C]
|
|
|
|
#define STATE_SAVE_PERIOD UINT32_C(360 * 60 * 1000) // update every 360 minutes = 4 times a day
|
|
|
|
#define BMECYCLE 1 // bme sensor read cycle in seconds [default = 1 secs]
|
|
|
|
|
|
|
|
// OTA settings
|
|
|
|
#define USE_OTA 1 // set to 0 to disable OTA update
|
|
|
|
#define WIFI_MAX_TRY 5 // maximum number of wifi connect attempts for OTA update [default = 20]
|
|
|
|
#define OTA_MAX_TRY 5 // maximum number of attempts for OTA download and write to flash [default = 3]
|
|
|
|
#define OTA_MIN_BATT 50 // minimum battery level for OTA [percent]
|
|
|
|
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
|
|
|
|
|
|
|
|
// settings for syncing time of node with a time source (network / gps / rtc / timeserver)
|
2021-07-05 18:09:56 +02:00
|
|
|
#define TIME_SYNC_LORAWAN 1 // set to 1 to use LORA network as time source, 0 means off [default = 1]
|
2020-09-27 23:15:50 +02:00
|
|
|
#define TIME_SYNC_LORASERVER 0 // set to 1 to use LORA timeserver as time source, 0 means off [default = 0]
|
|
|
|
#define TIME_SYNC_INTERVAL 60 // sync time attempt each .. minutes from time source [default = 60], 0 means off
|
2020-12-09 10:15:12 +01:00
|
|
|
#define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off
|
2020-09-27 23:15:50 +02:00
|
|
|
#define TIME_SYNC_SAMPLES 1 // number of time requests for averaging, max. 255
|
|
|
|
#define TIME_SYNC_CYCLE 60 // delay between two time samples [seconds]
|
|
|
|
#define TIME_SYNC_TIMEOUT 400 // timeout waiting for timeserver answer [seconds]
|
|
|
|
#define TIME_SYNC_COMPILEDATE 0 // set to 1 to use compile date to initialize RTC after power outage [default = 0]
|
2021-05-09 00:02:41 +02:00
|
|
|
#define TIME_SYNC_TIMEZONE "CET-1CEST,M3.4.0/2,M10.4.0/3" // Timezone in POSIX format (example shows Germany/Berlin)
|
2020-09-27 23:15:50 +02:00
|
|
|
|
|
|
|
// Ports on which the device sends and listenes on LoRaWAN and SPI
|
|
|
|
#define COUNTERPORT 1 // counts
|
|
|
|
#define MACPORT 0 // network commands
|
|
|
|
#define RCMDPORT 2 // remote commands
|
|
|
|
#define STATUSPORT 2 // remote command results
|
|
|
|
#define CONFIGPORT 3 // config query results
|
2022-11-01 11:37:18 +01:00
|
|
|
#define GPSPORT 4 // gps - NOTE: set to 1 to send combined GPS+COUNTERPORT payload
|
2020-09-27 23:15:50 +02:00
|
|
|
#define BUTTONPORT 5 // button pressed signal
|
2021-05-07 19:41:36 +02:00
|
|
|
#define RESERVEDPORT 6 // reserved (unused)
|
2020-09-27 23:15:50 +02:00
|
|
|
#define BMEPORT 7 // BME680 sensor
|
|
|
|
#define BATTPORT 8 // battery voltage
|
|
|
|
#define TIMEPORT 9 // time query and response
|
|
|
|
#define SENSOR1PORT 10 // user sensor #1
|
|
|
|
#define SENSOR2PORT 11 // user sensor #2
|
|
|
|
#define SENSOR3PORT 12 // user sensor #3
|
|
|
|
|
|
|
|
// Cayenne LPP Ports, see https://community.mydevices.com/t/cayenne-lpp-2-0/7510
|
|
|
|
#define CAYENNE_LPP1 1 // dynamic sensor payload (LPP 1.0)
|
|
|
|
#define CAYENNE_LPP2 2 // packed sensor payload (LPP 2.0)
|
|
|
|
#define CAYENNE_GPS 3 // full scale GPS payload
|
|
|
|
#define CAYENNE_ACTUATOR 10 // actuator commands
|
|
|
|
#define CAYENNE_DEVICECONFIG 11 // device period configuration
|
|
|
|
#define CAYENNE_SENSORREAD 13 // sensor period configuration
|
2020-09-28 22:17:59 +02:00
|
|
|
#define CAYENNE_SENSORENABLE 14 // sensor enable configuration
|
2020-12-28 16:41:07 +01:00
|
|
|
|
|
|
|
// MQTT settings, only needed if MQTT is used (#define HAS_MQTT in board hal file)
|
2021-03-19 18:13:28 +01:00
|
|
|
#define MQTT_ETHERNET 1 // select PHY: set 0 for Wifi, 1 for ethernet (Wifi not yet implemented!)
|
2020-12-28 16:41:07 +01:00
|
|
|
#define MQTT_INTOPIC "paxin"
|
|
|
|
#define MQTT_OUTTOPIC "paxout"
|
|
|
|
#define MQTT_PORT 1883
|
|
|
|
#define MQTT_SERVER "public.cloud.shiftr.io"
|
|
|
|
#define MQTT_USER "public"
|
|
|
|
#define MQTT_PASSWD "public"
|
|
|
|
#define MQTT_RETRYSEC 20 // retry reconnect every 20 seconds
|
|
|
|
#define MQTT_KEEPALIVE 10 // keep alive interval in seconds
|
2022-11-01 11:37:18 +01:00
|
|
|
//#define MQTT_CLIENTNAME "my_paxcounter" // generated by default
|