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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ Thumbs.db
*.swp
*.swo
*~

# Core dumps, which a failing host test binary drops in the repository root.
core.*
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ The project follows Semantic Versioning once the first firmware release is tagge

### Fixed

- time settings could not reach most of their own range: the average lap picker stopped at
3:00 against a field holding 59:59, and the durations at 60 minutes against 24 hours
- saving on the roller used LVGL's 400 ms long press, which committed a value while it was
still being chosen

- the G meter subtracted a gravity reference frozen at calibration, so every later change
of tilt read as acceleration at sin(angle) - 0.17 g on a 10 degree banked corner - and
peak-hold latched those artefacts rather than averaging them away; attitude is now
Expand Down Expand Up @@ -45,6 +50,9 @@ The project follows Semantic Versioning once the first firmware release is tagge
- vertical G alongside the lateral and longitudinal pair, for kerbs and compressions
- gyroscope zero-rate offset measured at rest and removed, 4.4 dps on this board
- device settings persisted in NVS, so Mode survives a reboot
- two-column minutes-and-seconds roller for average lap, session and rest duration, with
drag, flick momentum, and a deliberate hold to save
- session and rest durations stored as seconds rather than whole minutes
- Track Day running-session screen: countdown, estimated laps as a float, and a
decaying session bar
- five-band countdown colour ramp blending proportional and absolute thresholds
Expand Down
34 changes: 25 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ SHELL_NAVIGATION_TEST_BINARY := build/host/shell_navigation_test
DEVICE_MODE_TEST_BINARY := build/host/device_mode_test
IMU_CALIBRATION_TEST_BINARY := build/host/imu_calibration_test
SESSION_URGENCY_TEST_BINARY := build/host/session_urgency_test
TIME_ROLLER_TEST_BINARY := build/host/time_roller_test
GATE_CAPTURE_TEST_BINARY := build/host/gate_capture_test
GATE_SESSION_AUTOMATION_TEST_BINARY := build/host/gate_session_automation_test
SIMULATOR_BUILD_DIR ?= build/simulator
SIMULATOR_IMAGE ?= track-session-timer-simulator:lvgl-9.5.0
CMAKE ?= cmake

.PHONY: check test track-validate uk-track-pack track-pack-test simulator-track-catalog-test simulator-fixture-validate repo-check host-test simulator-model-test session-state-test settings-test settings-editor-test projection-test intersection-test crossing-validation-test crossing-time-test lap-state-machine-test timing-engine-test gate-event-engine-test track-definition-test track-capture-test track-matching-test track-selection-test log-format-test async-logger-test session-review-test diagnostics-test active-session-test display-policy-test imu-meter-test rest-session-test track-catalog-test shell-navigation-test device-mode-test imu-calibration-test session-urgency-test gate-capture-test gate-session-automation-test ui-foundation-test navigation-test simulator-configure simulator-build simulator-test simulator-run simulator-container-image simulator-container-test simulator-clean firmware-build firmware-container-build firmware-container-flash firmware-container-monitor firmware-container-flash-monitor firmware-container-erase firmware-device-info firmware-clean issue-preview label-preview
.PHONY: check test track-validate uk-track-pack track-pack-test simulator-track-catalog-test simulator-fixture-validate repo-check host-test simulator-model-test session-state-test settings-test settings-editor-test projection-test intersection-test crossing-validation-test crossing-time-test lap-state-machine-test timing-engine-test gate-event-engine-test track-definition-test track-capture-test track-matching-test track-selection-test log-format-test async-logger-test session-review-test diagnostics-test active-session-test display-policy-test imu-meter-test rest-session-test track-catalog-test shell-navigation-test device-mode-test imu-calibration-test session-urgency-test time-roller-test gate-capture-test gate-session-automation-test ui-foundation-test navigation-test simulator-configure simulator-build simulator-test simulator-run simulator-container-image simulator-container-test simulator-clean firmware-build firmware-container-build firmware-container-flash firmware-container-monitor firmware-container-flash-monitor firmware-container-erase firmware-device-info firmware-clean issue-preview label-preview

check: test track-validate track-pack-test simulator-track-catalog-test simulator-fixture-validate repo-check host-test simulator-model-test session-state-test settings-test settings-editor-test projection-test intersection-test crossing-validation-test crossing-time-test lap-state-machine-test timing-engine-test gate-event-engine-test track-definition-test track-capture-test track-matching-test track-selection-test log-format-test async-logger-test session-review-test diagnostics-test active-session-test display-policy-test imu-meter-test rest-session-test track-catalog-test shell-navigation-test device-mode-test imu-calibration-test session-urgency-test gate-capture-test gate-session-automation-test ui-foundation-test navigation-test
check: test track-validate track-pack-test simulator-track-catalog-test simulator-fixture-validate repo-check host-test simulator-model-test session-state-test settings-test settings-editor-test projection-test intersection-test crossing-validation-test crossing-time-test lap-state-machine-test timing-engine-test gate-event-engine-test track-definition-test track-capture-test track-matching-test track-selection-test log-format-test async-logger-test session-review-test diagnostics-test active-session-test display-policy-test imu-meter-test rest-session-test track-catalog-test shell-navigation-test device-mode-test imu-calibration-test session-urgency-test time-roller-test gate-capture-test gate-session-automation-test ui-foundation-test navigation-test

test:
$(PYTHON) -B -m unittest discover -s tests -p 'test_*.py'
Expand Down Expand Up @@ -99,11 +100,12 @@ simulator-model-test:
-Ifirmware/components/board/include \
-Ifirmware/components/domain/include \
-Ifirmware/components/logger/include \
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
-Isimulator/include \
firmware/components/logger/async_logger.cpp \
firmware/components/ui/foundation.cpp firmware/components/ui/navigation.cpp \
firmware/components/ui/presenter.cpp \
firmware/components/ui/presenter.cpp firmware/components/ui/time_roller.cpp \
simulator/src/device_backends.cpp \
simulator/src/fixed_cell_text.cpp \
simulator/src/scenario.cpp \
Expand Down Expand Up @@ -135,7 +137,7 @@ settings-editor-test:
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
firmware/components/settings/component.cpp \
firmware/components/ui/settings_editor.cpp \
firmware/components/ui/settings_editor.cpp firmware/components/ui/time_roller.cpp \
tests/cpp/test_settings_editor.cpp -o $(SETTINGS_EDITOR_TEST_BINARY)
$(SETTINGS_EDITOR_TEST_BINARY)

Expand Down Expand Up @@ -314,10 +316,11 @@ active-session-test:
mkdir -p build/host
$(CXX) -std=c++17 -Wall -Wextra -Werror -pedantic \
-Ifirmware/components/domain/include \
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
firmware/components/ui/active_session.cpp \
firmware/components/ui/foundation.cpp \
firmware/components/ui/presenter.cpp \
firmware/components/ui/presenter.cpp firmware/components/ui/time_roller.cpp \
tests/cpp/test_active_session.cpp -o $(ACTIVE_SESSION_TEST_BINARY)
$(ACTIVE_SESSION_TEST_BINARY)

Expand Down Expand Up @@ -420,14 +423,25 @@ gate-session-automation-test:
-o $(GATE_SESSION_AUTOMATION_TEST_BINARY)
$(GATE_SESSION_AUTOMATION_TEST_BINARY)

time-roller-test:
mkdir -p build/host
$(CXX) -std=c++17 -Wall -Wextra -Werror -pedantic \
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
firmware/components/settings/component.cpp \
firmware/components/ui/time_roller.cpp \
tests/cpp/test_time_roller.cpp -o $(TIME_ROLLER_TEST_BINARY)
$(TIME_ROLLER_TEST_BINARY)

session-urgency-test:
mkdir -p build/host
$(CXX) -std=c++17 -Wall -Wextra -Werror -pedantic \
-Ifirmware/components/domain/include \
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
firmware/components/ui/active_session.cpp \
firmware/components/ui/foundation.cpp \
firmware/components/ui/presenter.cpp \
firmware/components/ui/presenter.cpp firmware/components/ui/time_roller.cpp \
tests/cpp/test_session_urgency.cpp -o $(SESSION_URGENCY_TEST_BINARY)
$(SESSION_URGENCY_TEST_BINARY)

Expand All @@ -449,7 +463,7 @@ device-mode-test:
-Ifirmware/components/ui/include \
firmware/components/settings/component.cpp \
firmware/components/ui/device_mode.cpp \
firmware/components/ui/value_picker.cpp \
firmware/components/ui/value_picker.cpp firmware/components/ui/time_roller.cpp \
tests/cpp/test_device_mode.cpp -o $(DEVICE_MODE_TEST_BINARY)
$(DEVICE_MODE_TEST_BINARY)

Expand All @@ -468,20 +482,22 @@ ui-foundation-test:
mkdir -p build/host
$(CXX) -std=c++17 -Wall -Wextra -Werror -pedantic \
-Ifirmware/components/domain/include \
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
firmware/components/ui/foundation.cpp \
firmware/components/ui/presenter.cpp \
firmware/components/ui/presenter.cpp firmware/components/ui/time_roller.cpp \
tests/cpp/test_ui_foundation.cpp -o $(UI_FOUNDATION_TEST_BINARY)
$(UI_FOUNDATION_TEST_BINARY)

navigation-test:
mkdir -p build/host
$(CXX) -std=c++17 -Wall -Wextra -Werror -pedantic \
-Ifirmware/components/domain/include \
-Ifirmware/components/settings/include \
-Ifirmware/components/ui/include \
firmware/components/ui/foundation.cpp \
firmware/components/ui/navigation.cpp \
firmware/components/ui/presenter.cpp \
firmware/components/ui/presenter.cpp firmware/components/ui/time_roller.cpp \
tests/cpp/test_navigation.cpp -o $(NAVIGATION_TEST_BINARY)
$(NAVIGATION_TEST_BINARY)

Expand Down
8 changes: 4 additions & 4 deletions firmware/components/logger/formats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ bool valid_settings_record(const SessionSettingsV1& record) noexcept
}

settings::DeviceSettings source{};
source.session_duration_minutes = record.session_duration_minutes;
source.rest_duration_minutes = record.rest_duration_minutes;
source.session_duration_seconds = record.session_duration_seconds;
source.rest_duration_seconds = record.rest_duration_seconds;
source.launch_sensitivity_milli_g = record.launch_sensitivity_milli_g;
source.average_lap_seconds = record.average_lap_seconds;
source.day_brightness_percent = record.day_brightness_percent;
Expand All @@ -137,8 +137,8 @@ bool valid_settings_record(const SessionSettingsV1& record) noexcept
SessionSettingsV1 make_session_settings(const settings::DeviceSettings& source) noexcept
{
SessionSettingsV1 result{};
result.session_duration_minutes = source.session_duration_minutes;
result.rest_duration_minutes = source.rest_duration_minutes;
result.session_duration_seconds = source.session_duration_seconds;
result.rest_duration_seconds = source.rest_duration_seconds;
result.launch_sensitivity_milli_g = source.launch_sensitivity_milli_g;
result.average_lap_seconds = source.average_lap_seconds;
result.day_brightness_percent = source.day_brightness_percent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@

namespace track_timer::logger {

inline constexpr std::uint16_t kLogFormatVersion = 1;
// 2: session and rest durations widened from uint16 minutes to uint32 seconds, which
// changes both the meaning and the size of every meta record. Logs written before this
// are rejected by their version rather than silently misread as very short sessions.
inline constexpr std::uint16_t kLogFormatVersion = 2;
inline constexpr std::int64_t kUnavailableUtcNs = -1;
inline constexpr std::size_t kSessionIdentifierCapacity = 32;
inline constexpr std::size_t kFirmwareCommitCapacity = 41;
Expand Down Expand Up @@ -79,8 +82,8 @@ enum DegradedSubsystemFlag : std::uint32_t {

struct SessionSettingsV1 {
std::uint16_t settings_schema_version{settings::kCurrentSettingsVersion};
std::uint16_t session_duration_minutes{0};
std::uint16_t rest_duration_minutes{0};
std::uint32_t session_duration_seconds{0};
std::uint32_t rest_duration_seconds{0};
std::uint16_t launch_sensitivity_milli_g{0};
std::uint16_t average_lap_seconds{0};
std::uint8_t day_brightness_percent{0};
Expand Down
Loading