BREAKING CHANGE: Replace separate anchor/tag firmware with single configurable codebase ## Major Changes - **Unified Firmware**: Single main.cpp replaces main_anchor.cpp and main_tag.cpp - **Modular Config**: Organized configuration system in src/config/ directory - **Dynamic Behavior**: Device behavior determined by build flags at compile time - **Simplified Builds**: Reduced from 8+ environments to 3 core environments ## New Architecture - src/main.cpp - Single firmware with config-driven behavior - src/config/device_config.h - Device role detection and unified behavior - src/config/anchor_config.h - Anchor-specific settings (positioning, communication) - src/config/tag_config.h - Tag-specific settings (USB streaming, coordinate collection) - src/config/positioning_config.h - Distributed positioning algorithm framework ## Build System Improvements - Simplified platformio.ini (anchor/tag/debug environments) - Support for custom device ID and network via PLATFORMIO_BUILD_FLAGS - Same firmware for all devices, behavior configured at compile time - Easy device configuration: set PLATFORMIO_BUILD_FLAGS=-DUWB_INDEX=5 -DNETWORK_ID=2000 ## Technical Benefits - Reduced code duplication from ~350 lines to unified ~200 lines - Consistent behavior across device types - Easier maintenance with single codebase - Framework ready for distributed positioning algorithm implementation - Modular configuration system for future algorithm expansion ## Positioning Framework Ready - Anchor discovery protocol framework established - Inter-anchor communication configuration ready - Position calculation algorithm structure in place - Coordinate storage and validation system configured - Tag coordinate collection and USB streaming framework prepared ## Testing - ✅ Anchor build successful (325KB flash usage) - ✅ Tag build successful (325KB flash usage) - ✅ Custom device ID/network configuration working - ✅ UWB initialization sequence fixed for active networks
56 lines
1.4 KiB
INI
56 lines
1.4 KiB
INI
; PlatformIO Project Configuration File
|
|
; Build options: build flags, source filter
|
|
; Upload options: custom upload port, speed, etc.
|
|
; Library options: dependencies, extra library storages
|
|
; Advanced options: extra scripting
|
|
|
|
[platformio]
|
|
default_envs = anchor
|
|
|
|
; Common configuration for both anchor and tag
|
|
[env]
|
|
platform = espressif32
|
|
board = esp32-s3-devkitc-1
|
|
framework = arduino
|
|
monitor_speed = 115200
|
|
monitor_filters = esp32_exception_decoder
|
|
build_flags =
|
|
-DCORE_DEBUG_LEVEL=3
|
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
|
|
|
; Library dependencies
|
|
lib_deps =
|
|
adafruit/Adafruit GFX Library@^1.11.7
|
|
adafruit/Adafruit SSD1306@^2.5.7
|
|
adafruit/Adafruit BusIO@^1.14.4
|
|
bblanchon/ArduinoJson@^6.21.3
|
|
|
|
; Unified Anchor configuration
|
|
[env:anchor]
|
|
build_src_filter = +<*> -<main_anchor.cpp> -<main_tag.cpp>
|
|
build_flags =
|
|
${env.build_flags}
|
|
-DDEVICE_TYPE_ANCHOR=1
|
|
-DUWB_INDEX=0
|
|
-DNETWORK_ID=1234
|
|
|
|
; Unified Tag configuration
|
|
[env:tag]
|
|
build_src_filter = +<*> -<main_anchor.cpp> -<main_tag.cpp>
|
|
build_flags =
|
|
${env.build_flags}
|
|
-DDEVICE_TYPE_TAG=1
|
|
-DUWB_INDEX=1
|
|
-DNETWORK_ID=1234
|
|
|
|
; Development environment with debugging
|
|
[env:debug]
|
|
build_src_filter = +<*> -<main_anchor.cpp> -<main_tag.cpp>
|
|
build_flags =
|
|
${env.build_flags}
|
|
-DDEVICE_TYPE_ANCHOR=1
|
|
-DUWB_INDEX=0
|
|
-DNETWORK_ID=1234
|
|
-DDEBUG_ENABLED=1
|
|
debug_tool = esp-prog
|
|
debug_init_break = tbreak setup
|