Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,5 @@ jobs:
run: platformio pkg install
- name: Build default environment
run: platformio run --verbose
- name: On native platform run tests for 'tasks'
run: platformio test --verbose --environment test_native_tasks
- name: On native platform run tests for 'command line interpreter'
run: platformio test --verbose --environment test_native_cli
- name: On native platform run tests for 'string_helpers'
run: platformio test --verbose --environment test_native_string_helpers
- name: Run tests on the native platform for HMI layer
run: platformio test --verbose --environment test_native_hmi
- name: On native platform run tests
run: platformio test --verbose --environment native
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ In case the serial interface input is not read by PlatformIO serial monitor one

This is especially useful when simulating the microcontroller or device.

### Unit testing

The project is setup for running unit tests:

platformio test --verbose --environment native

## Contribute

Please refer to [`CONTRIBUTING.md`](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion lib/3rd_party_adapters/Arduino/serial_port.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ std::basic_ostream<CharType> &cout = std::cout;

void initialize()
{
Serial.begin(115200);
Serial.begin(BAUD_RATE);
delay(100);
Serial.flush();
delay(100);
Expand Down
96 changes: 18 additions & 78 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,107 +1,47 @@
; PlatformIO Project Configuration File
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

;-------------------------------------------------------
; global PIO parameters |
;-------------------------------------------------------
[platformio]
;default build enfironment for PIO project
default_envs = esp32-s3-devkitc-1

;Path to source files relative to PIO project
; see https://docs.platformio.org/en/stable/projectconf/sections/platformio/options/directory/src_dir.html
src_dir = src

;switch "include" path to be src as well, as we decide to have headers and sources in same directories
; this prevents the build environment from complaining the path not existing
include_dir = src

;-------------------------------------------------------
; common parameters for all environments [env:...] |
;-------------------------------------------------------
[env]
;filter for source file directory when building
; see https://docs.platformio.org/en/stable/projectconf/sections/env/options/build/build_src_filter.html
build_src_filter = +<*> -<.git/> -<.svn/>
build_flags =
-std=gnu++17 ; necessary for using modern STL
-Werror=return-type ; consider missing return information as fatal error
-Werror=overflow
build_unflags = -std=gnu++11 ; necessary to be able to specify a different language standard

;general dependencies
; for version requirements see https://docs.platformio.org/en/stable/core/userguide/pkg/cmd_install.html#cmd-pkg-install-requirements
[production]
extends = env
lib_deps =
adafruit/Adafruit SSD1306@~2.5.3
lvgl@^8.3
johboh/nlohmann-json@^3.11.3
; adding local library as dependency is necessary as it does not have any include files. This is because nothing should depend from this layer.
3rd_party_adapters ; this is necessary as no source code dependency shall exist to that packet
lib_ldf_mode = deep ; to automatically detect nested dependencies (for external libraries)
build_flags =
${env.build_flags}
-DLV_CONF_PATH="${PROJECT_DIR}/lib/3rd_party_adapters/LVGL/lv_conf.h" ; lvgl: use this config file
-std=gnu++17 ; necessary for using modern STL
-Werror=return-type ; consider missing return information as fatal error
build_unflags = -std=gnu++11 ; necessary to be able to specify a different language standard
-DBAUD_RATE=${this.monitor_speed}
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
build_type = debug

; Template section for tests to be run on native platform.
[test_native]
build_type = debug
[env:native]
platform = native
lib_deps =
unity
ArduinoFake
ArduinoFake@^0.4.0
enterprise_business_rules
lib_ldf_mode = chain ; automatically detect dependencies but to not recurse into other components
utilities
lib_ldf_mode = chain ; to simplify mocking, do not use deep mode
build_flags =
${env.build_flags}
-Wno-deprecated ; Workaround for https://github.com/FabioBatSilva/ArduinoFake/pull/41#issuecomment-1440550553
-Werror=overflow
-D unitTesting
-lgcov
--coverage
-fprofile-abs-path
-std=gnu++17 ; necessary for using modern STL
-O0 -ggdb3
build_unflags = -std=gnu++11
-O0
-ggdb3

;-------------------------------------------------------
; ESP32 build environment |
;-------------------------------------------------------
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
;;add dependencies to general dependencies from [env]
; lib_deps =
; ${env.lib_deps}

; We have individual test enviroments, as this allows us to define different
; include paths (lib_deps) per test.
; And this in turn allwos us to mock different parts of the software for each test.
[env:test_native_tasks]
extends = test_native
test_filter = test_tasks
lib_deps =
${test_native.lib_deps}
utilities

[env:test_native_cli]
extends = test_native
test_filter = test_cli
debug_test = test_cli
lib_deps =
${test_native.lib_deps}

[env:test_native_string_helpers]
extends = test_native
test_filter = test_string_helpers
debug_test = test_string_helpers

[env:test_native_hmi]
extends = test_native
test_filter = hmi/*
lib_deps =
${test_native.lib_deps}
application_business_rules
board_adapters
utilities
extends = production
monitor_filters = esp32_exception_decoder