diff --git a/flake.lock b/flake.lock index 049e276..af85ee8 100644 --- a/flake.lock +++ b/flake.lock @@ -59,11 +59,11 @@ ] }, "locked": { - "lastModified": 1775585728, - "narHash": "sha256-8Psjt+TWvE4thRKktJsXfR6PA/fWWsZ04DVaY6PUhr4=", + "lastModified": 1781733627, + "narHash": "sha256-U3yTuGBnmXvXoQI3qkpfEDsn9RovQPAjN7ndRco+3u0=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "580633fa3fe5fc0379905986543fd7495481913d", + "rev": "3bbec39bc90eadfa031e6f3b77272f3f60803e39", "type": "github" }, "original": { @@ -147,11 +147,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1776329215, - "narHash": "sha256-a8BYi3mzoJ/AcJP8UldOx8emoPRLeWqALZWu4ZvjPXw=", + "lastModified": 1781607440, + "narHash": "sha256-rxO+uc/KFbSJp+pgyXRuAX6QlG9hJdnt0BXpEQRXY+U=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b86751bc4085f48661017fa226dee99fab6c651b", + "rev": "3e41b24abd260e8f71dbe2f5737d24122f972158", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a333dcb..8ff7b7d 100644 --- a/flake.nix +++ b/flake.nix @@ -606,10 +606,17 @@ runtimeInputs = [ pkgs.cppcheck ]; text = '' cd "''${1:-.}" + # zephyr_hardware.cpp gates the battery-check ADC code on Zephyr + # devicetree macros (DT_NODE_EXISTS/DT_PATH/DT_NODE_HAS_PROP) in a + # #if. Standalone cppcheck has no DT headers to expand them; + # cppcheck >= 2.21 hard-errors (syntaxError) on the unevaluatable + # condition where older versions assumed 0. Real syntax is checked + # by the Zephyr compiler in the smoke-build gate. cppcheck --enable=warning,performance,portability \ --std=c++20 --error-exitcode=1 --force \ --suppress=missingIncludeSystem \ --suppress=normalCheckLevelMaxBranches \ + --suppress=syntaxError:src/zephyr_hardware.cpp \ src/*.cpp src/*.hpp ''; }; diff --git a/src/beacon_logic.hpp b/src/beacon_logic.hpp index a6cb471..de5b5b3 100644 --- a/src/beacon_logic.hpp +++ b/src/beacon_logic.hpp @@ -24,12 +24,12 @@ bool is_key_empty(const uint8_t* key, size_t len); /// Input to the status computation (replaces all globals). struct StatusInput { - StatusFlags status; // Decoded status configuration - uint16_t battery_voltage; // Battery voltage in millivolts (e.g. 3800 = 3.8V) - uint16_t keys_changes; // Rolling counter of AirTag key rotations (used by mode 2) - uint8_t what_in_status; // Telemetry cycle selector: 0=voltage, 1=accel, 2=temperature - uint8_t accel_byte; // 7-bit movement summary from MovementTracker::compute_accel_byte() - int16_t temperature; // Accelerometer die temperature in 0.1C units (e.g. 235 = 23.5C) + StatusFlags status; // Decoded status configuration + uint16_t battery_voltage = 0; // Battery voltage in millivolts (e.g. 3800 = 3.8V) + uint16_t keys_changes = 0; // Rolling counter of AirTag key rotations (used by mode 2) + uint8_t what_in_status = 0; // Telemetry cycle selector: 0=voltage, 1=accel, 2=temperature + uint8_t accel_byte = 0; // 7-bit movement summary from MovementTracker::compute_accel_byte() + int16_t temperature = 0; // Accelerometer die temperature in 0.1C units (e.g. 235 = 23.5C) }; /// Output of the status computation.