// ----- Paxcounter user config file ------
//
// --> adapt to your needs and use case <--
//
// Note: After editing, before "build", use "clean" button in PlatformIO!

#define PRODUCTNAME                     "PAXCNT"

// Verbose enables serial output
#define VERBOSE                         1       // comment out to silence the device, for mute use build option

// Payload send cycle and encoding
#define SEND_SECS                       30      // payload send cycle [seconds/2] -> 60 sec.
#define PAYLOAD_ENCODER                 2       // payload encoder: 1=Plain, 2=Packed, 3=CayenneLPP dynamic, 4=CayenneLPP packed

// Set this to include BLE counting and vendor filter functions
#define VENDORFILTER                    1       // comment out if you want to count things, not people
#define BLECOUNTER                      1       // activate if you want to use BLE count, at expense of memory

// 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
#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.

// 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 LORASFDEFAULT                   9       // 7 ... 12 SF, according to LoRaWAN specs
#define MAXLORARETRY                    500     // maximum count of TX retries if LoRa busy
#define SEND_QUEUE_SIZE                 10      // maximum number of messages in payload send queue

// Ports on which the device sends and listenes on LoRaWAN and SPI
#define COUNTERPORT                     1       // Port on which device sends counts
#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 config query results
#define GPSPORT                         4       // Port on which device sends gps data
#define BUTTONPORT                      5       // Port on which device sends button pressed signal
#define LPP1PORT                        1       // Port for Cayenne LPP 1.0 dynamic sensor encoding
#define LPP2PORT                        2       // Port for Cayenne LPP 2.0 packed sensor encoding
#define BEACONPORT                      6       // Port on which device sends beacon alarms
#define BMEPORT                         7       // Port on which device sends BME680 sensor data
#define BATTPORT                        8       // Port on which device sends battery voltage data
#define SENSOR1PORT                     10      // Port on which device sends User sensor #1 data
#define SENSOR2PORT                     11      // Port on which device sends User sensor #2 data
#define SENSOR3PORT                     12      // Port on which device sends User sensor #3 data

// 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
#define HOMECYCLE                       30      // house keeping cycle in seconds [default = 30 secs]

// Settings for BME680 environmental sensor (if present)
#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

// OTA settings
#define USE_OTA                         1       // Comment out 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                    3600    // minimum battery level for OTA [millivolt]
#define RESPONSE_TIMEOUT_MS             60000   // firmware binary server connection timeout [milliseconds]

// setting for syncing time of node
//#define TIME_SYNC_INTERVAL              60      // sync time each ... minutes [default = 60], comment out means off          

// LMIC settings
// moved to src/lmic_config.h
