created paxcounter_orig.conf and platformio_orig.ini, added platformio.ini and paxcounter.conf to .gitignore and update Readme.md
This commit is contained in:
parent
6d3222a7eb
commit
db281e11f9
2
.gitignore
vendored
2
.gitignore
vendored
@ -12,3 +12,5 @@
|
||||
.gcc-flags.json
|
||||
src/loraconf.h
|
||||
src/ota.conf
|
||||
platformio.ini
|
||||
src/paxcounter.conf
|
@ -85,11 +85,11 @@ By default bluetooth sniffing not installed (#define *BLECOUNTER* 0 in paxcounte
|
||||
|
||||
Compile time configuration is spread across several files. Before compiling the code, edit or create the following files:
|
||||
|
||||
## platformio.ini
|
||||
Edit `platformio.ini` and select desired hardware target in section boards. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in sections boards.
|
||||
## platformio_orig.ini
|
||||
Edit `platformio_orig.ini` and select desired hardware target in section boards. To add a new board, create an appropriate hardware abstraction layer file in hal subdirectory, and add a pointer to this file in sections boards. and rename to `platformio.ini`
|
||||
|
||||
## src/paxcounter.conf
|
||||
Edit `src/paxcounter.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use.
|
||||
## src/paxcounter_orig.conf
|
||||
Edit `src/paxcounter.conf` and tailor settings in this file according to your needs and use case. Please take care of the duty cycle regulations of the LoRaWAN network you're going to use. Rename to `paxcounter.conf`
|
||||
|
||||
If your device has a **real time clock** it can be updated bei either LoRaWAN network or GPS time, according to settings *TIME_SYNC_INTERVAL* and *TIME_SYNC_LORAWAN* in `paxcounter.conf`.
|
||||
|
||||
|
135
platformio_orig.ini
Normal file
135
platformio_orig.ini
Normal file
@ -0,0 +1,135 @@
|
||||
; PlatformIO Project Configuration File
|
||||
; NOTE: PlatformIO v4 is needed!
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; http://docs.platformio.org/page/projectconf.html
|
||||
|
||||
|
||||
; ---> SELECT THE TARGET PLATFORM HERE! <---
|
||||
[board]
|
||||
halfile = generic.h
|
||||
;halfile = ebox.h
|
||||
;halfile = eboxtube.h
|
||||
;halfile = ecopower.h
|
||||
;halfile = heltec.h
|
||||
;halfile = heltecv2.h
|
||||
;halfile = ttgov1.h
|
||||
;halfile = ttgov2.h
|
||||
;halfile = ttgov21old.h
|
||||
;halfile = ttgov21new.h
|
||||
;halfile = ttgofox.h
|
||||
;halfile = ttgobeam.h
|
||||
;halfile = ttgobeam10.h
|
||||
;halfile = fipy.h
|
||||
;halfile = lopy.h
|
||||
;halfile = lopy4.h
|
||||
;halfile = lolin32litelora.h
|
||||
;halfile = lolin32lora.h
|
||||
;halfile = lolin32lite.h
|
||||
;halfile = wemos32oled.h
|
||||
;halfile = wemos32matrix.h
|
||||
;halfile = octopus32.h
|
||||
;halfile = tinypico.h
|
||||
;halfile = tinypicomatrix.h
|
||||
;halfile = m5core.h
|
||||
;halfile = m5fire.h
|
||||
;halfile = olimexpoeiso.h
|
||||
|
||||
[platformio]
|
||||
; upload firmware to board with usb cable
|
||||
default_envs = usb
|
||||
; upload firmware to a jfrog bintray repository
|
||||
;default_envs = ota
|
||||
; use latest versions of libraries
|
||||
;default_envs = dev
|
||||
description = Paxcounter is a device for metering passenger flows in realtime. It counts how many mobile devices are around.
|
||||
|
||||
[common]
|
||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||
release_version = 2.0.12
|
||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||
debug_level = 3
|
||||
extra_scripts = pre:build.py
|
||||
otakeyfile = ota.conf
|
||||
lorakeyfile = loraconf.h
|
||||
lmicconfigfile = lmic_config.h
|
||||
platform_espressif32 = espressif32@2.0.0
|
||||
monitor_speed = 115200
|
||||
upload_speed = 115200 ; set by build.py and taken from hal file
|
||||
display_library = ; set by build.py and taken from hal file
|
||||
lib_deps_lora =
|
||||
mcci-catena/MCCI LoRaWAN LMIC library @ ^3.2.0
|
||||
lib_deps_display =
|
||||
bitbank2/OneBitDisplay @ 1.5.0
|
||||
ricmoo/QRCode @ ^0.0.1
|
||||
bodmer/TFT_eSPI @ ^2.2.20
|
||||
lib_deps_ledmatrix =
|
||||
seeed-studio/Ultrathin_LED_Matrix @ ^1.0.0
|
||||
lib_deps_rgbled =
|
||||
roboticsbrno/SmartLeds @ ^1.2.1
|
||||
lib_deps_gps =
|
||||
mikalhart/TinyGPSPlus @ ^1.0.2
|
||||
lib_deps_sensors =
|
||||
adafruit/Adafruit Unified Sensor @ ^1.1.4
|
||||
adafruit/Adafruit BME280 Library @ ^2.1.0
|
||||
adafruit/Adafruit BMP085 Library @ ^1.1.0
|
||||
boschsensortec/BSEC Software Library @ 1.5.1474
|
||||
https://github.com/ricki-z/SDS011.git
|
||||
lib_deps_basic =
|
||||
bblanchon/ArduinoJson @ <6
|
||||
jchristensen/Timezone @ ^1.2.4
|
||||
makuna/RTC @ ^2.3.5
|
||||
spacehuhn/SimpleButton
|
||||
lewisxhe/AXP202X_Library @ ^1.1.2
|
||||
geeksville/esp32-micro-sdcard @ ^0.1.1
|
||||
256dpi/MQTT @ ^2.4.7
|
||||
lib_deps_all =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
${common.lib_deps_rgbled}
|
||||
${common.lib_deps_gps}
|
||||
${common.lib_deps_sensors}
|
||||
${common.lib_deps_ledmatrix}
|
||||
build_flags_basic =
|
||||
-include "src/hal/${board.halfile}"
|
||||
-include "src/paxcounter.conf"
|
||||
-w
|
||||
'-DCORE_DEBUG_LEVEL=${common.debug_level}'
|
||||
'-DLOG_LOCAL_LEVEL=${common.debug_level}'
|
||||
'-DPROGVERSION="${common.release_version}"'
|
||||
build_flags_sensors =
|
||||
-Llib/Bosch-BSEC/src/esp32/
|
||||
-lalgobsec
|
||||
build_flags_all =
|
||||
${common.build_flags_basic}
|
||||
${common.build_flags_sensors}
|
||||
-mfix-esp32-psram-cache-issue
|
||||
|
||||
[env]
|
||||
lib_ldf_mode = deep ; #632 Fixes compiler error with OneBitDisplay library
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = min_spiffs.csv
|
||||
upload_speed = ${common.upload_speed}
|
||||
;upload_port = COM8
|
||||
platform = ${common.platform_espressif32}
|
||||
lib_deps = ${common.lib_deps_all}
|
||||
build_flags = ${common.build_flags_all}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
monitor_filters = time, esp32_exception_decoder, default
|
||||
|
||||
[env:ota]
|
||||
upload_protocol = custom
|
||||
|
||||
[env:usb]
|
||||
upload_protocol = esptool
|
||||
|
||||
[env:dev]
|
||||
upload_protocol = esptool
|
||||
build_type = debug
|
||||
platform = https://github.com/platformio/platform-espressif32.git#develop
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
|
88
src/loarconf_sample_h
Normal file
88
src/loarconf_sample_h
Normal file
@ -0,0 +1,88 @@
|
||||
#ifndef __LORACONF_H__
|
||||
#define __LORACONF_H__
|
||||
|
||||
#if (HAS_LORA)
|
||||
|
||||
/************************************************************
|
||||
* LMIC LoRaWAN configuration
|
||||
*
|
||||
* Read the values from TTN console (or whatever applies), insert them here,
|
||||
* and rename this file to src/loraconf.h
|
||||
*
|
||||
* You can configure OTAA or ABP Activation. In order to use ABP, uncomment
|
||||
* (enable) the following line, but you should only do so, if you have good
|
||||
* reasons for not using OTAA.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
//#define LORA_ABP
|
||||
|
||||
#ifndef LORA_ABP
|
||||
/************************************************************
|
||||
* OTAA configuration
|
||||
*
|
||||
* DEVEUI, APPEUI and APPKEY should all be specified in MSB format as
|
||||
* displayed in TTN console, so you can cut & paste from there. This is different
|
||||
* from standard LMIC-Arduino which expects DEVEUI and APPEUI in LSB format.
|
||||
* For TTN, APPEUI in MSB format always starts with 0x70, 0xB3, 0xD5.
|
||||
* Set your DEVEUI here, if your device has have a fixed one.
|
||||
* If you leave this untouched, then the DEVEUI will be derived from device's
|
||||
* MAC adress during startup and will be displayed on device's screen as well as
|
||||
* on serial console, if you set 'verbose 1' in paxcounter.conf and
|
||||
* 'debug_level 3' in platformio.ini.
|
||||
* If using a board with Microchip 24AA02E64 Uinique ID for deveui, the DEVEUI
|
||||
* will be overwritten by the one contained in the Microchip module.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
static const u1_t DEVEUI[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const u1_t APPEUI[8] = {0x70, 0xB3, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const u1_t APPKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LORA_ABP
|
||||
/************************************************************
|
||||
* ABP configuration (for development)
|
||||
*
|
||||
* Get your
|
||||
* - Network Session Key (NWKSKEY)
|
||||
* - App Session Key and your (APPSKEY)
|
||||
* - Device Address (DEVADDR)
|
||||
* from e.g. TTN console and replace the example values below.
|
||||
*
|
||||
* NOTE: Use MSB format (as displayed in TTN console, so you can cut & paste
|
||||
* from there)
|
||||
*
|
||||
* NOTE: You may also need to adjust lorawan_abp.cpp in order to configure
|
||||
* different channels and data rate channels to match your country's regulations
|
||||
* and your network's settings.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// ID of LoRaAlliance assigned Network (for a list, see e.g. here
|
||||
// https://www.thethingsnetwork.org/docs/lorawan/prefix-assignments.html)
|
||||
static const u1_t NETID = 0x13; // TTN
|
||||
|
||||
static const u1_t NWKSKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const u1_t APPSKEY[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
static const u4_t DEVADDR =
|
||||
0x00000000; // <-- Change this address for every node!
|
||||
|
||||
// set additional ABP parameters in loraconf_abp.cpp
|
||||
void setABPParameters();
|
||||
|
||||
#endif
|
||||
|
||||
#endif // HAS_LORA
|
||||
|
||||
#endif // __LORACONF_H__
|
8
src/ota_sample.conf
Normal file
8
src/ota_sample.conf
Normal file
@ -0,0 +1,8 @@
|
||||
[ota]
|
||||
OTA_WIFI_SSID = MyHomeWifi
|
||||
OTA_WIFI_PASS = FooBar42!
|
||||
|
||||
[bintray]
|
||||
BINTRAY_USER = MyBintrayUser
|
||||
BINTRAY_REPO = MyBintrayRepo
|
||||
BINTRAY_API_TOKEN = 3894a7a51d70c6523c1b7479261c34845ebf7878
|
122
src/paxcounter_orig.conf
Normal file
122
src/paxcounter_orig.conf
Normal file
@ -0,0 +1,122 @@
|
||||
// clang-format off
|
||||
|
||||
// ----- Paxcounter user config file ------
|
||||
//
|
||||
// --> adapt to your needs and use case <--
|
||||
//
|
||||
// Note: After editing, before "build", use "clean" button in PlatformIO!
|
||||
|
||||
// Verbose enables additional serial debug output
|
||||
#define VERBOSE 1 // set to 0 to silence the device, for mute use build option
|
||||
|
||||
// Payload send cycle and encoding
|
||||
#define SENDCYCLE 30 // payload send cycle [seconds/2], 0 .. 255
|
||||
#define PAYLOAD_ENCODER 2 // payload encoder: 1=Plain, 2=Packed, 3=Cayenne LPP dynamic, 4=Cayenne LPP packed
|
||||
#define COUNTERMODE 1 // 0=cyclic, 1=cumulative, 2=cyclic confirmed
|
||||
|
||||
// Set this to include BLE counting and vendor filter functions, or to switch off WIFI counting
|
||||
#define VENDORFILTER 0 // set to 0 if you want to scan all devices, not filtering smartphone OUIs
|
||||
#define BLECOUNTER 1 // set to 0 if you do not want to install the BLE sniffer
|
||||
#define WIFICOUNTER 1 // set to 0 if you do not want to install the WIFI sniffer
|
||||
|
||||
// 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
|
||||
|
||||
// Corona Exposure Notification Service(ENS) counter
|
||||
#define COUNT_ENS 1 // count found number of devices which advertise Exposure Notification Service
|
||||
// set to 0 if you do not want to enable this function
|
||||
|
||||
// for additional sensors (added by some user)
|
||||
#define HAS_SENSOR_1 1 // set to 1 if you want to transmit CWA counter
|
||||
#define HAS_SENSOR_2 0 // not used
|
||||
#define HAS_SENSOR_3 0 // not used
|
||||
#define HAS_SENSORS (HAS_SENSOR_1 || HAS_SENSOR_2 || HAS_SENSOR_3) // to simplify things
|
||||
|
||||
/* 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 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)
|
||||
#define TIME_SYNC_LORAWAN 1 // set to 1 to use LORA network as time source, 0 means off [default = 1]
|
||||
#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
|
||||
#define TIME_SYNC_INTERVAL_RETRY 10 // retry time sync after lost sync each .. minutes [default = 10], 0 means off
|
||||
#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]
|
||||
|
||||
// time zone, see https://github.com/JChristensen/Timezone/blob/master/examples/WorldClock/WorldClock.ino
|
||||
#define DAYLIGHT_TIME {"CEST", Last, Sun, Mar, 2, 120} // Central European Summer Time
|
||||
#define STANDARD_TIME {"CET ", Last, Sun, Oct, 3, 60} // Central European Standard Time
|
||||
|
||||
// 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
|
||||
#define GPSPORT 4 // gps - NOTE: set to 1 to send combined GPS+COUNTERPORT payload
|
||||
#define BUTTONPORT 5 // button pressed signal
|
||||
#define BEACONPORT 6 // beacon alarms
|
||||
#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
|
||||
#define CAYENNE_SENSORENABLE 14 // sensor enable configuration
|
Loading…
Reference in New Issue
Block a user