commit
ccb0be2ef6
@ -76,6 +76,8 @@ By default bluetooth sniffing is disabled (#define *BLECOUNTER* 0 in paxcounter.
|
||||
|
||||
Before compiling the code,
|
||||
|
||||
- **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.
|
||||
|
||||
- **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.
|
||||
|
||||
- **edit src/lmic_config.h** and tailor settings in this file according to your country and device hardware. Please take care of national regulations when selecting the frequency band for LoRaWAN.
|
||||
|
15
build.py
15
build.py
@ -22,6 +22,17 @@ config.read("platformio.ini")
|
||||
# get platformio source path
|
||||
srcdir = env.get("PROJECTSRC_DIR")
|
||||
|
||||
# get hal path
|
||||
haldir = os.path.join (srcdir, "hal")
|
||||
|
||||
# check if hal file is present in source directory
|
||||
halconfig = config.get("board", "halfile")
|
||||
halconfigfile = os.path.join (haldir, halconfig)
|
||||
if os.path.isfile(halconfigfile) and os.access(halconfigfile, os.R_OK):
|
||||
print "Parsing hardware configuration from " + halconfigfile
|
||||
else:
|
||||
sys.exit("Missing file " + halconfigfile + ", please create it! Aborting.")
|
||||
|
||||
# check if lmic config file is present in source directory
|
||||
lmicconfig = config.get("common", "lmicconfigfile")
|
||||
lmicconfigfile = os.path.join (srcdir, lmicconfig)
|
||||
@ -58,7 +69,7 @@ apitoken = mykeys["BINTRAY_API_TOKEN"]
|
||||
|
||||
# get bintray upload parameters from platformio environment
|
||||
version = config.get("common", "release_version")
|
||||
package = str(env.get("PIOENV"))
|
||||
package, dummy = halconfig.partition(".")[::2]
|
||||
|
||||
# put bintray user credentials to platformio environment
|
||||
env.Replace(BINTRAY_USER=user)
|
||||
@ -71,7 +82,7 @@ env.Append(BUILD_FLAGS=[
|
||||
u'-DWIFI_PASS=\\"' + mykeys["OTA_WIFI_PASS"] + '\\"',
|
||||
u'-DBINTRAY_USER=\\"' + mykeys["BINTRAY_USER"] + '\\"',
|
||||
u'-DBINTRAY_REPO=\\"' + mykeys["BINTRAY_REPO"] + '\\"',
|
||||
u'-DBINTRAY_PACKAGE=\\"$PIOENV\\"',
|
||||
u'-DBINTRAY_PACKAGE=\\"' + package + '\\"',
|
||||
u'-DARDUINO_LMIC_PROJECT_CONFIG_H=' + lmicconfig,
|
||||
u'-I \"' + srcdir + '\"'
|
||||
])
|
||||
|
419
platformio.ini
419
platformio.ini
@ -1,52 +1,100 @@
|
||||
; 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 TARGET PLATFORM HERE! <---
|
||||
[board]
|
||||
;halfile = ebox.h
|
||||
;board = esp32dev
|
||||
;upload_speed = 115200
|
||||
|
||||
;halfile = eboxtube.h
|
||||
;board = esp32dev
|
||||
;upload_speed = 115200
|
||||
|
||||
;halfile = ecopower.h
|
||||
;board = esp32dev
|
||||
|
||||
;halfile = heltec.h
|
||||
;board = heltec_wifi_lora_32
|
||||
|
||||
;halfile = heltecv2.h
|
||||
;board = heltec_wifi_lora_32_V2
|
||||
|
||||
;halfile = ttgov1.h
|
||||
;board = ttgo-lora32-v1
|
||||
;upload_speed = 115200
|
||||
|
||||
;halfile = ttgov2.h
|
||||
;board = ttgo-lora32-v1
|
||||
|
||||
;halfile = ttgov21old.h
|
||||
;board = esp32dev
|
||||
|
||||
;halfile = ttgov21new.h
|
||||
;board = esp32dev
|
||||
|
||||
halfile = ttgofox.h
|
||||
board = esp32dev
|
||||
|
||||
;halfile = ttgobeam.h
|
||||
;board = ttgo-t-beam
|
||||
|
||||
;halfile = fipy.h
|
||||
;board = esp32dev
|
||||
|
||||
;halfile = lopy.h
|
||||
;board = lopy
|
||||
|
||||
;halfile = lopy4.h
|
||||
;board = lopy4
|
||||
|
||||
;halfile = lolin32litelora.h
|
||||
;board = lolin32
|
||||
|
||||
;halfile = lolin32lora.h
|
||||
;board = lolin32
|
||||
|
||||
;halfile = lolin32lite.h
|
||||
;board = lolin32
|
||||
|
||||
;halfile = wemos32oled.h
|
||||
;board = lolin32
|
||||
|
||||
;halfile = octopus32.h
|
||||
;board = featheresp32
|
||||
|
||||
;halfile = generic.h
|
||||
;board = esp32dev
|
||||
|
||||
|
||||
[platformio]
|
||||
default_envs = generic
|
||||
;default_envs = ebox
|
||||
;default_envs = eboxtube
|
||||
;default_envs = ecopower
|
||||
;default_envs = heltec
|
||||
;default_envs = heltecv2
|
||||
;default_envs = ttgov1
|
||||
;default_envs = ttgov2
|
||||
;default_envs = ttgov21old
|
||||
;default_envs = ttgov21new
|
||||
;default_envs = ttgobeam
|
||||
;default_envs = ttgofox
|
||||
;default_envs = lopy
|
||||
;default_envs = lopy4
|
||||
;default_envs = fipy
|
||||
;default_envs = lolin32litelora
|
||||
;default_envs = lolin32lora
|
||||
;default_envs = lolin32lite
|
||||
;default_envs = wemos32oled
|
||||
;default_envs = octopus32
|
||||
;default_envs = ecopower, eboxtube, heltec, ttgobeam, lopy4, lopy, ttgov21old, ttgov21new, ttgofox
|
||||
;
|
||||
; upload firmware to board with usb cable
|
||||
;default_envs = usb
|
||||
|
||||
; upload firmware to a jfrog bintray repository
|
||||
default_envs = ota
|
||||
|
||||
description = Paxcounter is a proof-of-concept ESP32 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 = 1.7.62
|
||||
release_version = 1.7.71
|
||||
; 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
|
||||
; UPLOAD MODE: select esptool to flash via USB/UART, select custom to upload to cloud for OTA
|
||||
upload_protocol = esptool
|
||||
;upload_protocol = custom
|
||||
extra_scripts = pre:build.py
|
||||
otakeyfile = ota.conf
|
||||
lorakeyfile = loraconf.h
|
||||
lmicconfigfile = lmic_config.h
|
||||
platform_espressif32 = espressif32@1.8.0
|
||||
platform_espressif32 = espressif32@1.9.0
|
||||
;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#develop
|
||||
board_build.partitions = min_spiffs.csv
|
||||
monitor_speed = 115200
|
||||
upload_speed = 921600
|
||||
lib_deps_lora =
|
||||
;MCCI LoRaWAN LMIC library@2.3.2
|
||||
https://github.com/mcci-catena/arduino-lmic.git
|
||||
@ -57,7 +105,7 @@ lib_deps_matrix_display =
|
||||
lib_deps_rgbled =
|
||||
SmartLeds@>=1.1.5
|
||||
lib_deps_gps =
|
||||
TinyGPSPlus@>=1.0.2
|
||||
1655@>=1.0.2 ;TinyGPSPlus by Mikal Hart
|
||||
lib_deps_sensors =
|
||||
Adafruit Unified Sensor@^1.0.3
|
||||
Adafruit BME280 Library@1.0.8
|
||||
@ -74,7 +122,7 @@ lib_deps_all =
|
||||
${common.lib_deps_gps}
|
||||
${common.lib_deps_matrix_display}
|
||||
build_flags_basic =
|
||||
-include "src/hal/${PIOENV}.h"
|
||||
-include "src/hal/${board.halfile}"
|
||||
-include "src/paxcounter.conf"
|
||||
-w
|
||||
'-DCORE_DEBUG_LEVEL=${common.debug_level}'
|
||||
@ -86,319 +134,22 @@ build_flags_sensors =
|
||||
build_flags_all =
|
||||
${common.build_flags_basic}
|
||||
${common.build_flags_sensors}
|
||||
|
||||
[env:ebox]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 115200
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:eboxtube]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 115200
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_rgbled}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ecopower]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:heltec]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = heltec_wifi_lora_32
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:heltecv2]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = heltec_wifi_lora_32_V2
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ttgov1]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = ttgo-lora32-v1
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 115200
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ttgov2]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = ttgo-lora32-v1
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ttgov21old]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ttgov21new]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ttgofox]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:ttgobeam]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = ttgo-t-beam
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_gps}
|
||||
${common.lib_deps_display}
|
||||
build_flags =
|
||||
${common.build_flags_all}
|
||||
-mfix-esp32-psram-cache-issue
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:fipy]
|
||||
[env]
|
||||
board = ${board.board}
|
||||
upload_speed = ${board.upload_speed}
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_rgbled}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:lopy]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = lopy
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_rgbled}
|
||||
${common.lib_deps_gps}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:lopy4]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = lopy4
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_rgbled}
|
||||
${common.lib_deps_gps}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
-mfix-esp32-psram-cache-issue
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:lolin32litelora]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = lolin32
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_rgbled}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:lolin32lora]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = lolin32
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_lora}
|
||||
${common.lib_deps_rgbled}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:lolin32lite]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = lolin32
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_rgbled}
|
||||
${common.lib_deps_matrix_display}
|
||||
build_flags =
|
||||
${common.build_flags_basic}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:wemos32oled]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = lolin32
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
lib_deps =
|
||||
${common.lib_deps_basic}
|
||||
${common.lib_deps_display}
|
||||
${common.lib_deps_matrix_display}
|
||||
build_flags =
|
||||
${common.build_flags_all}
|
||||
upload_protocol = ${common.upload_protocol}
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
monitor_speed = ${common.monitor_speed}
|
||||
|
||||
[env:octopus32]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = featheresp32
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
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}
|
||||
|
||||
[env:generic]
|
||||
platform = ${common.platform_espressif32}
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
board_build.partitions = ${common.board_build.partitions}
|
||||
upload_speed = 921600
|
||||
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}
|
||||
[env:ota]
|
||||
upload_protocol = custom
|
||||
|
||||
[env:usb]
|
||||
upload_protocol = esptool
|
Loading…
Reference in New Issue
Block a user