From ff2d840ad65cfc72246de9c6abb10a6644858d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:43:28 +0100 Subject: [PATCH 01/32] plan: requirement abstraction rules (spec not plan, no test info, helper tests, bench sheets) Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index fb5d224..e6eeb8f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -74,6 +74,16 @@ This project uses Requirement-Based Development. **Every code change must origin - Every Unity test function must carry a `// @req FUNC-DOMAIN-NNN` tag on the line above it. - ID format: `FUNC-DOMAIN-NNN` (e.g. `FUNC-OREGON-001`, `TECH-HAL-001`). +Requirements are a spec, not a plan. Each one passes four checks: +1. **Observable** from outside the unit (radio output, pins, screen, serial lines, build result), or a design constraint that has a reason (testability, memory, no hardware access). +2. **Survives a refactor**: no class, method, file or register name, except at a boundary interface (`Hal`, `ReceiverHal`, `runCycle`, build flags, environments). +3. **States its reason** when it is not obvious. +4. **Verifiable on its own**. +- The "how" (classes, helpers, registers, file layout) goes in `docs/architecture.md` and code comments. +- **No test information in a requirement**: no "Verification:", "Test:", "Verified by", "native test", "bench check pending". Input → output examples that define the behaviour stay, as "Examples:". +- A helper's unit tests are tagged with the requirement whose behaviour uses the helper (`dec16ToHex` tests → FUNC-X10-006/007). +- A requirement no software test can cover gets a bench test sheet `tests/bench/.md` (requirement link, equipment, setup, steps, pass criteria, results table filled at each run); `tests/bench/bring-up.md` gives the order. + To start a new requirement: invoke `/rbd` and describe the intent. The workflow dispatches `requirement-analyst` → `test-builder` → `code-builder` in sequence. Every report in `audits/` (`/rbd-audit`, `/rbd-review`) states on its first line under the title the full hash of the commit it audited (`Audited commit:` or `Reviewed commit:`), so `git diff ..HEAD -- requirements docs emitter lib tinyDecoders` shows what changed since the last audit. From 5f7b71a018e15c6a1125aacbb773dd88148bac1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:43:51 +0100 Subject: [PATCH 02/32] req(PLAT-POWER-008,PLAT-ISP-001,PLAT-DEBUG-001): awake pin states (from TECH-HAL-004), ISP with the sensor fitted (R9/R10), debug UART (from TECH-SERIAL-001) Co-Authored-By: Claude Opus 5.5 --- requirements/platform.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/requirements/platform.md b/requirements/platform.md index 447ae60..4d06715 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -67,6 +67,33 @@ --- +### PLAT-POWER-008 +**Title:** While awake, no internal pull-up on PORTA, the floating MISO input buffer off, PB2 and PB3 pulled up, unused peripherals off +**Status:** validated +**Dependencies:** [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-007](#plat-power-007) +**derives_from:** [PLAT-POWER-007](#plat-power-007) +**Description:** From reset until the first sleep, and between sleeps, the ATtiny84A enables no internal pull-up on any PORTA pin. PA0 and PA1 are analog inputs, PA2 (`SENSOR_VCC`) and PA7 are outputs, and PA3, PA4 and PA6 are bus pins pulled up externally to `SENSOR_VCC` ([PLAT-POWER-007](#plat-power-007)). While PA2 is low (at boot, at wake before the sensors are powered, after they are powered off), an internal pull-up on a bus pin would drive current through the external pull-up into PA2 and back-power the sensors. PA5 (MISO) has no pull-up at all. It reaches the ISP header J6 and pad 3 of the BME280 SDO jumper JP6, which v3.0 delivers open: bridged 1–2, SDO goes to GND and the sensor answers at I2C address 0x76, the one the firmware reads; bridged 2–3, SDO follows PA5, for SPI. The PA5 digital input buffer is disabled, so the floating pin draws no current in the input stage; reset enables it again, so ISP programming is unaffected. PB2 and PB3 (RESET) are pulled up, the ATtiny84A having no PB4–PB7, except PB2 with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)). PB0 (radio data) and PB1 (LED) are outputs. The analog comparator and Timer1 stay off, and the ADC is on only while it measures. + +--- + +### PLAT-ISP-001 +**Title:** A v3.0 board is flashed over ISP with its I2C sensor fitted +**Status:** validated +**Dependencies:** [PLAT-POWER-007](#plat-power-007) +**derives_from:** [PLAT-POWER-007](#plat-power-007) +**Description:** The ISP lines SCK (PA4) and MOSI (PA6) are also the I2C SCL and SDA. On v3.0, the sensor connector reaches them through 330 Ω series resistors, R9 on SCL and R10 on SDA, with the sensor pull-ups on the connector side ([PLAT-POWER-007](#plat-power-007)), while the ISP header J6 is wired directly to the MCU pins. The programmer therefore drives SCK and MOSI without the sensor loading them, and the board is flashed with the BME280 in place; the sensor still reads correctly through the resistors afterwards. v2.2 boards have no such resistors: their sensor is removed before flashing. + +--- + +### PLAT-DEBUG-001 +**Title:** Debug serial output: transmit only on PA7, 9600 baud 8N1, line idle high +**Status:** validated +**Dependencies:** [PLAT-POWER-005](#plat-power-005) +**derives_from:** [PLAT-POWER-005](#plat-power-005) +**Description:** The emitter's debug serial output is a software UART on PA7: 9600 baud, each byte a low start bit, 8 data bits least significant first, then a high stop bit. The line is idle high from the start of the output. Numbers are written as text, in decimal unless another base is asked for, and a written line ends with `\r\n`. There is no receive path. The bit time is calibrated for the 1 MHz clock ([PLAT-POWER-005](#plat-power-005)). + +--- + ### PLAT-DECODE-003 **Title:** Receiver captures radio pulses on ICP1 (PB0/D8 on the Pro Mini, PD4 on the Pro Micro) with Timer1 at 0.5 µs and counts seconds from its overflow **Status:** validated From 02985037236d0ee14af79c49e6e2edd3e5a917c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:44:45 +0100 Subject: [PATCH 03/32] test(FUNC-X10-005,FUNC-X10-006,FUNC-X10-007,PLAT-POWER-004,PLAT-DEBUG-001): retag helper and HAL tests to the behaviour they cover (TECH-X10-001/002, HAL-002, HAL-005, CONVERT-001, SERIAL-001) Co-Authored-By: Claude Opus 5.5 --- .../conversionToolsTest.cpp | 3 +- emitter/test/test_led/ledTest.cpp | 4 +- .../test/test_softSerial/softSerialTest.cpp | 12 +++--- .../test/test_x10_hal/x10HalTimingTest.cpp | 37 +++++++++---------- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/emitter/test/test_conversionTools/conversionToolsTest.cpp b/emitter/test/test_conversionTools/conversionToolsTest.cpp index c09f2b5..2f37e43 100644 --- a/emitter/test/test_conversionTools/conversionToolsTest.cpp +++ b/emitter/test/test_conversionTools/conversionToolsTest.cpp @@ -23,7 +23,8 @@ void tearDown() {} void setUp() {} -// @req TECH-CONVERT-001 +// @req FUNC-X10-006 +// @req FUNC-X10-007 void Test_dec16ToHex() { struct TestData { uint16_t given; diff --git a/emitter/test/test_led/ledTest.cpp b/emitter/test/test_led/ledTest.cpp index db0c64e..1ae6d22 100644 --- a/emitter/test/test_led/ledTest.cpp +++ b/emitter/test/test_led/ledTest.cpp @@ -29,14 +29,14 @@ void setUp() {} #include #include -// @req TECH-HAL-005 +// @req PLAT-POWER-004 void Expect_led_can_switch_on() { Attiny84aHal hal; hal.LedOn(); TEST_ASSERT((PORTB & PB1) == PB1); } -// @req TECH-HAL-005 +// @req PLAT-POWER-004 void Expect_led_can_switch_off() { Attiny84aHal hal; hal.LedOff(); diff --git a/emitter/test/test_softSerial/softSerialTest.cpp b/emitter/test/test_softSerial/softSerialTest.cpp index b22bc18..a316e87 100644 --- a/emitter/test/test_softSerial/softSerialTest.cpp +++ b/emitter/test/test_softSerial/softSerialTest.cpp @@ -46,7 +46,7 @@ static void DecodeFrames(std::string &decoded) { } } -// @req TECH-SERIAL-001 +// @req PLAT-DEBUG-001 void Expect_begin_sets_line_idle_high() { SoftSerial serial(&TestHal); serial.begin(); @@ -54,7 +54,7 @@ void Expect_begin_sets_line_idle_high() { TEST_ASSERT_EQUAL_CHAR('S', TestHal.Orders[0]); } -// @req TECH-SERIAL-001 +// @req PLAT-DEBUG-001 void Expect_byte_frame_is_start_lsb_first_data_stop() { SoftSerial serial(&TestHal); serial.print((uint8_t)0x41); // 'A' = 0b01000001 @@ -64,7 +64,7 @@ void Expect_byte_frame_is_start_lsb_first_data_stop() { TEST_ASSERT_EQUAL_CHAR_ARRAY(expected, TestHal.Orders.data(), FRAME_LEN); } -// @req TECH-SERIAL-001 +// @req PLAT-DEBUG-001 void Expect_string_is_sent_frame_by_frame() { SoftSerial serial(&TestHal); serial.print("Vbatt: "); @@ -73,7 +73,7 @@ void Expect_string_is_sent_frame_by_frame() { TEST_ASSERT_EQUAL_STRING("Vbatt: ", decoded.c_str()); } -// @req TECH-SERIAL-001 +// @req PLAT-DEBUG-001 void Expect_numbers_are_sent_as_decimal_text() { SoftSerial serial(&TestHal); serial.print(0); @@ -88,7 +88,7 @@ void Expect_numbers_are_sent_as_decimal_text() { TEST_ASSERT_EQUAL_STRING("0 3712 -42 4294967295", decoded.c_str()); } -// @req TECH-SERIAL-001 +// @req PLAT-DEBUG-001 void Expect_base_argument_selects_radix() { SoftSerial serial(&TestHal); serial.print(255L, 16); @@ -101,7 +101,7 @@ void Expect_base_argument_selects_radix() { TEST_ASSERT_EQUAL_STRING("FF 101 A", decoded.c_str()); } -// @req TECH-SERIAL-001 +// @req PLAT-DEBUG-001 void Expect_println_appends_crlf() { SoftSerial serial(&TestHal); serial.println("ok"); diff --git a/emitter/test/test_x10_hal/x10HalTimingTest.cpp b/emitter/test/test_x10_hal/x10HalTimingTest.cpp index 180e4f1..8e35077 100644 --- a/emitter/test/test_x10_hal/x10HalTimingTest.cpp +++ b/emitter/test/test_x10_hal/x10HalTimingTest.cpp @@ -18,7 +18,7 @@ */ /* - * Integration tests for TECH-X10-001 and TECH-X10-002. + * Integration tests for the X10 waveform timings of FUNC-X10-005. * * Production side must provide (code-builder handles this): * @@ -85,10 +85,10 @@ static int countToken(const std::vector &orders, } // --------------------------------------------------------------------------- -// TECH-X10-001 — TestHal_ exposes five distinct X10 timing tokens +// TestHal_ exposes five distinct X10 timing tokens // --------------------------------------------------------------------------- -// @req TECH-X10-001 +// @req FUNC-X10-005 void TestHal_DelayX10PreambleHigh_appends_distinct_token() { // Given TestHal.ClearOrders(); @@ -104,7 +104,7 @@ void TestHal_DelayX10PreambleHigh_appends_distinct_token() { "DelayX10PreambleHigh must append exactly one token"); } -// @req TECH-X10-001 +// @req FUNC-X10-005 void TestHal_DelayX10PreambleLow_appends_distinct_token() { // Given TestHal.ClearOrders(); @@ -120,7 +120,7 @@ void TestHal_DelayX10PreambleLow_appends_distinct_token() { "DelayX10PreambleLow must append exactly one token"); } -// @req TECH-X10-001 +// @req FUNC-X10-005 void TestHal_DelayX10BitShort_appends_distinct_token() { // Given TestHal.ClearOrders(); @@ -136,7 +136,7 @@ void TestHal_DelayX10BitShort_appends_distinct_token() { "DelayX10BitShort must append exactly one token"); } -// @req TECH-X10-001 +// @req FUNC-X10-005 void TestHal_DelayX10BitLong_appends_distinct_token() { // Given TestHal.ClearOrders(); @@ -152,7 +152,7 @@ void TestHal_DelayX10BitLong_appends_distinct_token() { "DelayX10BitLong must append exactly one token"); } -// @req TECH-X10-001 +// @req FUNC-X10-005 void TestHal_DelayX10Gap_appends_distinct_token() { // Given TestHal.ClearOrders(); @@ -167,8 +167,7 @@ void TestHal_DelayX10Gap_appends_distinct_token() { "DelayX10Gap must append exactly one token"); } -// @req TECH-X10-001 -// @req TECH-HAL-002 +// @req FUNC-X10-005 void TestHal_X10_tokens_are_all_distinct() { // Given // Each token must differ from every other token @@ -195,10 +194,10 @@ void TestHal_X10_tokens_are_all_distinct() { } // --------------------------------------------------------------------------- -// TECH-X10-002 — x10rf::SendCommand uses HAL for preamble and gap delays +// x10rf::SendCommand uses HAL for preamble and gap delays // --------------------------------------------------------------------------- -// @req TECH-X10-002 +// @req FUNC-X10-005 void SendCommand_uses_hal_preamble_high_delay() { // Given // A minimal 1-byte message; 1 repeat so we get exactly one preamble @@ -218,7 +217,7 @@ void SendCommand_uses_hal_preamble_high_delay() { "(token 'Q' expected)"); } -// @req TECH-X10-002 +// @req FUNC-X10-005 void SendCommand_uses_hal_preamble_low_delay() { // Given TestHal.ClearOrders(); @@ -234,7 +233,7 @@ void SendCommand_uses_hal_preamble_low_delay() { "SendCommand must call DelayX10PreambleLow via Hal (token 'R' expected)"); } -// @req TECH-X10-002 +// @req FUNC-X10-005 void SendCommand_uses_hal_gap_delay_after_transmission() { // Given TestHal.ClearOrders(); @@ -250,7 +249,7 @@ void SendCommand_uses_hal_gap_delay_after_transmission() { "SendCommand must call DelayX10Gap via Hal (token 'G' expected)"); } -// @req TECH-X10-002 +// @req FUNC-X10-005 void SendCommand_preamble_sequence_is_high_then_low() { // Given // The X10 preamble must be: RadioGoHigh, DelayX10PreambleHigh, @@ -289,7 +288,7 @@ void SendCommand_preamble_sequence_is_high_then_low() { "DelayX10PreambleLow must follow RadioGoLow"); } -// @req TECH-X10-002 +// @req FUNC-X10-005 void SendX10RfBit_zero_uses_hal_bit_short_delays_no_long() { // Given // A zero bit must generate: RadioGoHigh, BitShort, RadioGoLow, BitShort @@ -318,7 +317,7 @@ void SendX10RfBit_zero_uses_hal_bit_short_delays_no_long() { "Multiple DelayX10BitShort tokens expected for zero-bit data"); } -// @req TECH-X10-002 +// @req FUNC-X10-005 void SendX10RfBit_one_uses_hal_bit_long_delay() { // Given // Sending 0xFF forces all 8 bits to 1, each needing @@ -337,7 +336,6 @@ void SendX10RfBit_one_uses_hal_bit_long_delay() { "SendX10RfBit for a 1-bit must emit DelayX10BitLong (token 'U')"); } -// @req TECH-X10-002 // @req FUNC-X10-005 void SendCommand_gap_appears_once_per_repeat() { // Given @@ -357,7 +355,6 @@ void SendCommand_gap_appears_once_per_repeat() { "rf_repeats=2)"); } -// @req TECH-X10-002 // @req FUNC-X10-005 void SendCommand_preamble_appears_once_per_repeat() { // Given @@ -393,7 +390,7 @@ void tearDown(void) {} int main(int, char **) { UnityBegin("x10HalTimingTest.cpp"); - // TECH-X10-001: TestHal_ token contract + // TestHal_ token contract RUN_TEST(TestHal_DelayX10PreambleHigh_appends_distinct_token); RUN_TEST(TestHal_DelayX10PreambleLow_appends_distinct_token); RUN_TEST(TestHal_DelayX10BitShort_appends_distinct_token); @@ -401,7 +398,7 @@ int main(int, char **) { RUN_TEST(TestHal_DelayX10Gap_appends_distinct_token); RUN_TEST(TestHal_X10_tokens_are_all_distinct); - // TECH-X10-002: x10rf uses HAL for all timing + // x10rf uses HAL for all timing RUN_TEST(SendCommand_uses_hal_preamble_high_delay); RUN_TEST(SendCommand_uses_hal_preamble_low_delay); RUN_TEST(SendCommand_uses_hal_gap_delay_after_transmission); From d4563d058988fa9c6740a06745d3f6db8ca67ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:44:45 +0100 Subject: [PATCH 04/32] test(FUNC-DECODE-001,UI-DECODE-001,UI-DECODE-003): retag loopback and lux unit tests (TECH-DECODE-001, TECH-DECODE-004) Co-Authored-By: Claude Opus 5.5 --- tinyDecoders/test/test_loopback/loopbackTest.cpp | 9 +++++---- tinyDecoders/test/test_luxunit/luxUnitTest.cpp | 9 +++++---- .../test/test_pageformatter/pageFormatterTest.cpp | 2 +- .../test/test_rflinkformatter/rflinkFormatterTest.cpp | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tinyDecoders/test/test_loopback/loopbackTest.cpp b/tinyDecoders/test/test_loopback/loopbackTest.cpp index cd9e458..8a22569 100644 --- a/tinyDecoders/test/test_loopback/loopbackTest.cpp +++ b/tinyDecoders/test/test_loopback/loopbackTest.cpp @@ -1,6 +1,7 @@ /* - * Integration tests for TECH-DECODE-001: OrdersToPulses() converts TestHal_ - * Orders tokens into {high, durationUs} pulses. + * Integration tests of the loopback helper the decoder tests (FUNC-DECODE-001 + * to 005) rely on: OrdersToPulses() converts TestHal_ Orders tokens into {high, + * durationUs} pulses. * * Production side must provide (code-builder handles this), in * tinyDecoders/lib/Loopback/Loopback.h: @@ -62,7 +63,7 @@ static const TokenCase tokenCases[] = { {"saturates-at-65535", "HGG", {{true, 65535}}}, }; -// @req TECH-DECODE-001 +// @req FUNC-DECODE-001 void OrdersToPulses_converts_hand_written_tokens() { for (const TokenCase &c : tokenCases) { // Given @@ -76,7 +77,7 @@ void OrdersToPulses_converts_hand_written_tokens() { } } -// @req TECH-DECODE-001 +// @req FUNC-DECODE-001 void OrdersToPulses_loops_back_x10_rfxmeter_frame() { // Given // one repeat of a 6-byte RFXmeter frame: preamble (2 pulses), 48 data bits diff --git a/tinyDecoders/test/test_luxunit/luxUnitTest.cpp b/tinyDecoders/test/test_luxunit/luxUnitTest.cpp index 2551599..cb0caf3 100644 --- a/tinyDecoders/test/test_luxunit/luxUnitTest.cpp +++ b/tinyDecoders/test/test_luxunit/luxUnitTest.cpp @@ -1,6 +1,7 @@ /* - * Integration tests for TECH-DECODE-004: the lux unit cell is the character - * LuxUnit, shared by FormatPage and the Font8x16 readers. + * Integration tests for the lux unit cell (UI-DECODE-001, UI-DECODE-003): the + * lux unit cell is the character LuxUnit, shared by FormatPage and the Font8x16 + * readers. * * Production side must provide (code-builder handles this), in * tinyDecoders/lib/Font8x16/Font8x16.h: @@ -31,7 +32,7 @@ static const LuxCase luxCases[] = { {"five-digits", 65535, 5}, }; -// @req TECH-DECODE-004 +// @req UI-DECODE-001 void FormatPage_puts_LuxUnit_right_after_the_lux_digits() { TEST_ASSERT_EQUAL_CHAR('\x01', LuxUnit); for (const LuxCase &c : luxCases) { @@ -48,7 +49,7 @@ void FormatPage_puts_LuxUnit_right_after_the_lux_digits() { } } -// @req TECH-DECODE-004 +// @req UI-DECODE-003 void ReadGlyph_gives_a_blank_glyph_for_LuxUnit() { // Given static const uint8_t blank[16] = {0}; diff --git a/tinyDecoders/test/test_pageformatter/pageFormatterTest.cpp b/tinyDecoders/test/test_pageformatter/pageFormatterTest.cpp index 691acf6..c3ac1b2 100644 --- a/tinyDecoders/test/test_pageformatter/pageFormatterTest.cpp +++ b/tinyDecoders/test/test_pageformatter/pageFormatterTest.cpp @@ -21,7 +21,7 @@ // Degree glyph; kept a separate literal so "\x7F" never eats a hex digit #define DEG "\x7F" -// Lux unit cell, LuxUnit in Font8x16.h (TECH-DECODE-004) +// Lux unit cell, LuxUnit in Font8x16.h (UI-DECODE-003) #define UNIT "\x01" static const uint8_t T = SourceRecord::Temperature; diff --git a/tinyDecoders/test/test_rflinkformatter/rflinkFormatterTest.cpp b/tinyDecoders/test/test_rflinkformatter/rflinkFormatterTest.cpp index 1455b85..c62e9f8 100644 --- a/tinyDecoders/test/test_rflinkformatter/rflinkFormatterTest.cpp +++ b/tinyDecoders/test/test_rflinkformatter/rflinkFormatterTest.cpp @@ -1,7 +1,7 @@ /* * Integration tests for FUNC-DECODE-008: FormatRflink renders the frame a * decoder just completed as one RFLink text line. Frames come from the - * repository encoders through OrdersToPulses (TECH-DECODE-001). + * repository encoders through OrdersToPulses. * * Production side must provide (code-builder handles this), in * tinyDecoders/lib/RflinkFormatter/RflinkFormatter.h ( and the From 02cbdea910d0ff24756ae048ecb11fa1e2d0d58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:45:29 +0100 Subject: [PATCH 05/32] refactor: remove unused AnalogFilter and dec32ToHex with their tests (no production caller; TECH-FILTER-001/002, TECH-CONVERT-002) Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- emitter/platformio.ini | 2 +- .../analogFilteringTest.cpp | 115 ------------------ .../conversionToolsTest.cpp | 28 ----- lib/utils/include/AnalogFilter.h | 40 ------ lib/utils/include/conversionTools.h | 9 -- lib/utils/src/AnalogFilter.cpp | 20 --- lib/utils/src/conversionTools.cpp | 19 --- 8 files changed, 2 insertions(+), 233 deletions(-) delete mode 100644 emitter/test/test_analogFiltering/analogFilteringTest.cpp delete mode 100644 lib/utils/include/AnalogFilter.h delete mode 100644 lib/utils/src/AnalogFilter.cpp diff --git a/CLAUDE.md b/CLAUDE.md index e6eeb8f..e5c27c3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,7 +54,7 @@ Protocol encoders receive a `Hal*` at construction and call only HAL methods — Tests run on the host (`-e native_debug` and the `native_cycle_*` environments, `-DNATIVE`). The test harness instantiates `TestHal_` and passes it to the encoder under test. Protocol correctness is verified by checking the `Orders` vector against expected character sequences — e.g., a zero bit must produce `{'H','D','L','P','H','D'}`. This verifies timing ordering without hardware. -Test suites: `test_oregon`, `test_lacrosseWS7000`, `test_x10`, `test_conversionTools`, `test_analogFiltering`, `test_power`, `test_led`, `test_softSerial`, `test_ds18b20`, `test_x10_hal`, `test_environment`, `test_main_cycle` (only in `native_cycle_*`). +Test suites: `test_oregon`, `test_lacrosseWS7000`, `test_x10`, `test_conversionTools`, `test_power`, `test_led`, `test_softSerial`, `test_ds18b20`, `test_x10_hal`, `test_environment`, `test_main_cycle` (only in `native_cycle_*`). ### `src/main.cpp` diff --git a/emitter/platformio.ini b/emitter/platformio.ini index 6a5052d..7618378 100644 --- a/emitter/platformio.ini +++ b/emitter/platformio.ini @@ -40,7 +40,7 @@ board_build.mcu = attiny84a lib_deps = platform = native build_type = debug -debug_test = test_analogFiltering +debug_test = test_conversionTools debug_build_flags = -O0 -ggdb3 -g3 build_flags = -DSLEEP_TIME_IN_SECONDS=32 diff --git a/emitter/test/test_analogFiltering/analogFilteringTest.cpp b/emitter/test/test_analogFiltering/analogFilteringTest.cpp deleted file mode 100644 index 8320eba..0000000 --- a/emitter/test/test_analogFiltering/analogFilteringTest.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is part of the TinySensor distribution - * (https://github.com/arcadien/TinySensor) - * - * Copyright (c) 2019 Aurélien Labrosse - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include - -void tearDown() {} -void setUp() {} - -// @req TECH-FILTER-001 -void Expected_exclusion_to_exclude_value() { - AnalogFilter filter(1, 3); - filter.Push(10); - filter.Push(0); - filter.Push(0); - filter.Push(0); - TEST_ASSERT_EQUAL(0, filter.Get()); -} - -// @req TECH-FILTER-001 -void Expected_zero_exclusion_to_not_exclude() { - AnalogFilter filter(0, 3); - filter.Push(2); - filter.Push(3); - filter.Push(4); - TEST_ASSERT_EQUAL(3, filter.Get()); -} - -// @req TECH-FILTER-001 -void Expected_filter_to_mean_actual_values() { - AnalogFilter filter(0, 3); - filter.Push(2); - filter.Push(4); - TEST_ASSERT_EQUAL(3, filter.Get()); -} - -// @req TECH-FILTER-001 -void Expected_filter_to_mean_values_and_floor_result() { - AnalogFilter filter(0, 4); - filter.Push(1); - filter.Push(2); - filter.Push(3); - filter.Push(4); - TEST_ASSERT_EQUAL(2, filter.Get()); -} -// @req TECH-FILTER-002 -void Expected_filter_to_ignore_supernumerary_values() { - AnalogFilter filter(0, 2); - filter.Push(2); - filter.Push(2); - filter.Push(3); // supernumerary - filter.Push(4); // supernumerary - TEST_ASSERT_EQUAL(2, filter.Get()); -} - -// @req TECH-FILTER-001 -void Expected_filter_to_account_exclusion() { - AnalogFilter filter(2, 4); - filter.Push(2); - filter.Push(2); - filter.Push(4); - filter.Push(4); - TEST_ASSERT_EQUAL(4, filter.Get()); -} - -int runUnityTests(void) { - UNITY_BEGIN(); - RUN_TEST(Expected_exclusion_to_exclude_value); - RUN_TEST(Expected_zero_exclusion_to_not_exclude); - RUN_TEST(Expected_filter_to_mean_values_and_floor_result); - RUN_TEST(Expected_filter_to_mean_actual_values); - RUN_TEST(Expected_filter_to_ignore_supernumerary_values); - RUN_TEST(Expected_filter_to_account_exclusion); - - return UNITY_END(); -} - -/** - * For native dev-platform or for some embedded frameworks - */ -int main(int, char **) { - return runUnityTests(); -} - -/** - * For Arduino framework - */ -void setup() { - // Wait ~2 seconds before the Unity test runner - // establishes connection with a board Serial interface - //__delay_ms(2000); -} - -void loop() { - runUnityTests(); - UNITY_END(); -} diff --git a/emitter/test/test_conversionTools/conversionToolsTest.cpp b/emitter/test/test_conversionTools/conversionToolsTest.cpp index 2f37e43..3d81aae 100644 --- a/emitter/test/test_conversionTools/conversionToolsTest.cpp +++ b/emitter/test/test_conversionTools/conversionToolsTest.cpp @@ -49,36 +49,8 @@ void Test_dec16ToHex() { TEST_ASSERT_EQUAL_UINT16(testData.expected, actual); } } -// @req TECH-CONVERT-002 -void Test_dec32ToHex() { - struct TestData { - uint32_t given; - uint32_t expected; - }; - - // clang-format off - TestData testDatas[] = { - {0, 0}, - {5, 5}, - {4200, 0x4200}, - {999999, 0x999999}, - {99999999, 0x99999999}, // max - {99999999+1, 0xA0000000}, // overflow - - }; - // clang-format on - - uint8_t testCount = sizeof(testDatas) / sizeof(TestData); - for (uint8_t testCounter = 0; testCounter < testCount; testCounter++) { - TestData testData = testDatas[testCounter]; - uint32_t actual = ConversionTools::dec32ToHex(testData.given); - TEST_ASSERT_EQUAL_UINT32(testData.expected, actual); - } -} - int main(int, char **) { UNITY_BEGIN(); RUN_TEST(Test_dec16ToHex); - RUN_TEST(Test_dec32ToHex); return UNITY_END(); } diff --git a/lib/utils/include/AnalogFilter.h b/lib/utils/include/AnalogFilter.h deleted file mode 100644 index 69cfe32..0000000 --- a/lib/utils/include/AnalogFilter.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include - -/** - * @brief Accumulate and mean values with exclusion behavior - * - */ -class AnalogFilter { - private: - uint8_t exclusion; - uint8_t samples; - uint8_t actualValuesCount; - uint16_t accumulator; - - public: - /** - * Create a filter able to accumulate up to 'samples' values (max 255), and - * ignore 'exclusion' first values - */ - AnalogFilter(uint8_t exclusion, uint8_t samples) - : exclusion(exclusion), - samples(samples), - actualValuesCount(0), - accumulator(0) {} - - /** - * @brief Push a value in the accumulator - * - * @param value - */ - void Push(uint16_t value); - - /** - * @brief return current accumulator value divided by expected sample count - * - * @return uint16_t - */ - uint16_t Get(); -}; diff --git a/lib/utils/include/conversionTools.h b/lib/utils/include/conversionTools.h index 3020c2e..306616a 100644 --- a/lib/utils/include/conversionTools.h +++ b/lib/utils/include/conversionTools.h @@ -10,13 +10,4 @@ namespace ConversionTools { */ uint16_t dec16ToHex(uint16_t input); -/* - * Returns base 16 value of a given integer - * - * Ex. 4200 -> 0x4200 (16896) - * - * Note: max convertable value is 99999999 - */ -uint32_t dec32ToHex(uint32_t input); - } // namespace ConversionTools \ No newline at end of file diff --git a/lib/utils/src/AnalogFilter.cpp b/lib/utils/src/AnalogFilter.cpp deleted file mode 100644 index 5e58e76..0000000 --- a/lib/utils/src/AnalogFilter.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -void AnalogFilter::Push(uint16_t value) { - if (exclusion == 0) { - if (actualValuesCount < (samples + exclusion)) { - accumulator += value; - actualValuesCount++; - } - } else { - exclusion--; - } -} - -uint16_t AnalogFilter::Get() { - uint16_t result = 0; - if (actualValuesCount > 0) { - result = (uint16_t)(accumulator / actualValuesCount); - } - return result; -} diff --git a/lib/utils/src/conversionTools.cpp b/lib/utils/src/conversionTools.cpp index 2c72e79..407cbd7 100644 --- a/lib/utils/src/conversionTools.cpp +++ b/lib/utils/src/conversionTools.cpp @@ -24,23 +24,4 @@ uint16_t dec16ToHex(uint16_t input) { return result; } -uint32_t dec32ToHex(uint32_t input) { - uint32_t result = 0; - static const uint8_t FACTOR_COUNT = 7; - static const uint32_t factors[FACTOR_COUNT] = { - 10, 100, 1000, 10000, 100000, 1000000, 10000000}; - - for (uint8_t i = FACTOR_COUNT; i > 0; i--) { - uint32_t factor = factors[i - 1]; - uint8_t howManyPow10 = (input / factor); - if (howManyPow10 > 0) { - result += (howManyPow10 & 0x0f) << (i * 4); - input -= (howManyPow10 * factor); - } - } - if (input > 0) { - result += (input & 0x0f); - } - return result; -} } // namespace ConversionTools \ No newline at end of file From f72a5455bee34dd9915ba74dd33ded39457d6097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:46:13 +0100 Subject: [PATCH 06/32] req(TECH-HAL-001,TECH-HAL-006,TECH-MAIN-001,TECH-DECODE-002,TECH-DECODE-003): reword as design constraints with their reason; deprecate the plan-level TECH requirements (HAL-002..005, HAL-007, FILTER, CONVERT, SERIAL-001, X10, SENSOR-002, DECODE-001/004/005) Deprecated: TECH-HAL-002..005, TECH-HAL-007, TECH-FILTER-001..002, TECH-CONVERT-001..002, TECH-SERIAL-001, TECH-X10-001..002, TECH-SENSOR-002, TECH-DECODE-001, TECH-DECODE-004, TECH-DECODE-005. Co-Authored-By: Claude Opus 5.5 --- requirements/technical.md | 89 ++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 44 deletions(-) diff --git a/requirements/technical.md b/requirements/technical.md index 126e932..963bb1e 100644 --- a/requirements/technical.md +++ b/requirements/technical.md @@ -2,124 +2,125 @@ + ### TECH-HAL-001 -**Title:** Encoders and sensor wrappers that use the HAL receive Hal* at construction; no direct AVR register access +**Title:** Protocol and sensor logic reach the hardware only through the injected `Hal` interface, so it runs unchanged in native builds **Status:** validated **Dependencies:** — -**Description:** Every protocol encoder (`OregonV3`, `LacrosseWS7000`, `x10rf`, `SoftSerial`) and every sensor wrapper that performs hardware timing or I/O itself (`Ds18b20`, `LightSensor`) must accept a `Hal*` at construction and must use only `Hal` methods for that I/O. A sensor wrapper whose hardware access is entirely delegated to a third-party bus driver (`BMx280`) takes no `Hal*`. Direct access to AVR registers (`PORTA`, `PORTB`, `ADCSRA`, etc.) is forbidden outside `Attiny84aHal`, except register addresses passed as arguments to a third-party bus driver. Verification: inspection; outside `Attiny84aHal`, the only AVR registers in `emitter/` and `lib/` are the addresses `Ds18b20` passes to the ds18b20 driver. +**Description:** Every protocol encoder, and every sensor wrapper that times or drives I/O itself, gets the hardware through a `Hal*` given at construction (`lib/hal/Hal.h`, the boundary between the firmware logic and the MCU) and touches no AVR register. So the same code builds and runs on the host against a test double. Only the AVR implementation of `Hal` accesses registers, with one exception: register addresses passed as arguments to a third-party bus driver. A wrapper whose I/O is entirely done by a third-party driver takes no `Hal*`. --- ### TECH-HAL-002 **Title:** TestHal_ records each HAL call as a single-character token in the Orders vector -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001) -**Description:** `TestHal_` appends one character per call to its `Orders` vector: `H`=`RadioGoHigh`, `L`=`RadioGoLow`, `D`=`Delay512Us`, `P`=`Delay1024Us`, `A`=`Delay400Us`, `S`=`SerialWriteBit(true)`, `W`=`SerialWriteBit(false)`, `I`=`Init` ([TECH-HAL-006](#tech-hal-006)), `Q`=`DelayX10PreambleHigh`, `R`=`DelayX10PreambleLow`, `T`=`DelayX10BitShort`, `U`=`DelayX10BitLong`, `G`=`DelayX10Gap`. Protocol tests verify correctness by asserting against expected `Orders` sequences. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md). The test double's token alphabet is test infrastructure; its tests are tagged with the behaviour they check. --- ### TECH-HAL-003 **Title:** ComputeVccMv and ConvertAnalogValueToMv are non-virtual concrete methods on the Hal base class -**Status:** validated +**Status:** deprecated **Dependencies:** — -**Description:** `Hal::ComputeVccMv(uint16_t known11refValue)` and `Hal::ConvertAnalogValueToMv(uint16_t adcReading, uint16_t vccInMv)` are implemented directly on `Hal` and are not overridden by any subclass. Both `Attiny84aHal` and `TestHal_` inherit them unchanged. Verification: inspection; `test_power` calls both methods on `TestHal_` through the base class. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the VCC and pin voltage formulas are [FUNC-BATTERY-001](functional.md#func-battery-001). --- ### TECH-HAL-004 **Title:** Attiny84aHal constructor disables Timer1, ADC, and analog comparator; no pull-up on PORTA, PA5 digital input buffer off, pull-ups on PB2 and PB3 -**Status:** validated +**Status:** deprecated **Dependencies:** [PLAT-POWER-007](platform.md#plat-power-007) -**Description:** `Attiny84aHal()` calls `UseLessPowerAsPossible()`, which sets `DDRA`/`DDRB` to 0, sets `PORTA = 0` (no internal pull-up on any PORTA pin) and `PORTB = 0b11111100` (pull-ups on PB2 and PB3, the only other PORTB pins: PB4–PB7 don't exist on the ATtiny84A; PB0 and PB1 are then made outputs for the radio and the LED; with `USE_SWITCHED_5V`, PB2's pull-up is cleared again, [TECH-HAL-007](#tech-hal-007), [PLAT-POWER-006](platform.md#plat-power-006)), disables the analog comparator (`ACSR|=ACD`), disables Timer1 (`PRR|=PRTIM1`), clears `ADCSRA` and disables the ADC (`PRR|=PRADC`). Brownout detection is disabled before each sleep period by `sleep()`, not here ([TECH-HAL-007](#tech-hal-007)). PORTA has no unused pin: PA0/PA1 are analog inputs, PA2 (`SENSOR_VCC`) and PA7 are outputs, and PA3–PA6 are the sensor bus pins, PA3/PA4/PA6 pulled up externally to `SENSOR_VCC` ([PLAT-POWER-007](platform.md#plat-power-007)). PA5 (MISO) has no pull-up at all. It reaches the ISP header J6 and pad 3 of the BME280 SDO jumper JP6, and reaches the sensor SDO only when JP6 is bridged 2–3. On v3.0, JP6 is delivered open and one side is bridged at assembly: 1–2 ties SDO to GND, which gives I2C address 0x76, the address the firmware reads; 2–3 ties SDO to PA5, for SPI, and in I2C mode SDO would then follow the floating PA5 and the address would be undefined. The constructor disables its digital input buffer (`DIDR0` bit `ADC5D`, next to `ADC1D` and `ADC2D`), so the floating pin draws no current in the input stage while awake; ISP programming is not affected, since `DIDR0` is cleared by reset. While the MCU is awake with PA2 low (boot and wake before the sensors are powered, after they are powered off before sleep), an internal pull-up on PA3–PA6 would drive current through the external pull-ups into PA2 and back-power the sensors. Verification: AVR only, no native test (`TestHal_` has no registers): inspection and the AVR builds; bench check pending: BME280 read with the external pull-ups only, once the mushroom is reflashed with this firmware (to do with the v3.0 R9/R10 330 Ω check). +**Description:** Deprecated 2026-11-20: the awake pin states and their reason are now [PLAT-POWER-008](platform.md#plat-power-008); the constructor details are in [docs/architecture.md](../docs/architecture.md). --- ### TECH-HAL-005 **Title:** LedOn and LedOff toggle PORTB PB1 on AVR hardware and toggle IsLedOn in TestHal_ -**Status:** validated +**Status:** deprecated **Dependencies:** — -**Description:** `Attiny84aHal::LedOn()` sets bit `PB1` in `PORTB`; `LedOff()` clears it. In `TestHal_`, `LedOn()` sets `IsLedOn = true` and `LedOff()` sets `IsLedOn = false`. The `test_led` suite verifies this boolean toggle. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the LED behaviour is [PLAT-POWER-004](platform.md#plat-power-004). --- ### TECH-HAL-006 -**Title:** runCycle calls Hal::Init (I2C bus set-up) once, as its first HAL call, before sensor power-on +**Title:** Each cycle initialises the sensor bus once, before powering the sensors **Status:** validated **Dependencies:** [TECH-MAIN-001](#tech-main-001), [PLAT-POWER-003](platform.md#plat-power-003) -**Description:** `runCycle(Hal*)` calls `hal->Init()` exactly once per cycle, as its first `Hal` call, before `PowerOnSensors()` and so before any sensor access. `main()` does not call `Init()`. `Attiny84aHal::Init()` calls `TinyI2C.init()` when compiled with `USE_I2C` and is a no-op otherwise. Running it every cycle re-initialises the USI after `Hibernate()` stopped its clock with `PRUSI` ([PLAT-POWER-003](platform.md#plat-power-003)). `TestHal_::Init()` appends `'I'` to `Orders`; `I2CIsConfigured` is removed. In every `native_cycle_*` env, `test_main_cycle` checks that `'I'` is the first token of the cycle and appears exactly once. +**Description:** The first `Hal` call of every cycle is `Init()`, made exactly once per cycle, before the sensors are powered and so before any sensor access. It sets up the I2C bus on builds that use one and does nothing otherwise. It runs every cycle because hibernate stops the bus peripheral ([PLAT-POWER-003](platform.md#plat-power-003)). --- ### TECH-HAL-007 **Title:** Attiny84aHal names the PLAT-POWER behaviour: Hibernate, PowerOnSensors / PowerOffSensors, TRANSMIT_WITH_LED -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-HAL-004](#tech-hal-004), [TECH-HAL-005](#tech-hal-005), [PLAT-POWER-001](platform.md#plat-power-001), [PLAT-POWER-002](platform.md#plat-power-002), [PLAT-POWER-004](platform.md#plat-power-004), [PLAT-POWER-006](platform.md#plat-power-006) -**Description:** `Attiny84aHal::Hibernate(s)` calls the file-static `sleep(s)` of `lib/hal/Attiny84aHal.cpp`, which computes `s >> 3` (minimum 1) watchdog periods, saves / restores PRR, DDRA, DDRB, PORTA and PORTB, and right before each sleep instruction runs the timed BOD-disable sequence (`sleep_bod_disable()`: BODS and BODSE, then BODS alone, then `sleep_cpu()` within 3 cycles) ([PLAT-POWER-001](platform.md#plat-power-001), [PLAT-POWER-003](platform.md#plat-power-003)). `PowerOnSensors()` drives PA2 high and `PowerOffSensors()` low ([PLAT-POWER-002](platform.md#plat-power-002)); with `USE_SWITCHED_5V`, the constructor clears `PORTB.2`, `PowerOnSensors()` sets `DDRB.2` and `PowerOffSensors()` clears it ([PLAT-POWER-006](platform.md#plat-power-006)). In `emitter/src/main.cpp`, the macro `TRANSMIT_WITH_LED(code)` expands to `hal->LedOn()`, `code`, `hal->LedOff()`, `hal->Delay30ms()`, and wraps every `Send()` of the cycle ([PLAT-POWER-004](platform.md#plat-power-004)). `Delay512Us`, `Delay1024Us`, `Delay400Us` and `Delay30ms` are calibrated for 1 MHz ([PLAT-POWER-005](platform.md#plat-power-005)). Verification: inspection of `lib/hal/Attiny84aHal.cpp` and `emitter/src/main.cpp`; `test_main_cycle` records the LED and 30 ms delay calls around every frame in the cycle HAL sequence, and the AVR builds compile the AVR side. +**Description:** Deprecated 2026-11-20: it only named the code behind [PLAT-POWER-001](platform.md#plat-power-001) to 006, now in [docs/architecture.md](../docs/architecture.md). --- ### TECH-FILTER-001 **Title:** AnalogFilter discards the first `exclusion` values then accumulates up to `samples` values and returns their integer floor mean -**Status:** validated +**Status:** deprecated **Dependencies:** — -**Description:** `AnalogFilter::Push(value)` decrements `exclusion` and discards the value until `exclusion` reaches zero; thereafter it accumulates values into `accumulator` up to `samples` count. `Get()` returns `accumulator / actualValuesCount` (integer division), or 0 if no values were accumulated. +**Description:** Deprecated 2026-11-20: `AnalogFilter` had no production caller and was removed. --- ### TECH-FILTER-002 **Title:** Values pushed to AnalogFilter after the samples count is reached are silently ignored -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-FILTER-001](#tech-filter-001) -**Description:** Once `actualValuesCount` equals `samples`, subsequent `Push()` calls do nothing: the accumulator is not modified and `actualValuesCount` is not incremented. `Get()` continues to return the mean of the first `samples` values only. +**Description:** Deprecated 2026-11-20: `AnalogFilter` had no production caller and was removed. --- ### TECH-CONVERT-001 **Title:** dec16ToHex returns the BCD hex representation of a uint16_t with each decimal digit in one nibble -**Status:** validated +**Status:** deprecated **Dependencies:** — -**Description:** `ConversionTools::dec16ToHex(n)` packs each decimal digit of `n` into one nibble of the returned `uint16_t` (e.g. 4200 → `0x4200`). Inputs above 9999 saturate to `0x9999` (the largest 4-digit BCD value) instead of overflowing. +**Description:** Deprecated 2026-11-20: helper detail; the BCD encoding it serves is [FUNC-X10-006](functional.md#func-x10-006) and [FUNC-X10-007](functional.md#func-x10-007). --- ### TECH-CONVERT-002 **Title:** dec32ToHex returns the 32-bit BCD hex representation of a uint32_t with each decimal digit in one nibble -**Status:** validated +**Status:** deprecated **Dependencies:** — -**Description:** `ConversionTools::dec32ToHex(n)` packs each decimal digit of `n` into one nibble of the returned `uint32_t` (e.g. 1234567 → `0x01234567`). Inputs above 99,999,999 cause the most-significant nibble to overflow silently; no error is raised. +**Description:** Deprecated 2026-11-20: `dec32ToHex` had no production caller and was removed. --- ### TECH-SERIAL-001 **Title:** SoftSerial transmits output-only UART at 9600 baud using the SerialWriteBit HAL call -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001) -**Description:** `SoftSerial` accepts a `Hal*` at construction and drives UART output exclusively via `SerialWriteBit(level)`, one call per bit (start bit low, 8 data bits LSB first, stop bit high; `begin()` sets the idle level high). `SoftSerial` itself performs no delay: `SerialWriteBit` sets the line level and holds it for one bit period, `(1 000 000 / 9600) − 25` µs on AVR (`SERIAL_BIT_PERIOD_US` in `lib/hal/Attiny84aHal.cpp`, the −25 µs compensating the per-bit call overhead at 1 MHz). No receive path is implemented. +**Description:** Deprecated 2026-11-20: the debug serial output is now [PLAT-DEBUG-001](platform.md#plat-debug-001); the `SoftSerial` / `SerialWriteBit` split is in [docs/architecture.md](../docs/architecture.md). --- ### TECH-SERIAL-002 **Title:** Debug logging via SoftSerial is compiled only when USE_SERIAL_LOG is defined **Status:** draft -**Dependencies:** [TECH-SERIAL-001](#tech-serial-001) -**Description:** When `USE_SERIAL_LOG` is defined, `emitter/src/main.cpp` includes `SoftSerial.h`, instantiates `SoftSerial swSerial(&hal)`, and implements `SerialPrintInfo(name, value, unit)` using it. When `USE_SERIAL_LOG` is absent, `SerialPrintInfo` is a no-op inline function and `SoftSerial` is not instantiated. Verification: inspection; no build environment sets `USE_SERIAL_LOG`, so the logging path is not compiled in CI. +**Dependencies:** [PLAT-DEBUG-001](platform.md#plat-debug-001) +**Description:** When `USE_SERIAL_LOG` is defined, `emitter/src/main.cpp` includes `SoftSerial.h`, instantiates `SoftSerial swSerial(&hal)`, and implements `SerialPrintInfo(name, value, unit)` using it. When `USE_SERIAL_LOG` is absent, `SerialPrintInfo` is a no-op inline function and `SoftSerial` is not instantiated. --- ### TECH-X10-001 **Title:** Hal must expose five timing methods for X10 RF signal intervals -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001) -**Description:** The `Hal` interface must declare five new pure-virtual methods for X10 RF timing: `DelayX10PreambleHigh()` (8960 µs), `DelayX10PreambleLow()` (4500 µs), `DelayX10BitShort()` (560 µs), `DelayX10BitLong()` (1120 µs), and `DelayX10Gap()` (40000 µs). `Attiny84aHal` must implement each with the corresponding `_delay_us()` call calibrated to `F_CPU = 1 000 000`. `TestHal_` must implement each by appending a distinct single-character token to `Orders`. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the X10 timings are [FUNC-X10-005](functional.md#func-x10-005). --- ### TECH-X10-002 **Title:** x10rf must call only Hal timing methods for all delays; direct _delay_us() calls are forbidden -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-X10-001](#tech-x10-001) -**Description:** `x10rf::SendCommand()` and `x10rf::SendX10RfBit()` must replace all calls to the file-static `x10_*` delay functions with direct calls to the corresponding `Hal` methods (`DelayX10PreambleHigh()`, `DelayX10PreambleLow()`, `DelayX10BitShort()`, `DelayX10BitLong()`, `DelayX10Gap()`). The `#if defined(AVR)` block defining those static functions and including `` must be removed entirely from `lib/x10/x10rf.cpp`. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the X10 timings are [FUNC-X10-005](functional.md#func-x10-005), and [TECH-HAL-001](#tech-hal-001) keeps all timing behind the HAL. --- @@ -133,46 +134,46 @@ ### TECH-SENSOR-002 **Title:** BMx280 wraps BMP280 and BME280 behind one class; stubs return 0 on native builds -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001), [FUNC-SENSOR-001](functional.md#func-sensor-001) -**Description:** Class `BMx280` (`emitter/include/BMx280.h`) exposes `Begin()`, `GetTemperature()` (°C), `GetPressure()` (Pa), `GetHumidity()` (%) and `Shutdown()` (sensor sleep mode). On AVR it forwards to the SparkFun BME280 library at I2C address 0x76; on non-AVR targets every method is a stub and the getters return 0. It takes no `Hal*` ([TECH-HAL-001](#tech-hal-001)). Verification: inspection of `emitter/include/BMx280.h`; the AVR builds compile the SparkFun side, and the native builds (`test_main_cycle`) link the stubs. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the sensor behaviour is [FUNC-SENSOR-001](functional.md#func-sensor-001), and [TECH-HAL-001](#tech-hal-001) covers wrappers built on a third-party driver. --- ### TECH-MAIN-001 -**Title:** One measurement/transmission cycle is a standalone runCycle(Hal*) callable from native tests +**Title:** One measurement and transmission cycle is a standalone `runCycle(Hal*)`, so the whole cycle runs in native builds **Status:** validated **Dependencies:** [TECH-HAL-001](#tech-hal-001) -**Description:** One complete cycle (sensor power-on, measurement, transmissions, sensor power-off, hibernate) is a free function `void runCycle(Hal* hal)` declared in `emitter/include/main.h`. Every `Hal` call it makes, directly or through the encoders and sensor wrappers it uses, goes to the injected `hal`. For every build variant family, the HAL call sequence after the leading `Init()` ([TECH-HAL-006](#tech-hal-006)) equals the reference sequence the native cycle test builds directly from the encoders: power on, sensor reads, X10 meters, luminosity, the environment frame twice ([FUNC-MAIN-001](functional.md#func-main-001)), power off, hibernate. `main()` only calls `runCycle` in an endless loop, and is excluded from test builds. Dedicated native test environments with zero sleep time exercise `runCycle` for each build variant family: Oregon with divided battery, Oregon with battery equal to VCC, Oregon with a battery divider and without pressure, Lacrosse, and no environment protocol. +**Description:** A complete cycle (sensor power-on, measurement, transmissions, sensor power-off, hibernate) is the free function `void runCycle(Hal* hal)` (`emitter/include/main.h`). Every `Hal` call it makes, directly or through the encoders and sensor wrappers it uses, goes to the injected `hal`. After the leading `Init()` ([TECH-HAL-006](#tech-hal-006)), its calls come in this order: power on, sensor reads, X10 meters, luminosity, the environment frame twice ([FUNC-MAIN-001](functional.md#func-main-001)), power off, hibernate. The firmware entry point only calls `runCycle` in an endless loop and is left out of native builds. --- ### TECH-DECODE-001 **Title:** Loopback helper converts TestHal_ Orders into level/duration pulses for decoder tests -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-HAL-002](#tech-hal-002), [TECH-X10-001](#tech-x10-001) -**Description:** A native-only function `OrdersToPulses()` in `tinyDecoders/lib/Loopback/` converts a `TestHal_::Orders` token sequence into an ordered list of pulses `{bool high; uint16_t durationUs}`. The line starts low. `H` and `L` set the level; each delay token adds its nominal duration to the current level: `A`=400, `D`=512, `P`=1024, `T`=560, `U`=1120, `Q`=8960, `R`=4500, `G`=40000 µs (saturating at 65535). A pulse is emitted at each level change and after the last token; zero-duration pulses are not emitted. Other tokens are ignored. It runs in the `native` env of `tinyDecoders/platformio.ini`, which builds the repository `lib/` encoders. +**Description:** Deprecated 2026-11-20: test helper, described in [docs/architecture.md](../docs/architecture.md); its tests are tagged with [FUNC-DECODE-001](functional.md#func-decode-001). ### TECH-DECODE-002 -**Title:** Receiver hardware is a compile-time ReceiverHal alias injected by pointer, with a native test double +**Title:** Receiver hardware is reached only through a compile-time `ReceiverHal` interface given by pointer, with a native test double **Status:** validated **Dependencies:** [TECH-DECODE-001](#tech-decode-001) -**Description:** `tinyDecoders/lib/ReceiverHal/ReceiverHal.h` defines `typedef AtmegaReceiverHal ReceiverHal` when `__AVR_ATmega328P__` or `__AVR_ATmega32U4__` is defined, `typedef TestReceiverHal ReceiverHal` when `AVR` is not defined, and an `#error` otherwise (no virtual call, as `EnvironmentEncoder`); `AtmegaReceiverHal.cpp` is guarded by these two MCU macros. Both classes expose `bool PopPulse(bool& high, uint16_t& durationUs)` (oldest ended pulse, false when none), `uint32_t NowSeconds() const`, `void DrawChar(uint8_t page, uint8_t col, char c)` (8x16 cell on display pages `page` and `page + 1`, page 0–2, col 0–15), `void DrawBigChar(uint8_t col, char c)` (16x32 cell spanning both rows at pixel column `16*col`, col 0–5), `static const bool HasLineOutput` and `void WriteLine(const char* line)` (one text line without terminator). `AtmegaReceiverHal`: `HasLineOutput = true`. Native-only `TestReceiverHal` (`TestReceiverHal.h`, `HasLineOutput = true`) adds `PushPulse(high, durationUs)` (FIFO), `SetNowSeconds(s)`, `const char* Row(uint8_t page) const` (page 0–2, 16 characters, initially spaces, updated by `DrawChar` at that start page), `const char* Big() const` (6 characters, initially spaces, updated by `DrawBigChar`), `uint16_t DrawCount() const` (counts both draws) and `const std::vector& Lines() const` (each `WriteLine` appends its line). Components needing the hardware receive a `ReceiverHal*` at construction and touch no AVR register. Test: double FIFO order, `Row` and `Big` after draws, `DrawCount` after one draw of each, `Lines` after two `WriteLine`. +**Description:** The receiver logic gets the hardware through a `ReceiverHal*` given at construction and touches no AVR register. `ReceiverHal` is chosen at compile time, without virtual call: the ATmega implementation on the ATmega328P and ATmega32U4, a test double on native builds; any other target fails to compile. Its operations: pop the oldest ended pulse (level, duration in µs; false when none), read the current second, draw an 8x16 cell (text page 0–2, column 0–15), draw a 16x32 cell (column 0–5), and, when the compile-time `HasLineOutput` is true, write one text line without terminator. The test double lets a caller push pulses, set the time, and read back the drawn cells, the number of draws and the written lines. ### TECH-DECODE-003 -**Title:** Receiver logic is plain C++ without dynamic allocation: decoders, SourceTable, RflinkFormatter and Receiver +**Title:** Receiver logic is plain C++ without dynamic allocation or `printf`, independent of the hardware **Status:** validated **Dependencies:** [TECH-DECODE-002](#tech-decode-002) -**Description:** Classes `X10Decoder`, `LacrosseDecoder` and `OregonDecoder` (`tinyDecoders/lib//.h`, default constructor, `` only: no `Hal`, no AVR register) expose `bool Feed(bool high, uint16_t durationUs)`, true when a frame is decoded, and const getters valid until the next true: `Address()`, `Value()` (X10); `Type()`, `Address()`, `TemperatureTenths()`, `HumidityTenths()`, `PressureTenths()`, `Lux()` (Lacrosse); `DeviceId()`, `Channel()`, `RollingCode()`, `BatteryLow()`, `TemperatureTenths()`, `HumidityPercent()`, `PressureHpa()` (Oregon). `tinyDecoders/lib/SourceTable/SourceTable.h` (`` and the decoder headers only, no dynamic allocation) defines `struct SourceRecord { Kind kind; uint8_t id; uint8_t code; uint8_t fields; int16_t temperatureTenths; uint16_t humidityTenths; uint16_t pressureTenths; uint16_t lux; uint16_t millivolts; uint32_t lastSeenSeconds; }` (18 B), `enum Kind : uint8_t { Oregon, Lacrosse, LacrosseLux, X10 }`, `fields` a bitmask `Temperature=1, Humidity=2, Pressure=4, Lux=8, Millivolts=16`, and class `SourceTable` (`kCapacity` 16 when `AVR` is defined, else 8; 16 × 18 = 288 B of RAM on the Pro Mini and the Pro Micro) with `Update(const &, uint32_t nowSeconds)` per decoder, `Expire(uint32_t nowSeconds)`, `Count()` and `At(uint8_t index)`. `tinyDecoders/lib/RflinkFormatter/RflinkFormatter.h` (`` and the decoder headers only, no `printf`, no dynamic allocation) defines `RflinkLineSize = 64` and `uint8_t FormatRflink(const &, uint8_t counter, char line[RflinkLineSize])` per decoder, writing the line plus `'\0'` and returning its length. Class `Receiver` (`tinyDecoders/lib/Receiver/Receiver.h`, `explicit Receiver(ReceiverHal* hal)`, owns the three decoders and a `SourceTable`) exposes `void Poll()`, which pops pulses with `PopPulse`, reads time with `NowSeconds`, draws with `DrawChar` / `DrawBigChar` and writes lines with `WriteLine` ([TECH-DECODE-002](#tech-decode-002)); it calls `FormatRflink` only when the compile-time `ReceiverHal::HasLineOutput` is true, so the formatter is not linked otherwise. Verification: the [FUNC-DECODE-001](functional.md#func-decode-001) to 010 native tests use this API; the promini and promicro builds ([CONF-DECODE-002](configuration.md#conf-decode-002)) compile it for AVR. +**Description:** The decoders, the source table, the RFLink formatter, the page formatter and the receiver loop depend only on ``, on each other and on `ReceiverHal` ([TECH-DECODE-002](#tech-decode-002)): no `Hal`, no AVR register, no dynamic allocation, no `printf`. They therefore run unchanged in native builds, and their RAM use is fixed at build time: the source table holds 16 sources on AVR, about 288 B, which fits the Pro Mini and the Pro Micro, and 8 in native builds. The RFLink formatter is linked only when `ReceiverHal::HasLineOutput` is true. ### TECH-DECODE-004 **Title:** FormatPage, ReadGlyph and ReadBigGlyphPage build the OLED cells without dynamic allocation -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-DECODE-003](#tech-decode-003), [UI-DECODE-001](ui.md#ui-decode-001), [UI-DECODE-002](ui.md#ui-decode-002), [UI-DECODE-003](ui.md#ui-decode-003) -**Description:** Free function `void FormatPage(const SourceRecord& record, bool alternate, char big[7], char top[5], char bottom[5])` (`tinyDecoders/lib/PageFormatter/PageFormatter.h`, no dynamic allocation, no `printf`) writes the [UI-DECODE-001](ui.md#ui-decode-001) fields, 6, 4 and 4 characters plus `'\0'`, space-filled; the degree sign is `'\x7F'`, and the lux unit cell is the character `LuxUnit` (`'\x01'`, declared in `Font8x16.h`) right after the lux digits (`"65535\x01"`, `"1000\x01 "`). Free function `void ReadGlyph(char c, uint8_t glyph[16])` (`tinyDecoders/lib/Font8x16/Font8x16.h`) copies the 8x16 glyph from a `PROGMEM` table (on native, `PROGMEM` is empty and reads are plain loads), about 32 × 17 = 544 B of flash. Bytes 0–7 are columns 0–7 of the top 8 pixel rows, bytes 8–15 the bottom 8 rows, bit 0 the top pixel: the SSD1306 page layout. The table is produced by `tinyDecoders/scripts/gen_font8x16.py `, with the Spleen licence text in the generated file header. Free function `void ReadBigGlyphPage(char c, uint8_t page, uint8_t bytes[16])` (same header) writes page `page` (0–3, top to bottom) of the 16x32 glyph from `ReadGlyph(c)`, without RAM or flash table: with `s` = glyph byte `(page / 2) * 8 + x / 2` and `n` its low nibble (even page) or high nibble (odd page), bits `2i` and `2i+1` of `bytes[x]` are both bit `i` of `n`. For `LuxUnit`, pages 0–1 are zeros, and page `p` = 2 or 3 holds bytes `(p − 2) * 8` to `(p − 2) * 8 + 7` of `ReadGlyph('l')` in `bytes[0..7]` and of `ReadGlyph('x')` in `bytes[8..15]`. `ReadGlyph(LuxUnit)` is blank. The receiver draws the unit cell with `DrawBigChar` like any big cell, so `Receiver` and `ReceiverHal` are unchanged. Verification: the [UI-DECODE-001](ui.md#ui-decode-001) to 003 native tests call these three functions; the promini and promicro builds compile the `PROGMEM` table for AVR. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the screen content is [UI-DECODE-001](ui.md#ui-decode-001) to 003. ### TECH-DECODE-005 **Title:** Arduino receiver: shared entry point, and AtmegaReceiverHal built on Timer1 interrupts, Wire and Serial -**Status:** validated +**Status:** deprecated **Dependencies:** [TECH-DECODE-002](#tech-decode-002), [TECH-DECODE-003](#tech-decode-003), [PLAT-DECODE-003](platform.md#plat-decode-003), [PLAT-DECODE-004](platform.md#plat-decode-004), [PLAT-DECODE-005](platform.md#plat-decode-005), [CONF-DECODE-003](configuration.md#conf-decode-003), [CONF-DECODE-004](configuration.md#conf-decode-004) -**Description:** `tinyDecoders/src/main.cpp`, the only file in `src/` (so no environment sets `build_src_filter`), defines `hal` (`AtmegaReceiverHal`) and `receiver` (`Receiver`, built on `&hal`) at file scope; `setup()` calls `hal.Init()` and `loop()` calls `receiver.Poll()`, under the Arduino `main`. `tinyDecoders/lib/ReceiverHal/AtmegaReceiverHal.{h,cpp}` is compiled only when `__AVR_ATmega328P__` or `__AVR_ATmega32U4__` is defined, and these macros pick the ICP1 pin. `Init()` sets up ICP1 and Timer1 ([PLAT-DECODE-003](platform.md#plat-decode-003)), calls `Wire.begin()`, `Wire.setClock(400000)` (`OledClockHz`) and sends the OLED set-up ([PLAT-DECODE-004](platform.md#plat-decode-004)), then `Serial.begin(57600)` ([PLAT-DECODE-005](platform.md#plat-decode-005)). `ISR(TIMER1_CAPT_vect)` pushes the ended pulse into the ring buffer, `ISR(TIMER1_OVF_vect)` advances the time base; `PopPulse` and `NowSeconds` read them inside `ATOMIC_BLOCK(ATOMIC_RESTORESTATE)`. `DrawChar` uses `ReadGlyph`, `DrawBigChar` uses `ReadBigGlyphPage` ([TECH-DECODE-004](#tech-decode-004)). `WriteLine(line)` drops the line when `Serial.availableForWrite()` is below its length + 2, else writes it then `\r\n`; `Serial`'s `operator bool`, which waits 10 ms on the Pro Micro, is never used. Verification: inspection, the promini and promicro builds ([CONF-DECODE-002](configuration.md#conf-decode-002)), and the bench checks of [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. +**Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the receiver hardware use is [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. From 8c5bf099e58f2d9cdbc1b3097c4ca591d727730e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:46:33 +0100 Subject: [PATCH 07/32] req(PLAT-POWER-001,PLAT-POWER-003..007,PLAT-DECODE-003..005): drop verification sentences, point to PLAT-POWER-008 and FUNC-X10-005 instead of deprecated TECH IDs Co-Authored-By: Claude Opus 5.5 --- requirements/platform.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/requirements/platform.md b/requirements/platform.md index 4d06715..d940838 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -2,14 +2,14 @@ - + ### PLAT-POWER-001 **Title:** Hibernate is s / 8 watchdog periods of power-down sleep, rounded down, at least one **Status:** validated -**Dependencies:** [TECH-HAL-004](technical.md#tech-hal-004) -**derives_from:** [TECH-HAL-004](technical.md#tech-hal-004) -**Description:** A hibernate of `s` seconds puts the ATtiny84A in power-down sleep for `s / 8` periods of the 8-second hardware watchdog, rounded down, and at least one: a request under 8 s still sleeps one period. Brownout detection is off during each sleep period. Verified by inspection (AVR only, no native test). +**Dependencies:** [PLAT-POWER-008](#plat-power-008) +**derives_from:** [PLAT-POWER-008](#plat-power-008) +**Description:** A hibernate of `s` seconds puts the ATtiny84A in power-down sleep for `s / 8` periods of the 8-second hardware watchdog, rounded down, and at least one: a request under 8 s still sleeps one period. Brownout detection is off during each sleep period. --- @@ -25,17 +25,17 @@ ### PLAT-POWER-003 **Title:** Hibernate stops USI, Timer0, Timer1 and ADC, holds the sensor rail and radio data low, leaves the sensor-rail pull-up pins unpulled; everything is restored on wake **Status:** validated -**Dependencies:** [PLAT-POWER-001](#plat-power-001), [PLAT-POWER-002](#plat-power-002), [TECH-HAL-004](technical.md#tech-hal-004) -**derives_from:** [TECH-HAL-004](technical.md#tech-hal-004) -**Description:** Before the first sleep period, the power reduction register stops the USI, Timer0, Timer1 and the ADC. PA2 (`SENSOR_VCC`) and PB0 (radio data, the radio being always powered) are outputs held low, so the sensor rail stays off and the transmitter cannot key itself from a floating input. PA3 (1-Wire), PA4 (SCL), PA5 (MISO) and PA6 (SDA) are inputs without internal pull-up: their external pull-ups go to `SENSOR_VCC`, or (PA5) they may reach the sensor SDO in SPI wiring, so an internal pull-up would back-power the unpowered sensors. A floating input costs nothing in power-down, where the input buffers are clamped. Every other pin is an input: PA0 and PA1 without pull-up, PB3 (RESET) pulled up, PB2 pulled up except with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)), and PA7 (digital output) and PB1 (LED) keep their last output level as pull-up state. After the last sleep period, PRR, DDRA, DDRB, PORTA and PORTB get back their values from before sleep. Verified by inspection (AVR only, no native test). +**Dependencies:** [PLAT-POWER-001](#plat-power-001), [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-008](#plat-power-008) +**derives_from:** [PLAT-POWER-008](#plat-power-008) +**Description:** Before the first sleep period, the power reduction register stops the USI, Timer0, Timer1 and the ADC. PA2 (`SENSOR_VCC`) and PB0 (radio data, the radio being always powered) are outputs held low, so the sensor rail stays off and the transmitter cannot key itself from a floating input. PA3 (1-Wire), PA4 (SCL), PA5 (MISO) and PA6 (SDA) are inputs without internal pull-up: their external pull-ups go to `SENSOR_VCC`, or (PA5) they may reach the sensor SDO in SPI wiring, so an internal pull-up would back-power the unpowered sensors. A floating input costs nothing in power-down, where the input buffers are clamped. Every other pin is an input: PA0 and PA1 without pull-up, PB3 (RESET) pulled up, PB2 pulled up except with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)), and PA7 (digital output) and PB1 (LED) keep their last output level as pull-up state. After the last sleep period, PRR, DDRA, DDRB, PORTA and PORTB get back their values from before sleep. --- ### PLAT-POWER-004 **Title:** Every radio transmission is framed by the LED: on before, off after, then a 30 ms pause **Status:** validated -**Dependencies:** [TECH-HAL-005](technical.md#tech-hal-005) -**derives_from:** [TECH-HAL-005](technical.md#tech-hal-005) +**Dependencies:** [FUNC-X10-005](functional.md#func-x10-005) +**derives_from:** [FUNC-X10-005](functional.md#func-x10-005) **Description:** A transmission is one frame of an encoder, with all its copies: the repeated copies of an X10 frame ([FUNC-X10-005](functional.md#func-x10-005)) are one transmission, while each luminosity copy ([FUNC-SENSOR-003](functional.md#func-sensor-003)) and each environment copy ([FUNC-MAIN-001](functional.md#func-main-001)) is its own transmission. Every transmission of a cycle turns the LED on before its first bit, turns it off after its last bit, then waits 30 ms; for an X10 frame, the 30 ms come after the 40 ms gap of its last copy. --- @@ -45,16 +45,16 @@ **Status:** validated **Dependencies:** [TECH-HAL-001](technical.md#tech-hal-001) **derives_from:** [TECH-HAL-001](technical.md#tech-hal-001) -**Description:** Every physical build environment runs an ATtiny84A at 1 MHz (`[env:avr_base]`: `board_build.mcu = attiny84a`, `board_build.f_cpu = 1000000L`). The 512 µs, 1024 µs, 400 µs and 30 ms delays are calibrated for this clock only. Verified by inspection of `emitter/platformio.ini` and by the AVR builds. +**Description:** Every physical build environment runs an ATtiny84A at 1 MHz (`[env:avr_base]`: `board_build.mcu = attiny84a`, `board_build.f_cpu = 1000000L`). The 512 µs, 1024 µs, 400 µs and 30 ms delays are calibrated for this clock only. --- ### PLAT-POWER-006 **Title:** With USE_SWITCHED_5V, PB2 is driven low only inside the sensor power window to switch the off-board 5 V module **Status:** validated -**Dependencies:** [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-003](#plat-power-003), [TECH-HAL-004](technical.md#tech-hal-004) +**Dependencies:** [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-003](#plat-power-003), [PLAT-POWER-008](#plat-power-008) **derives_from:** [FUNC-ANALOG-001](functional.md#func-analog-001) -**Description:** With `USE_SWITCHED_5V` (AVR build), PB2 (J8) switches the off-board 5 V module through a PNP (`hardware/tinysensor/VARIANTE_LM35.md`). PB2 is driven low while the sensors are powered ([PLAT-POWER-002](#plat-power-002)) and is an input without pull-up, in high impedance, the rest of the time, hibernate included. PB2 is never driven high. Without the flag, PB2 behaviour is unchanged. Verified by inspection and on the bench (AVR only, no native test). +**Description:** With `USE_SWITCHED_5V` (AVR build), PB2 (J8) switches the off-board 5 V module through a PNP (`hardware/tinysensor/VARIANTE_LM35.md`). PB2 is driven low while the sensors are powered ([PLAT-POWER-002](#plat-power-002)) and is an input without pull-up, in high impedance, the rest of the time, hibernate included. PB2 is never driven high. Without the flag, PB2 behaviour is unchanged. --- @@ -63,7 +63,7 @@ **Status:** validated **Dependencies:** [PLAT-POWER-002](#plat-power-002) **derives_from:** [FUNC-SENSOR-001](functional.md#func-sensor-001) -**Description:** Every board running this firmware has external pull-ups on its sensor buses, to `SENSOR_VCC`, the sensor rail switched by PA2: SCL (PA4) and SDA (PA6) for the I2C bus, and the 1-Wire bus (PA3), which serves the DS18B20. The firmware enables no internal pull-up on these pins ([TECH-HAL-004](technical.md#tech-hal-004)), so a board without them has no working I2C bus. On v3.0 they are three 4.7 kΩ resistors: R3 on SCL, R2 on SDA, R6 on 1-Wire; R3 and R2 sit on the sensor-connector side of the 330 Ω series resistors R9 (SCL) and R10 (SDA), which keep the ISP lines free of the sensor. Both buses are therefore unpowered whenever PA2 is low ([PLAT-POWER-002](#plat-power-002)). Verified by inspection of the v3.0 schematic (`hardware/tinysensor/tinysensor.kicad_sch`); on the v2.2 board (mushroom), the user checked on 2026-11-19 that its I2C pull-ups go to `SENSOR_VCC` (values not recorded); bench check pending: BME280 read with no internal pull-up once the mushroom runs this firmware. +**Description:** Every board running this firmware has external pull-ups on its sensor buses, to `SENSOR_VCC`, the sensor rail switched by PA2: SCL (PA4) and SDA (PA6) for the I2C bus, and the 1-Wire bus (PA3), which serves the DS18B20. The firmware enables no internal pull-up on these pins ([PLAT-POWER-008](#plat-power-008)), so a board without them has no working I2C bus. On v3.0 they are three 4.7 kΩ resistors: R3 on SCL, R2 on SDA, R6 on 1-Wire; R3 and R2 sit on the sensor-connector side of the 330 Ω series resistors R9 (SCL) and R10 (SDA), which keep the ISP lines free of the sensor. Both buses are therefore unpowered whenever PA2 is low ([PLAT-POWER-002](#plat-power-002)). The v2.2 board of the mushroom also has its I2C pull-ups on `SENSOR_VCC` (values not recorded). --- @@ -99,7 +99,7 @@ **Status:** validated **Dependencies:** [TECH-DECODE-002](technical.md#tech-decode-002) **derives_from:** [TECH-DECODE-002](technical.md#tech-decode-002) -**Description:** The receiver runs on an ATmega328P (Pro Mini 5 V / 16 MHz) or an ATmega32U4 (Pro Micro 5 V / 16 MHz); the only difference here is the ICP1 pin: PB0 (Pro Mini D8) or PD4 (Pro Micro pin 4). ICP1 is an input without pull-up: the RXB6 is powered at 5 V and drives it directly, without level shifting. Timer1 is fully reconfigured (Arduino only uses Timer0 for its time base): normal mode, prescaler 8 (0.5 µs ticks), noise canceller on, capture and overflow interrupts on, capture edge opposite to the current ICP1 level. Each capture ends a pulse (low when the captured edge rose), lasting the ticks since the previous capture / 2, or 65535 µs when a whole timer period has elapsed, then flips the edge. Ended pulses go into a 64-pulse buffer, which absorbs the I2C and serial waits; when it is full, the pulse is dropped. Each overflow adds 32768 µs to the time base, which counts one second per 1 000 000 µs. Pulses and time are read with interrupts briefly disabled. Verified by inspection and on the bench on both boards. +**Description:** The receiver runs on an ATmega328P (Pro Mini 5 V / 16 MHz) or an ATmega32U4 (Pro Micro 5 V / 16 MHz); the only difference here is the ICP1 pin: PB0 (Pro Mini D8) or PD4 (Pro Micro pin 4). ICP1 is an input without pull-up: the RXB6 is powered at 5 V and drives it directly, without level shifting. Timer1 is fully reconfigured (Arduino only uses Timer0 for its time base): normal mode, prescaler 8 (0.5 µs ticks), noise canceller on, capture and overflow interrupts on, capture edge opposite to the current ICP1 level. Each capture ends a pulse (low when the captured edge rose), lasting the ticks since the previous capture / 2, or 65535 µs when a whole timer period has elapsed, then flips the edge. Ended pulses go into a 64-pulse buffer, which absorbs the I2C and serial waits; when it is full, the pulse is dropped. Each overflow adds 32768 µs to the time base, which counts one second per 1 000 000 µs. Pulses and time are read with interrupts briefly disabled. --- @@ -108,7 +108,7 @@ **Status:** validated **Dependencies:** [TECH-DECODE-002](technical.md#tech-decode-002), [UI-DECODE-002](ui.md#ui-decode-002), [UI-DECODE-003](ui.md#ui-decode-003) **derives_from:** [TECH-DECODE-002](technical.md#tech-decode-002) -**Description:** The OLED is on the hardware TWI at 400 kHz: SDA A4 (PC4) and SCL A5 (PC5) on the Pro Mini, SDA D2 (PD1) and SCL D3 (PD0) on the Pro Micro. At start the receiver sends, in one transaction after control byte `0x00`, the SSD1306 set-up `AE D5 80 A8 1F D3 00 40 8D 14 20 02 A1 C8 DA 02 81 8F D9 F1 DB 40 A4 A6`, writes zeros to the 4 pages × 128 columns, then sends `AF`. An 8x16 character at text page `page` and column `col` is written on display pages `page` and `page + 1`: for each, commands `B0+page`, `col*8 & 0x0F`, `0x10 | (col*8 >> 4)` in one transaction, then `0x40` and the 8 glyph bytes in another. A 16x32 character at column `col` is written on pages 0 to 3: commands `B0+page`, `col*16 & 0x0F`, `0x10 | (col*16 >> 4)`, then `0x40` and the 16 bytes of that page of the big glyph (17 bytes, within the 32-byte I2C buffer of the Arduino core); about 2 ms at 400 kHz, short against the 64-pulse buffer of [PLAT-DECODE-003](#plat-decode-003). No display buffer is kept in RAM. The OLED module has its own regulator and accepts a 5 V supply and 5 V I2C levels, so it is wired directly to the 5 V board, without level shifting. Verified by inspection and on the bench on both boards. +**Description:** The OLED is on the hardware TWI at 400 kHz: SDA A4 (PC4) and SCL A5 (PC5) on the Pro Mini, SDA D2 (PD1) and SCL D3 (PD0) on the Pro Micro. At start the receiver sends, in one transaction after control byte `0x00`, the SSD1306 set-up `AE D5 80 A8 1F D3 00 40 8D 14 20 02 A1 C8 DA 02 81 8F D9 F1 DB 40 A4 A6`, writes zeros to the 4 pages × 128 columns, then sends `AF`. An 8x16 character at text page `page` and column `col` is written on display pages `page` and `page + 1`: for each, commands `B0+page`, `col*8 & 0x0F`, `0x10 | (col*8 >> 4)` in one transaction, then `0x40` and the 8 glyph bytes in another. A 16x32 character at column `col` is written on pages 0 to 3: commands `B0+page`, `col*16 & 0x0F`, `0x10 | (col*16 >> 4)`, then `0x40` and the 16 bytes of that page of the big glyph (17 bytes, within the 32-byte I2C buffer of the Arduino core); about 2 ms at 400 kHz, short against the 64-pulse buffer of [PLAT-DECODE-003](#plat-decode-003). No display buffer is kept in RAM. The OLED module has its own regulator and accepts a 5 V supply and 5 V I2C levels, so it is wired directly to the 5 V board, without level shifting. --- @@ -117,4 +117,4 @@ **Status:** validated **Dependencies:** [TECH-DECODE-002](technical.md#tech-decode-002) **derives_from:** [TECH-DECODE-002](technical.md#tech-decode-002) -**Description:** On the Pro Mini, the serial port is the hardware USART (TX D1/PD1, 57600 baud 8N1, interrupt-driven 128-byte transmit buffer set by [CONF-DECODE-004](configuration.md#conf-decode-004)): a debug output only, which works with or without a USB-serial adapter connected. On the Pro Micro it is the native USB CDC serial, whose rate is ignored. A line is followed by `\r\n`, and is dropped when the transmit buffer lacks room for it, so the receiver never waits for the serial port to drain, nor for a USB host on the Pro Micro. Incoming bytes are ignored and no startup banner is sent. Verified on the bench with `pio device monitor -b 57600` (through a USB-serial adapter on the Pro Mini). \ No newline at end of file +**Description:** On the Pro Mini, the serial port is the hardware USART (TX D1/PD1, 57600 baud 8N1, interrupt-driven 128-byte transmit buffer set by [CONF-DECODE-004](configuration.md#conf-decode-004)): a debug output only, which works with or without a USB-serial adapter connected. On the Pro Micro it is the native USB CDC serial, whose rate is ignored. A line is followed by `\r\n`, and is dropped when the transmit buffer lacks room for it, so the receiver never waits for the serial port to drain, nor for a USB host on the Pro Micro. Incoming bytes are ignored and no startup banner is sent. \ No newline at end of file From 1a3ac8e9782be34be8c694e0ca1bf0f23ed61761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:46:50 +0100 Subject: [PATCH 08/32] req(CONF-BUILD-003,CONF-BUILD-007,CONF-BUILD-011,CONF-BUILD-013..015,CONF-DECODE-002..004): drop verification and acceptance sentences, and links to deprecated TECH IDs Co-Authored-By: Claude Opus 5.5 --- requirements/configuration.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/requirements/configuration.md b/requirements/configuration.md index d22ce4f..f019bfe 100644 --- a/requirements/configuration.md +++ b/requirements/configuration.md @@ -2,7 +2,7 @@ - + ### CONF-BUILD-001 **Title:** Select at most one environment protocol per build @@ -20,7 +20,7 @@ **Title:** Set Oregon channel and rolling code per environment **Status:** validated **Dependencies:** [CONF-BUILD-001](#conf-build-001) -**Description:** An Oregon build sets `OREGON_CHANNEL` to 1, 2 or 3 and `OREGON_RCODE` to a rolling code 0x00–0xFF ([FUNC-OREGON-010](functional.md#func-oregon-010); the old 0xA5 limit came from the former layout that split the code over bytes 2 and 3). Every Oregon frame carries them ([FUNC-OREGON-009](functional.md#func-oregon-009), [FUNC-OREGON-010](functional.md#func-oregon-010)). Verification: inspection; the native cycle tests build Oregon variants with these flags but compare against frames built from the same values. +**Description:** An Oregon build sets `OREGON_CHANNEL` to 1, 2 or 3 and `OREGON_RCODE` to a rolling code 0x00–0xFF ([FUNC-OREGON-010](functional.md#func-oregon-010); the old 0xA5 limit came from the former layout that split the code over bytes 2 and 3). Every Oregon frame carries them ([FUNC-OREGON-009](functional.md#func-oregon-009), [FUNC-OREGON-010](functional.md#func-oregon-010)). ### CONF-BUILD-004 **Title:** Set Lacrosse device address per environment @@ -44,7 +44,7 @@ **Title:** Configure low-battery threshold via LOW_BATTERY_VOLTAGE **Status:** validated **Dependencies:** [FUNC-BATTERY-003](functional.md#func-battery-003) -**Description:** `LOW_BATTERY_VOLTAGE` sets the battery voltage, in mV, below which the battery is low ([FUNC-BATTERY-003](functional.md#func-battery-003)). The default is 2000 mV. Verification: inspection; the native cycle tests use readings above the threshold, and the low-battery effect is tested on its own ([FUNC-BATTERY-003](functional.md#func-battery-003)). +**Description:** `LOW_BATTERY_VOLTAGE` sets the battery voltage, in mV, below which the battery is low ([FUNC-BATTERY-003](functional.md#func-battery-003)). The default is 2000 mV. ### CONF-BUILD-008 **Title:** Assign a unique X10 meter address for battery voltage reporting @@ -68,7 +68,7 @@ **Title:** Document charge-pump sensor rail via USE_CHARGE_PUMP **Status:** validated **Dependencies:** — -**Description:** `USE_CHARGE_PUMP` only records that the board's sensor rail is boosted by a charge pump. It changes nothing in the firmware. Verification: inspection, no firmware source reads `USE_CHARGE_PUMP`. +**Description:** `USE_CHARGE_PUMP` only records that the board's sensor rail is boosted by a charge pump. It changes nothing in the firmware. ### CONF-BUILD-012 **Title:** BATTERY_DIVIDER sets the battery divider ratio on PA1 @@ -80,34 +80,34 @@ **Title:** OREGON_NO_PRESSURE makes a BME280 Oregon sensor send temperature and humidity only **Status:** validated **Dependencies:** [CONF-BUILD-001](#conf-build-001), [CONF-BUILD-002](#conf-build-002), [FUNC-OREGON-012](functional.md#func-oregon-012) -**Description:** With `OREGON_NO_PRESSURE`, a BME280 board drops the pressure reading. It sends a THGR228N temperature-and-humidity frame, like the commercial outdoor sensors, instead of a BTHR918 frame. Setting the flag on a build without the Oregon protocol fails at compile time. Acceptance: such a build sends a THGR228N frame with the measured temperature and humidity. +**Description:** With `OREGON_NO_PRESSURE`, a BME280 board drops the pressure reading. It sends a THGR228N temperature-and-humidity frame, like the commercial outdoor sensors, instead of a BTHR918 frame. Setting the flag on a build without the Oregon protocol fails at compile time. ### CONF-BUILD-014 **Title:** `mushroom` environment builds the 18650-powered BME280 Oregon sensor in the mushroom enclosure **Status:** validated **Dependencies:** [CONF-BUILD-003](#conf-build-003), [CONF-BUILD-005](#conf-build-005), [CONF-BUILD-007](#conf-build-007), [CONF-BUILD-008](#conf-build-008), [CONF-BUILD-012](#conf-build-012), [CONF-BUILD-013](#conf-build-013) -**Description:** The `mushroom` board is a cut-down v2.2 with a BME280. Its 18650 is charged by a TP4056, and a 3.3 V buck-boost supplies VCC, so VCC is not the battery voltage and PA1 reads half of it. It sends Oregon temperature and humidity without pressure on channel 3 with rolling code 0x3C. The X10 meter 7 reports the battery through a divider of 2 every 5 minutes. The low-battery threshold is 3000 mV, so the discharge stays tracked down to 3.0 V while the buck-boost keeps VCC steady. The 1.1 V reference is calibrated at 1104 mV (4040 mV measured on J13 against 4026 mV reported). The environment is part of the default build, and the environment docs list it with its battery and threshold. Acceptance: the environment builds. +**Description:** The `mushroom` board is a cut-down v2.2 with a BME280. Its 18650 is charged by a TP4056, and a 3.3 V buck-boost supplies VCC, so VCC is not the battery voltage and PA1 reads half of it. It sends Oregon temperature and humidity without pressure on channel 3 with rolling code 0x3C. The X10 meter 7 reports the battery through a divider of 2 every 5 minutes. The low-battery threshold is 3000 mV, so the discharge stays tracked down to 3.0 V while the buck-boost keeps VCC steady. The 1.1 V reference is calibrated at 1104 mV (4040 mV measured on J13 against 4026 mV reported). The environment is part of the default build, and the environment docs list it with its battery and threshold. ### CONF-BUILD-015 **Title:** CI runs every emitter native test environment and builds every emitter board environment **Status:** validated **Dependencies:** [CONF-BUILD-014](#conf-build-014), [TECH-MAIN-001](technical.md#tech-main-001) -**Description:** The CI (`.github/workflows/main.yml`) runs `pio test -d emitter` on `native_debug` and on every `native_cycle_*` environment of `emitter/platformio.ini`: `native_cycle_oregon`, `native_cycle_oregon_vcc`, `native_cycle_oregon_divider`, `native_cycle_lacrosse` and `native_cycle_x10`. It builds every environment in `default_envs`: `S_02`, `S_03`, `S_04`, `S_05`, `robot`, `devmodule`, `SOLAR_TEST` and `mushroom`. It publishes each board firmware (`.hex`, `.elf`) as `firmware-`, and the release waits for these builds. Verified by comparing the workflow with `emitter/platformio.ini` and by a green CI run. +**Description:** The CI (`.github/workflows/main.yml`) runs `pio test -d emitter` on `native_debug` and on every `native_cycle_*` environment of `emitter/platformio.ini`: `native_cycle_oregon`, `native_cycle_oregon_vcc`, `native_cycle_oregon_divider`, `native_cycle_lacrosse` and `native_cycle_x10`. It builds every environment in `default_envs`: `S_02`, `S_03`, `S_04`, `S_05`, `robot`, `devmodule`, `SOLAR_TEST` and `mushroom`. It publishes each board firmware (`.hex`, `.elf`) as `firmware-`, and the release waits for these builds. ### CONF-DECODE-002 **Title:** CI and pre-commit cover tinyDecoders: lint, native tests and the promini and promicro builds **Status:** validated -**Dependencies:** [CONF-DECODE-003](#conf-decode-003), [CONF-DECODE-004](#conf-decode-004), [TECH-DECODE-001](technical.md#tech-decode-001) -**Description:** The CI (`.github/workflows/main.yml`) lints `tinyDecoders` with the `.rbd/config.yml` linter command (build trees `*/.pio` skipped), runs the `tinyDecoders` native tests, and builds the `promini` and `promicro` environments. It publishes the promicro firmware (`.hex`, `.elf`, production) as `firmware-tinydecoders-promicro` and the promini one as `firmware-tinydecoders-promini`, and the release waits for these builds. The PlatformIO cache follows changes to `tinyDecoders/platformio.ini`. The pre-commit clang-format hook covers `tinyDecoders/src`, `tinyDecoders/lib` and `tinyDecoders/test`. Verified by a green CI run. +**Dependencies:** [CONF-DECODE-003](#conf-decode-003), [CONF-DECODE-004](#conf-decode-004) +**Description:** The CI (`.github/workflows/main.yml`) lints `tinyDecoders` with the `.rbd/config.yml` linter command (build trees `*/.pio` skipped), runs the `tinyDecoders` native tests, and builds the `promini` and `promicro` environments. It publishes the promicro firmware (`.hex`, `.elf`, production) as `firmware-tinydecoders-promicro` and the promini one as `firmware-tinydecoders-promini`, and the release waits for these builds. The PlatformIO cache follows changes to `tinyDecoders/platformio.ini`. The pre-commit clang-format hook covers `tinyDecoders/src`, `tinyDecoders/lib` and `tinyDecoders/test`. ### CONF-DECODE-003 **Title:** tinyDecoders promicro environment builds the production receiver for the Pro Micro 5 V / 16 MHz (ATmega32U4) **Status:** validated **Dependencies:** [FUNC-DECODE-009](functional.md#func-decode-009), [PLAT-DECODE-003](platform.md#plat-decode-003), [PLAT-DECODE-004](platform.md#plat-decode-004), [PLAT-DECODE-005](platform.md#plat-decode-005) -**Description:** The production tinyDecoders receiver is a standalone viewer on a Pro Micro 5 V / 16 MHz (ATmega32U4), powered and flashed through its micro-USB. Its native USB needs no USB-serial (FTDI) adapter, and its RFLink lines go out on the USB CDC serial port. Its wiring is in [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. The Pro Mini is the alternative build ([CONF-DECODE-004](#conf-decode-004)). `tinyDecoders/platformio.ini` has `[env:promicro]`: `platform = atmelavr`, `board = sparkfun_promicro16`, `framework = arduino`, the default upload (`avr109`, Caterina bootloader over USB) and no `lib_deps`. It builds the same receiver firmware as the Pro Mini (entry point: [TECH-DECODE-005](technical.md#tech-decode-005)); the Arduino core keeps the Pro Micro USB stack running. Verified by `pio run -d tinyDecoders -e promicro`. +**Description:** The production tinyDecoders receiver is a standalone viewer on a Pro Micro 5 V / 16 MHz (ATmega32U4), powered and flashed through its micro-USB. Its native USB needs no USB-serial (FTDI) adapter, and its RFLink lines go out on the USB CDC serial port. Its wiring is in [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. The Pro Mini is the alternative build ([CONF-DECODE-004](#conf-decode-004)). `tinyDecoders/platformio.ini` has `[env:promicro]`: `platform = atmelavr`, `board = sparkfun_promicro16`, `framework = arduino`, the default upload (`avr109`, Caterina bootloader over USB) and no `lib_deps`. It builds the same receiver firmware as the Pro Mini; the Arduino core keeps the Pro Micro USB stack running. ### CONF-DECODE-004 **Title:** tinyDecoders promini environment builds the alternative receiver for the Pro Mini 5 V / 16 MHz (ATmega328P) **Status:** validated **Dependencies:** [FUNC-DECODE-007](functional.md#func-decode-007), [FUNC-DECODE-009](functional.md#func-decode-009), [PLAT-DECODE-003](platform.md#plat-decode-003), [PLAT-DECODE-004](platform.md#plat-decode-004), [PLAT-DECODE-005](platform.md#plat-decode-005) -**Description:** The alternative tinyDecoders receiver is a standalone viewer on an Arduino Pro Mini 5 V / 16 MHz (ATmega328P), fed USB 5 V on its VCC pin, bypassing the onboard regulator. The production receiver is the Pro Micro ([CONF-DECODE-003](#conf-decode-003)). The Pro Mini has no native USB: flashing it needs a USB-serial adapter on its programming header, and its RFLink lines go out on the debug UART. Its wiring is in [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. `tinyDecoders/platformio.ini` has `[env:promini]`: `platform = atmelavr`, `board = pro16MHzatmega328`, `framework = arduino`, the default upload (`arduino` protocol through the Pro Mini bootloader, over a USB-serial adapter on the programming header), no `lib_deps`, and `build_flags = -DSERIAL_TX_BUFFER_SIZE=128`: the core default of 64 B leaves 63 free bytes, exactly the longest RFLink line plus `\r\n`, and 128 B leaves room for a second line. It builds the same receiver firmware as the Pro Micro ([CONF-DECODE-003](#conf-decode-003)). Verified by `pio run -d tinyDecoders -e promini`. \ No newline at end of file +**Description:** The alternative tinyDecoders receiver is a standalone viewer on an Arduino Pro Mini 5 V / 16 MHz (ATmega328P), fed USB 5 V on its VCC pin, bypassing the onboard regulator. The production receiver is the Pro Micro ([CONF-DECODE-003](#conf-decode-003)). The Pro Mini has no native USB: flashing it needs a USB-serial adapter on its programming header, and its RFLink lines go out on the debug UART. Its wiring is in [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. `tinyDecoders/platformio.ini` has `[env:promini]`: `platform = atmelavr`, `board = pro16MHzatmega328`, `framework = arduino`, the default upload (`arduino` protocol through the Pro Mini bootloader, over a USB-serial adapter on the programming header), no `lib_deps`, and `build_flags = -DSERIAL_TX_BUFFER_SIZE=128`: the core default of 64 B leaves 63 free bytes, exactly the longest RFLink line plus `\r\n`, and 128 B leaves room for a second line. It builds the same receiver firmware as the Pro Micro ([CONF-DECODE-003](#conf-decode-003)). \ No newline at end of file From a3e2f6311664e9b645b6c565334bebe14bb1827a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:47:36 +0100 Subject: [PATCH 09/32] req(FUNC-OREGON-015,FUNC-BATTERY-002,FUNC-SENSOR-001,FUNC-SENSOR-002,FUNC-MAIN-001,FUNC-DECODE-001..010): test sentences become behaviour examples, verification and acceptance sentences dropped Co-Authored-By: Claude Opus 5.5 --- requirements/functional.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/requirements/functional.md b/requirements/functional.md index 3617353..2e2ea73 100644 --- a/requirements/functional.md +++ b/requirements/functional.md @@ -92,7 +92,7 @@ **Title:** A reused Oregon encoder carries no field value over from a previous frame **Status:** validated **Dependencies:** [FUNC-OREGON-006](#func-oregon-006), [FUNC-OREGON-009](#func-oregon-009), [FUNC-OREGON-012](#func-oregon-012), [FUNC-OREGON-013](#func-oregon-013), [FUNC-OREGON-014](#func-oregon-014) -**Description:** When one encoder sends several frames, each new value fully replaces the previous one: a non-negative temperature clears the sign bit; a new channel replaces the previous channel; the checksum is computed again. The set of measurements stays cumulative ([FUNC-OREGON-013](#func-oregon-013)). Test: one encoder sends the [FUNC-OREGON-014](#func-oregon-014) THN132N frame, then the THGR228N inputs, then the BTHR918 inputs; each payload equals its [FUNC-OREGON-014](#func-oregon-014) reference. +**Description:** When one encoder sends several frames, each new value fully replaces the previous one: a non-negative temperature clears the sign bit; a new channel replaces the previous channel; the checksum is computed again. The set of measurements stays cumulative ([FUNC-OREGON-013](#func-oregon-013)). Example: one encoder given the [FUNC-OREGON-014](#func-oregon-014) THN132N inputs, then the THGR228N inputs, then the BTHR918 inputs, sends each [FUNC-OREGON-014](#func-oregon-014) payload exactly. ### FUNC-LACROSSE-001 **Title:** Lacrosse frame starts with 10 zero bits then a one start bit @@ -200,7 +200,7 @@ **Title:** Battery voltage is VCC, or the PA1 divider reading multiplied by the board's divider ratio **Status:** validated **Dependencies:** [FUNC-BATTERY-001](#func-battery-001) -**Description:** On boards where the battery powers the chip directly, the battery voltage is the measured VCC. On other boards, it is the PA1 voltage ([FUNC-BATTERY-001](#func-battery-001) pin voltage formula) multiplied by the divider ratio set at build time, which is 1 when not set. This scaled voltage drives the low-battery decision and is the value the X10 battery meter reports. Acceptance: with a ratio of 2, the battery meter reports twice the PA1 voltage; without a ratio, it reports the PA1 voltage unchanged. +**Description:** On boards where the battery powers the chip directly, the battery voltage is the measured VCC. On other boards, it is the PA1 voltage ([FUNC-BATTERY-001](#func-battery-001) pin voltage formula) multiplied by the divider ratio set at build time, which is 1 when not set. This scaled voltage drives the low-battery decision and is the value the X10 battery meter reports. Example: with a ratio of 2, the battery meter reports twice the PA1 voltage; without a ratio, it reports the PA1 voltage unchanged. ### FUNC-BATTERY-003 **Title:** Low battery mutes the X10 meters and the luminosity frames, and sets the Oregon battery-low flag @@ -212,13 +212,13 @@ **Title:** Temperature, humidity and pressure read from a BME280 or BMP280 at I2C address 0x76 **Status:** validated **Dependencies:** — -**Description:** On a build with a BME280 or BMP280 ([CONF-BUILD-002](configuration.md#conf-build-002)), each cycle reads the temperature (°C), the pressure in hPa (the sensor value in Pa divided by 100, not rounded: each encoder rounds it to its frame resolution) and, on a BME280, the humidity (%) from the sensor at I2C address 0x76, then puts the sensor to sleep. Wrapper details: [TECH-SENSOR-002](technical.md#tech-sensor-002). Verification: inspection and the AVR builds; native builds stub the sensor ([TECH-SENSOR-002](technical.md#tech-sensor-002)). Bench check pending: BME280 readings over several cycles on the mushroom board. +**Description:** On a build with a BME280 or BMP280 ([CONF-BUILD-002](configuration.md#conf-build-002)), each cycle reads the temperature (°C), the pressure in hPa (the sensor value in Pa divided by 100, not rounded: each encoder rounds it to its frame resolution) and, on a BME280, the humidity (%) from the sensor at I2C address 0x76, then puts the sensor to sleep. ### FUNC-SENSOR-002 **Title:** DS18B20 temperature read on the 1-Wire bus on PA3, in whole °C **Status:** draft **Dependencies:** — -**Description:** On a build with a DS18B20, each cycle starts a conversion on the 1-Wire bus on PA3, waits 1 s and reads the result. The temperature in whole °C is the raw 1/16 °C value divided by 16. A result of 0 °C counts as a failed read, so a real 0 °C is lost too: the cycle then has no temperature and, with no other temperature source, sends no environment frame ([CONF-BUILD-002](configuration.md#conf-build-002)). Wrapper details: [TECH-SENSOR-001](technical.md#tech-sensor-001). Verification: inspection and the AVR builds only; no sensor unit in service uses a DS18B20, so it is not bench-tested. +**Description:** On a build with a DS18B20, each cycle starts a conversion on the 1-Wire bus on PA3, waits 1 s and reads the result. The temperature in whole °C is the raw 1/16 °C value divided by 16. A result of 0 °C counts as a failed read, so a real 0 °C is lost too: the cycle then has no temperature and, with no other temperature source, sends no environment frame ([CONF-BUILD-002](configuration.md#conf-build-002)). Wrapper details: [TECH-SENSOR-001](technical.md#tech-sensor-001). ### FUNC-SENSOR-003 **Title:** BH1750 luminosity sent twice as a Lacrosse luminosity frame @@ -236,66 +236,66 @@ **Title:** Environment frame sent twice per cycle, separated by a silence at least one frame long **Status:** validated **Dependencies:** [FUNC-OREGON-014](#func-oregon-014), [FUNC-LACROSSE-002](#func-lacrosse-002), [PLAT-POWER-004](platform.md#plat-power-004), [TECH-MAIN-001](technical.md#tech-main-001) -**Description:** In every cycle where the sensor sends an environment frame (Oregon or Lacrosse, whichever the build uses), it sends that frame twice, and both copies are identical. Between the end of the first copy and the start of the second, the radio stays low for at least the length of one frame: 246 ms for Oregon and 98 ms for Lacrosse. This matches commercial Oregon sensors and makes up for single frames that RFLink missed. The X10 meter frames, the luminosity frame, and cycles that send no environment frame stay as they are. Acceptance: in one cycle on an Oregon build and one on a Lacrosse build, the radio output holds two identical environment frames. Between them there is a silence of at least 246 ms (Oregon) or 98 ms (Lacrosse), and the radio is never high during it. A build with no environment protocol sends no extra frame. +**Description:** In every cycle where the sensor sends an environment frame (Oregon or Lacrosse, whichever the build uses), it sends that frame twice, and both copies are identical. Between the end of the first copy and the start of the second, the radio stays low for at least the length of one frame: 246 ms for Oregon and 98 ms for Lacrosse. This matches commercial Oregon sensors and makes up for single frames that RFLink missed. The X10 meter frames, the luminosity frame, and cycles that send no environment frame stay as they are. --- ### FUNC-DECODE-001 **Title:** Receiver decodes X10 RFXmeter frames (address, value) from radio pulses **Status:** validated -**Dependencies:** [FUNC-X10-001](#func-x10-001), [TECH-DECODE-001](technical.md#tech-decode-001), [TECH-DECODE-003](technical.md#tech-decode-003) -**Description:** The receiver decodes RFXmeter frames from the radio pulses (level and duration). Each timing window is nominal ±30 %: preamble high 8960 µs then low 4500 µs, then 48 bits most significant first, each high 560 µs then low 560 µs (`0`) or 1680 µs (`1`). A frame of 6 bytes `b0..b5` is decoded at the low pulse of bit 48 when `b1` is `b0` with its high nibble inverted, the high nibble of `b5` is 0, and the low nibble of `b5` is the inverted sum of the nibbles before it. Its address is `b0` and its value is the 24-bit number `b4 b2 b3` (`b4` most significant), until the next decoded frame. A failed check or a pulse of unexpected level or duration drops the frame in progress, and that pulse is checked again as a preamble start. Test: the pulses of the X10 encoder sending one RFXmeter frame with 2 repeats give exactly two decoded frames, each with that address and value. +**Dependencies:** [FUNC-X10-001](#func-x10-001), [TECH-DECODE-003](technical.md#tech-decode-003) +**Description:** The receiver decodes RFXmeter frames from the radio pulses (level and duration). Each timing window is nominal ±30 %: preamble high 8960 µs then low 4500 µs, then 48 bits most significant first, each high 560 µs then low 560 µs (`0`) or 1680 µs (`1`). A frame of 6 bytes `b0..b5` is decoded at the low pulse of bit 48 when `b1` is `b0` with its high nibble inverted, the high nibble of `b5` is 0, and the low nibble of `b5` is the inverted sum of the nibbles before it. Its address is `b0` and its value is the 24-bit number `b4 b2 b3` (`b4` most significant), until the next decoded frame. A failed check or a pulse of unexpected level or duration drops the frame in progress, and that pulse is checked again as a preamble start. Example: one RFXmeter frame sent with 2 copies gives exactly two decoded frames, each with its address and value. ### FUNC-DECODE-002 **Title:** Receiver decodes Lacrosse WS7000 frames (type, address) from radio pulses **Status:** validated -**Dependencies:** [FUNC-LACROSSE-001](#func-lacrosse-001), [FUNC-LACROSSE-002](#func-lacrosse-002), [FUNC-LACROSSE-003](#func-lacrosse-003), [FUNC-LACROSSE-008](#func-lacrosse-008), [FUNC-LACROSSE-009](#func-lacrosse-009), [TECH-DECODE-001](technical.md#tech-decode-001), [TECH-DECODE-003](technical.md#tech-decode-003) -**Description:** The receiver decodes Lacrosse WS7000 frames from the radio pulses. Windows are nominal ±30 %: bit `1` is high 400 µs then low 800 µs, bit `0` high 800 µs then low 400 µs. Sync is at least 6 zero bits then a one. Then come nibbles, each 4 bits least significant first plus a `1` separator. The first nibble is the type: types 0, 1, 4 and 5 have 3, 6, 10 and 7 data nibbles after the address nibble; another type is rejected. The two check nibbles are verified per [FUNC-LACROSSE-008](#func-lacrosse-008). A frame is decoded at the high pulse of its last separator, with its type and its address (bits 0–2 of the address nibble). A pulse of unexpected level or duration, a `0` separator or a failed check drops the frame in progress, and that pulse is checked again as a sync start. Test: the Lacrosse encoder sending each type twice gives exactly two decoded frames, with that type and address. +**Dependencies:** [FUNC-LACROSSE-001](#func-lacrosse-001), [FUNC-LACROSSE-002](#func-lacrosse-002), [FUNC-LACROSSE-003](#func-lacrosse-003), [FUNC-LACROSSE-008](#func-lacrosse-008), [FUNC-LACROSSE-009](#func-lacrosse-009), [TECH-DECODE-003](technical.md#tech-decode-003) +**Description:** The receiver decodes Lacrosse WS7000 frames from the radio pulses. Windows are nominal ±30 %: bit `1` is high 400 µs then low 800 µs, bit `0` high 800 µs then low 400 µs. Sync is at least 6 zero bits then a one. Then come nibbles, each 4 bits least significant first plus a `1` separator. The first nibble is the type: types 0, 1, 4 and 5 have 3, 6, 10 and 7 data nibbles after the address nibble; another type is rejected. The two check nibbles are verified per [FUNC-LACROSSE-008](#func-lacrosse-008). A frame is decoded at the high pulse of its last separator, with its type and its address (bits 0–2 of the address nibble). A pulse of unexpected level or duration, a `0` separator or a failed check drops the frame in progress, and that pulse is checked again as a sync start. Example: a frame of each type sent twice gives exactly two decoded frames, with that type and address. ### FUNC-DECODE-003 **Title:** Receiver reads Lacrosse measurements in tenths and lux **Status:** validated **Dependencies:** [FUNC-DECODE-002](#func-decode-002), [FUNC-LACROSSE-003](#func-lacrosse-003), [FUNC-LACROSSE-004](#func-lacrosse-004), [FUNC-LACROSSE-005](#func-lacrosse-005), [FUNC-LACROSSE-006](#func-lacrosse-006), [FUNC-LACROSSE-007](#func-lacrosse-007) -**Description:** With `d1..dn` the data nibbles after the address nibble in transmission order, a decoded Lacrosse frame gives, until the next one: temperature in tenths `d3*100 + d2*10 + d1`, negative when bit 3 of the address nibble is set (types 0, 1, 4); humidity in tenths `d6*100 + d5*10 + d4` (types 1, 4); pressure in hPa tenths `d9*1000 + d8*100 + d7*10 + d10 + 2000` (type 4); lux `(d3*100 + d2*10 + d1) × 10^d4`, capped at 65535 (type 5, `d5..d7` ignored). A value the frame type does not carry reads 0. Test: the Lacrosse encoder sending −10.2 °C, 42.5 %, 1013.4 hPa, 1000 lux and 65535 lux reads −102, 425, 10134, 1000 and 65500; a type 5 frame with mantissa 999 and exponent 3 reads 65535. +**Description:** With `d1..dn` the data nibbles after the address nibble in transmission order, a decoded Lacrosse frame gives, until the next one: temperature in tenths `d3*100 + d2*10 + d1`, negative when bit 3 of the address nibble is set (types 0, 1, 4); humidity in tenths `d6*100 + d5*10 + d4` (types 1, 4); pressure in hPa tenths `d9*1000 + d8*100 + d7*10 + d10 + 2000` (type 4); lux `(d3*100 + d2*10 + d1) × 10^d4`, capped at 65535 (type 5, `d5..d7` ignored). A value the frame type does not carry reads 0. Examples: frames sent with −10.2 °C, 42.5 %, 1013.4 hPa, 1000 lux and 65535 lux read −102, 425, 10134, 1000 and 65500; a type 5 frame with mantissa 999 and exponent 3 reads 65535. ### FUNC-DECODE-004 **Title:** Receiver decodes Oregon v2.1 frames (device ID, channel, rolling code, battery) from radio pulses **Status:** validated -**Dependencies:** [FUNC-OREGON-001](#func-oregon-001), [FUNC-OREGON-002](#func-oregon-002), [FUNC-OREGON-003](#func-oregon-003), [FUNC-OREGON-004](#func-oregon-004), [FUNC-OREGON-009](#func-oregon-009), [FUNC-OREGON-010](#func-oregon-010), [FUNC-OREGON-011](#func-oregon-011), [FUNC-OREGON-012](#func-oregon-012), [TECH-DECODE-001](technical.md#tech-decode-001), [TECH-DECODE-003](technical.md#tech-decode-003) -**Description:** The receiver decodes Oregon v2.1 frames from the radio pulses. Windows: short 150–731 µs, long 732–1199 µs (origin: RFLink `OregonDecoderV2`, `Plugins/Plugin_048.c` (couin3) lines 322-324, threshold moved from 600 µs). 732 µs is the midpoint of the nominal half-bit (488 µs) and bit (976 µs) at 1024 Hz: a weak commercial THGN132N on the RXB6 (bench, 2026-11-12) gives highs ~80 µs short and lows ~80 µs long (short lows up to 649 µs, long highs from 800 µs), which the 600 µs threshold rejected (5 frames decoded vs 203 by an RFLink gateway over 2 h). Each bit is a long pulse whose level is the bit value; between two bits comes either one long pulse of the opposite level (next bit equal) or two short pulses, opposite then same level (next bit inverted). Sync: a long high pulse starts a run of at least 12 one bits (RFLink's 24 long pulses, line 333), ended by a zero bit where `b0` starts (its low nibble is the sync nibble 0xA). Bytes `b0..b10` are least significant bit first; nibble `2i` is the low nibble of `b(i)`. `b0 b1` must be `0xEA 0x4C` (c = 13), `0x1A 0x2D` or `0x1A 0x3D` (c = 16), or `0x5A 0x5D` (c = 20); nibbles `c` and `c+1` are the low and high nibbles of (sum of nibbles `0..c-1` − 0xA) & 0xFF (lines 465, 654, 698); later nibbles are ignored. A frame is decoded on the long pulse of its last checksum bit (frame bit 60, 72 or 88). Until the next one, its device ID is `b0 b1`, its channel is 1, 2 or 3 when the high nibble of `b2` is 1, 2 or 4 (else 0), its rolling code is `b3`, and its battery is low when bit 2 or 3 of `b4` is set (lines 711-714). A pulse of unexpected level or duration, an unknown ID or a failed checksum drops the frame in progress, and that pulse is checked again as a sync start. Test: the Oregon encoder sending each [FUNC-OREGON-014](#func-oregon-014) device twice gives exactly two decoded frames with its ID, channel, code and battery flag; bit pulses of the RFLink captures `EA4C20725C21D083`, `EA4C101360193023`, `1A2D40C4512170463E`, `1A2D1072512080E73F` (lines 644-645, 685-686) give channel/code/battery 2/0x72/low, 1/0x13/ok, 3/0xC4/ok, 1/0x72/ok; a `0x1A3D` copy with recomputed checksum is accepted; 11 sync ones or one flipped data bit are rejected; a valid frame with short lows 620 µs, short highs 400 µs, long highs 880 µs, long lows 1060 µs decodes; window bounds 149/150, 731/732, 1199/1200 µs. +**Dependencies:** [FUNC-OREGON-001](#func-oregon-001), [FUNC-OREGON-002](#func-oregon-002), [FUNC-OREGON-003](#func-oregon-003), [FUNC-OREGON-004](#func-oregon-004), [FUNC-OREGON-009](#func-oregon-009), [FUNC-OREGON-010](#func-oregon-010), [FUNC-OREGON-011](#func-oregon-011), [FUNC-OREGON-012](#func-oregon-012), [TECH-DECODE-003](technical.md#tech-decode-003) +**Description:** The receiver decodes Oregon v2.1 frames from the radio pulses. Windows: short 150–731 µs, long 732–1199 µs (origin: RFLink `OregonDecoderV2`, `Plugins/Plugin_048.c` (couin3) lines 322-324, threshold moved from 600 µs). 732 µs is the midpoint of the nominal half-bit (488 µs) and bit (976 µs) at 1024 Hz: a weak commercial THGN132N on the RXB6 (bench, 2026-11-12) gives highs ~80 µs short and lows ~80 µs long (short lows up to 649 µs, long highs from 800 µs), which the 600 µs threshold rejected (5 frames decoded vs 203 by an RFLink gateway over 2 h). Each bit is a long pulse whose level is the bit value; between two bits comes either one long pulse of the opposite level (next bit equal) or two short pulses, opposite then same level (next bit inverted). Sync: a long high pulse starts a run of at least 12 one bits (RFLink's 24 long pulses, line 333), ended by a zero bit where `b0` starts (its low nibble is the sync nibble 0xA). Bytes `b0..b10` are least significant bit first; nibble `2i` is the low nibble of `b(i)`. `b0 b1` must be `0xEA 0x4C` (c = 13), `0x1A 0x2D` or `0x1A 0x3D` (c = 16), or `0x5A 0x5D` (c = 20); nibbles `c` and `c+1` are the low and high nibbles of (sum of nibbles `0..c-1` − 0xA) & 0xFF (lines 465, 654, 698); later nibbles are ignored. A frame is decoded on the long pulse of its last checksum bit (frame bit 60, 72 or 88). Until the next one, its device ID is `b0 b1`, its channel is 1, 2 or 3 when the high nibble of `b2` is 1, 2 or 4 (else 0), its rolling code is `b3`, and its battery is low when bit 2 or 3 of `b4` is set (lines 711-714). A pulse of unexpected level or duration, an unknown ID or a failed checksum drops the frame in progress, and that pulse is checked again as a sync start. Examples: each [FUNC-OREGON-014](#func-oregon-014) device sent twice gives exactly two decoded frames with its ID, channel, code and battery flag; the RFLink captures `EA4C20725C21D083`, `EA4C101360193023`, `1A2D40C4512170463E`, `1A2D1072512080E73F` (lines 644-645, 685-686) give channel/code/battery 2/0x72/low, 1/0x13/ok, 3/0xC4/ok, 1/0x72/ok; a `0x1A3D` copy with recomputed checksum is accepted; 11 sync ones or one flipped data bit are rejected; a valid frame with short lows 620 µs, short highs 400 µs, long highs 880 µs, long lows 1060 µs decodes. ### FUNC-DECODE-005 **Title:** Receiver reads the Oregon measurements its device ID carries in tenths, % and hPa **Status:** validated **Dependencies:** [FUNC-DECODE-004](#func-decode-004), [FUNC-OREGON-005](#func-oregon-005), [FUNC-OREGON-006](#func-oregon-006), [FUNC-OREGON-007](#func-oregon-007), [FUNC-OREGON-008](#func-oregon-008), [FUNC-OREGON-012](#func-oregon-012) -**Description:** With `b0..b10` the frame bytes, a decoded Oregon frame gives, until the next one: temperature in tenths, the digits being the high nibble of `b5`, the low nibble of `b5` and the high nibble of `b4`, negative when bit 3 of `b6` is set (all IDs); humidity in %, the digits being the low nibble of `b7` and the high nibble of `b6` (IDs `0x1A2D`, `0x1A3D`, `0x5A5D`); pressure in hPa `b8 + 795` (ID `0x5A5D`) (RFLink `Plugins/Plugin_048.c` (couin3) lines 733-751; offset 795 per [FUNC-OREGON-008](#func-oregon-008)). Forecast and comfort nibbles are ignored. A value the device ID does not carry reads 0. Test: the Oregon encoder sending THN132N −10.2 °C reads −102 (humidity and pressure 0); THGR228N 21.5 °C, 67 % reads 215, 67 (pressure 0); BTHR918 21.5 °C, 60 %, 1013 hPa reads 215, 60, 1013; the [FUNC-DECODE-004](#func-decode-004) RFLink captures read 215; 196; 215 and 67; 205 and 78. +**Description:** With `b0..b10` the frame bytes, a decoded Oregon frame gives, until the next one: temperature in tenths, the digits being the high nibble of `b5`, the low nibble of `b5` and the high nibble of `b4`, negative when bit 3 of `b6` is set (all IDs); humidity in %, the digits being the low nibble of `b7` and the high nibble of `b6` (IDs `0x1A2D`, `0x1A3D`, `0x5A5D`); pressure in hPa `b8 + 795` (ID `0x5A5D`) (RFLink `Plugins/Plugin_048.c` (couin3) lines 733-751; offset 795 per [FUNC-OREGON-008](#func-oregon-008)). Forecast and comfort nibbles are ignored. A value the device ID does not carry reads 0. Examples: THN132N −10.2 °C reads −102 (humidity and pressure 0); THGR228N 21.5 °C, 67 % reads 215, 67 (pressure 0); BTHR918 21.5 °C, 60 %, 1013 hPa reads 215, 60, 1013; the [FUNC-DECODE-004](#func-decode-004) RFLink captures read 215; 196; 215 and 67; 205 and 78. ### FUNC-DECODE-006 **Title:** Receiver keeps the last decoded values of each radio source, 16 sources at most **Status:** validated **Dependencies:** [FUNC-DECODE-001](#func-decode-001), [FUNC-DECODE-003](#func-decode-003), [FUNC-DECODE-005](#func-decode-005) -**Description:** The receiver keeps, per radio source, the values of its last decoded frame and the second it was heard. A source is identified by its protocol (Oregon, Lacrosse, Lacrosse luminosity, X10), its id and its code. The values are temperature, humidity and pressure in tenths, lux and millivolts; a value the frame does not carry is absent and reads 0. Oregon: id is the channel, code the rolling code; temperature always, humidity (% × 10) for IDs `0x1A2D`, `0x1A3D`, `0x5A5D`, pressure (hPa × 10) for `0x5A5D`. Lacrosse and X10 have code 0. Lacrosse type 5 is a Lacrosse luminosity source with id the address and the lux value; types 0, 1 and 4 are Lacrosse sources with id the address, temperature, plus humidity (types 1, 4), plus pressure (type 4), in tenths as decoded. X10: id is the address; millivolts is the value read as BCD when every nibble is a decimal digit and the value is at most 0x9999, else the source has no value. A frame from a known source replaces all its values and its last-heard second; a new source is added. The Pro Mini and Pro Micro receivers keep 16 sources (native test builds keep 8, [TECH-DECODE-003](technical.md#tech-decode-003)); when full, the source heard longest ago is replaced in its place. Sources are listed in first-heard order. Test (native, 8 sources): frames from each encoder update or add the expected sources; two Oregon frames on channel 2 with codes 0xB8 and 0x36 give two sources; a 9th source replaces the oldest; X10 value 0x2950 gives 2950 mV, 0x2A50 gives no value. +**Description:** The receiver keeps, per radio source, the values of its last decoded frame and the second it was heard. A source is identified by its protocol (Oregon, Lacrosse, Lacrosse luminosity, X10), its id and its code. The values are temperature, humidity and pressure in tenths, lux and millivolts; a value the frame does not carry is absent and reads 0. Oregon: id is the channel, code the rolling code; temperature always, humidity (% × 10) for IDs `0x1A2D`, `0x1A3D`, `0x5A5D`, pressure (hPa × 10) for `0x5A5D`. Lacrosse and X10 have code 0. Lacrosse type 5 is a Lacrosse luminosity source with id the address and the lux value; types 0, 1 and 4 are Lacrosse sources with id the address, temperature, plus humidity (types 1, 4), plus pressure (type 4), in tenths as decoded. X10: id is the address; millivolts is the value read as BCD when every nibble is a decimal digit and the value is at most 0x9999, else the source has no value. A frame from a known source replaces all its values and its last-heard second; a new source is added. The Pro Mini and Pro Micro receivers keep 16 sources; when full, the source heard longest ago is replaced in its place. Sources are listed in first-heard order. Examples: two Oregon frames on channel 2 with codes 0xB8 and 0x36 give two sources; X10 value 0x2950 gives 2950 mV, 0x2A50 gives no value. ### FUNC-DECODE-007 **Title:** Receiver shows one page per source every 10 s on the OLED and redraws only changed cells **Status:** validated **Dependencies:** [FUNC-DECODE-006](#func-decode-006), [FUNC-DECODE-010](#func-decode-010), [UI-DECODE-001](ui.md#ui-decode-001), [TECH-DECODE-002](technical.md#tech-decode-002), [TECH-DECODE-003](technical.md#tech-decode-003) -**Description:** The receiver feeds every captured radio pulse to its X10, Lacrosse and Oregon decoders and records each decoded frame with the current second ([FUNC-DECODE-006](#func-decode-006)). The page is computed again only when the second changes or a frame is decoded, and each computation first removes expired sources ([FUNC-DECODE-010](#func-decode-010)). While no source is known (at start, or once the last one expired), the screen shows the waiting page: `Waiting for data` on the middle text row (8x16 row 1, pixel rows 8–23, columns 0–15); it is never part of the rotation. Otherwise it shows source `(second / 10) % count` in the 14 cells of [UI-DECODE-001](ui.md#ui-decode-001), with the alternate value when `(second / 2)` is odd. The screen is blank at start, so the first waiting page draws only its 16 text cells. Entering a source page draws all 14 of its cells, spaces included. Entering the waiting page from a source page first draws the 14 source cells as spaces, then the 16 text cells. Each turn of the receiver's main loop, which also empties the pulse buffer, draws at most one pending cell, so a page change never delays the decoding by more than one cell (one that differs from what is shown, or forced by a page switch), the first in the order big cells 0–5, identifier cells left to right, second value cells left to right, then waiting text columns 0–15. Test: waiting page at 12 s (row 1 reads `Waiting for data`, 16 draws); the first decoded frame then draws all 14 source cells; Oregon and Lacrosse frames give their pages alternating every 10 s; a BTHR918 alone shows its humidity at 0–1 s and its pressure at 2–3 s as its second value; no draw when nothing changed; a single source last heard 1800 s ago gives the waiting page after 14 blank source cells (big field, identifier and second value are spaces). +**Description:** The receiver feeds every captured radio pulse to its X10, Lacrosse and Oregon decoders and records each decoded frame with the current second ([FUNC-DECODE-006](#func-decode-006)). The page is computed again only when the second changes or a frame is decoded, and each computation first removes expired sources ([FUNC-DECODE-010](#func-decode-010)). While no source is known (at start, or once the last one expired), the screen shows the waiting page: `Waiting for data` on the middle text row (8x16 row 1, pixel rows 8–23, columns 0–15); it is never part of the rotation. Otherwise it shows source `(second / 10) % count` in the 14 cells of [UI-DECODE-001](ui.md#ui-decode-001), with the alternate value when `(second / 2)` is odd. The screen is blank at start, so the first waiting page draws only its 16 text cells. Entering a source page draws all 14 of its cells, spaces included. Entering the waiting page from a source page first draws the 14 source cells as spaces, then the 16 text cells. Each turn of the receiver's main loop, which also empties the pulse buffer, draws at most one pending cell, so a page change never delays the decoding by more than one cell (one that differs from what is shown, or forced by a page switch), the first in the order big cells 0–5, identifier cells left to right, second value cells left to right, then waiting text columns 0–15. Examples: waiting page at 12 s (row 1 reads `Waiting for data`, 16 draws); the first decoded frame then draws all 14 source cells; Oregon and Lacrosse frames give their pages alternating every 10 s; a BTHR918 alone shows its humidity at 0–1 s and its pressure at 2–3 s as its second value; no draw when nothing changed; a single source last heard 1800 s ago gives the waiting page after 14 blank source cells (big field, identifier and second value are spaces). ### FUNC-DECODE-008 **Title:** Receiver renders each decoded frame as an RFLink text line **Status:** validated **Dependencies:** [FUNC-DECODE-001](#func-decode-001), [FUNC-DECODE-003](#func-decode-003), [FUNC-DECODE-005](#func-decode-005), [TECH-DECODE-003](technical.md#tech-decode-003) -**Description:** A decoded frame renders as one RFLink line of at most 63 characters, without line terminator: `20;`, the line counter as 2 uppercase hex digits, `;`, the name, `;`, then `KEY=value;` fields. `ID` is 4 uppercase hex digits; hex values are lowercase. `TEMP` is the absolute temperature in tenths as 4 hex digits, plus 0x8000 when negative. Oregon: name `Oregon Temp` (`0xEA4C`), `Oregon TempHygro` (`0x1A2D`, `0x1A3D`), `Oregon BTHR` (`0x5A5D`); `ID` is rolling code × 256 + channel; `TEMP`; `HUM` in decimal (`0x1A2D`, `0x1A3D`, `0x5A5D`); `BARO` in hPa as 4 hex digits (`0x5A5D`); `BAT=OK` or `BAT=LOW`. Lacrosse: name `LaCrosse WS7000`; `ID` is type × 256 + address; `TEMP` (types 0, 1, 4); `HUM` is (humidity tenths + 5) / 10 in decimal (types 1, 4); `BARO` is (pressure tenths + 5) / 10 as 4 hex digits (type 4); `LUX` as 4 hex digits (type 5). X10: name `X10Meter`; `ID` is the address; `METER` is the millivolts in decimal when the value is valid BCD ([FUNC-DECODE-006](#func-decode-006) rule), else the line ends after `ID`. Test: THGR228N ch 3, code 0xC4, 21.5 °C, 67 %, counter 0x0A gives `20;0A;Oregon TempHygro;ID=C403;TEMP=00d7;HUM=67;BAT=OK;`; THN132N ch 1, code 0x3C, −10.2 °C, battery low, counter 0 gives `20;00;Oregon Temp;ID=3C01;TEMP=8066;BAT=LOW;`; BTHR918 ch 3, code 0x7E, 21.5 °C, 60 %, 1013 hPa, battery low, counter 0xFF gives `20;FF;Oregon BTHR;ID=7E03;TEMP=00d7;HUM=60;BARO=03f5;BAT=LOW;`; Lacrosse type 4 address 3, −10.2 °C, 42.5 %, 1013.4 hPa, counter 1 gives `20;01;LaCrosse WS7000;ID=0403;TEMP=8066;HUM=43;BARO=03f5;`; Lacrosse type 5 address 2, 1000 lux, counter 1 gives `20;01;LaCrosse WS7000;ID=0502;LUX=03e8;`; X10 address 10, value 0x2950, counter 2 gives `20;02;X10Meter;ID=000A;METER=2950;`; value 0x2A50, counter 3 gives `20;03;X10Meter;ID=000A;`. +**Description:** A decoded frame renders as one RFLink line of at most 63 characters, without line terminator: `20;`, the line counter as 2 uppercase hex digits, `;`, the name, `;`, then `KEY=value;` fields. `ID` is 4 uppercase hex digits; hex values are lowercase. `TEMP` is the absolute temperature in tenths as 4 hex digits, plus 0x8000 when negative. Oregon: name `Oregon Temp` (`0xEA4C`), `Oregon TempHygro` (`0x1A2D`, `0x1A3D`), `Oregon BTHR` (`0x5A5D`); `ID` is rolling code × 256 + channel; `TEMP`; `HUM` in decimal (`0x1A2D`, `0x1A3D`, `0x5A5D`); `BARO` in hPa as 4 hex digits (`0x5A5D`); `BAT=OK` or `BAT=LOW`. Lacrosse: name `LaCrosse WS7000`; `ID` is type × 256 + address; `TEMP` (types 0, 1, 4); `HUM` is (humidity tenths + 5) / 10 in decimal (types 1, 4); `BARO` is (pressure tenths + 5) / 10 as 4 hex digits (type 4); `LUX` as 4 hex digits (type 5). X10: name `X10Meter`; `ID` is the address; `METER` is the millivolts in decimal when the value is valid BCD ([FUNC-DECODE-006](#func-decode-006) rule), else the line ends after `ID`. Examples: THGR228N ch 3, code 0xC4, 21.5 °C, 67 %, counter 0x0A gives `20;0A;Oregon TempHygro;ID=C403;TEMP=00d7;HUM=67;BAT=OK;`; THN132N ch 1, code 0x3C, −10.2 °C, battery low, counter 0 gives `20;00;Oregon Temp;ID=3C01;TEMP=8066;BAT=LOW;`; BTHR918 ch 3, code 0x7E, 21.5 °C, 60 %, 1013 hPa, battery low, counter 0xFF gives `20;FF;Oregon BTHR;ID=7E03;TEMP=00d7;HUM=60;BARO=03f5;BAT=LOW;`; Lacrosse type 4 address 3, −10.2 °C, 42.5 %, 1013.4 hPa, counter 1 gives `20;01;LaCrosse WS7000;ID=0403;TEMP=8066;HUM=43;BARO=03f5;`; Lacrosse type 5 address 2, 1000 lux, counter 1 gives `20;01;LaCrosse WS7000;ID=0502;LUX=03e8;`; X10 address 10, value 0x2950, counter 2 gives `20;02;X10Meter;ID=000A;METER=2950;`; value 0x2A50, counter 3 gives `20;03;X10Meter;ID=000A;`. ### FUNC-DECODE-009 **Title:** Receiver writes one RFLink line per decoded frame on its serial output **Status:** validated **Dependencies:** [FUNC-DECODE-007](#func-decode-007), [FUNC-DECODE-008](#func-decode-008), [TECH-DECODE-002](technical.md#tech-decode-002) -**Description:** On a receiver with a line output, every decoded frame, once recorded ([FUNC-DECODE-006](#func-decode-006)), is written as one RFLink line ([FUNC-DECODE-008](#func-decode-008)). The line counter starts at 0 and goes up by one after each line, wrapping after 0xFF. No deduplication: a frame sent twice gives two lines. The display ([FUNC-DECODE-007](#func-decode-007)) is unchanged. Test: Oregon then Lacrosse frames, each sent twice, give 4 lines in reception order with counters `00` to `03`. +**Description:** On a receiver with a line output, every decoded frame, once recorded ([FUNC-DECODE-006](#func-decode-006)), is written as one RFLink line ([FUNC-DECODE-008](#func-decode-008)). The line counter starts at 0 and goes up by one after each line, wrapping after 0xFF. No deduplication: a frame sent twice gives two lines. The display ([FUNC-DECODE-007](#func-decode-007)) is unchanged. Example: Oregon then Lacrosse frames, each sent twice, give 4 lines in reception order with counters `00` to `03`. ### FUNC-DECODE-010 **Title:** Receiver forgets a source not heard for 30 minutes **Status:** validated **Dependencies:** [FUNC-DECODE-006](#func-decode-006) -**Description:** A source last heard 1800 s or more ago is removed. The other sources keep their first-heard order and the count drops by the number removed; nothing else removes a source (the [FUNC-DECODE-006](#func-decode-006) replacement when full is unchanged). A removed source heard again is added as a new source. Removal runs before each page computation ([FUNC-DECODE-007](#func-decode-007)), so an expired source leaves the rotation and an empty list shows the waiting page. Test (native): a source heard at 100 s is kept at 1899 s and removed at 1900 s; of sources heard at 0, 500 and 1000 s, the second and third remain at 1800 s; a source heard at 0 s and again at 1000 s remains at 1800 s; removal on an empty list keeps the count at 0. +**Description:** A source last heard 1800 s or more ago is removed. The other sources keep their first-heard order and the count drops by the number removed; nothing else removes a source (the [FUNC-DECODE-006](#func-decode-006) replacement when full is unchanged). A removed source heard again is added as a new source. Removal runs before each page computation ([FUNC-DECODE-007](#func-decode-007)), so an expired source leaves the rotation and an empty list shows the waiting page. Examples: a source heard at 100 s is kept at 1899 s and removed at 1900 s; of sources heard at 0, 500 and 1000 s, the second and third remain at 1800 s; a source heard at 0 s and again at 1000 s remains at 1800 s; removal on an empty list keeps the count at 0. From 59c7207a8429bb52fbd3c76bd01579ffb8ee11a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:47:36 +0100 Subject: [PATCH 10/32] req(UI-DECODE-001..003): test sentences become behaviour examples or are dropped where they restate the description Co-Authored-By: Claude Opus 5.5 --- requirements/ui.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/ui.md b/requirements/ui.md index 5a28bfc..e5b9aa0 100644 --- a/requirements/ui.md +++ b/requirements/ui.md @@ -2,22 +2,22 @@ - + ### UI-DECODE-001 **Title:** A source page shows its main value in big characters and a 4-character side column **Status:** validated **Dependencies:** [FUNC-DECODE-006](functional.md#func-decode-006) -**Description:** A source page has a big field of 6 characters (drawn in 16x32 cells, [UI-DECODE-003](#ui-decode-003)), and a side column of two right-aligned 4-character lines: the identifier on top, the second value below. On the 128x32 screen, big cell `i` (0–5) covers pixel columns 16i to 16i + 15 over all 32 pixel rows, and the side column takes 8x16 columns 12–15: the identifier on row 0 (pixel rows 0–15) and the second value on row 2 (pixel rows 16–31). These 14 cells cover the whole screen. Unused positions are spaces. The big field shows, from its first column, the first value present among: temperature `[-]I.T` then `°` (no `C`; −5 tenths shows `-0.5°`); lux in decimal, 1 to 5 digits, then in the next big cell the unit `lx` as two small characters in its lower half ([UI-DECODE-003](#ui-decode-003)); millivolts rounded to hundredths of a volt `I.FF` then `V`. With none of them, it is blank. The identifier is: for Oregon, the channel in decimal, `-`, the rolling code as 2 lowercase hex digits; for Lacrosse and Lacrosse luminosity, `L` and the address in decimal; for X10, `X` and the address in decimal. The second value is the humidity rounded to whole %, capped at 99, then `%`, or the pressure rounded to whole hPa without unit. When both are present, the page shows humidity, then pressure on the alternate slot ([FUNC-DECODE-007](functional.md#func-decode-007)). With neither, it is blank. No age and no protocol name are shown. The page uses only `0-9`, space, `.`, `-`, `%`, `°`, `V l x L X a b c d e f`. Test (big field / identifier / second value): Oregon 1, code 0x01, 23.5 °C, 67.0 % gives `23.5° ` / `1-01` / ` 67%`; Oregon 2, code 0x60, 18.8 °C, 77.0 %, 969.0 hPa gives `18.8° ` / `2-60` / ` 77%`, then ` 969` on the alternate slot; Oregon 3, code 0xB8, 21.5 °C only gives `21.5° ` / `3-b8` / ` `; Lacrosse 3, −10.2 °C, 42.5 % gives `-10.2°` / ` L3` / ` 43%`; Lacrosse 1, 21.5 °C, 42.5 %, 1013.4 hPa gives ` 43%`, then `1013` on the alternate slot; Lacrosse luminosity 2, 1000 lux gives `1000`, the `lx` cell, a space / ` L2` / ` `; 65535 lux gives `65535` then the `lx` cell; 0 lux gives `0`, the `lx` cell, 4 spaces; X10 204, 3960 mV gives `3.96V ` / `X204` / ` `; X10 10 without value gives 6 spaces / ` X10`; −0.5 °C gives `-0.5° `; 99.9 % gives ` 99%`. On the receiver, a source page shows its big field in big cells 0–5, its identifier in columns 12–15 of row 0 and its second value in columns 12–15 of row 2. +**Description:** A source page has a big field of 6 characters (drawn in 16x32 cells, [UI-DECODE-003](#ui-decode-003)), and a side column of two right-aligned 4-character lines: the identifier on top, the second value below. On the 128x32 screen, big cell `i` (0–5) covers pixel columns 16i to 16i + 15 over all 32 pixel rows, and the side column takes 8x16 columns 12–15: the identifier on row 0 (pixel rows 0–15) and the second value on row 2 (pixel rows 16–31). These 14 cells cover the whole screen. Unused positions are spaces. The big field shows, from its first column, the first value present among: temperature `[-]I.T` then `°` (no `C`; −5 tenths shows `-0.5°`); lux in decimal, 1 to 5 digits, then in the next big cell the unit `lx` as two small characters in its lower half ([UI-DECODE-003](#ui-decode-003)); millivolts rounded to hundredths of a volt `I.FF` then `V`. With none of them, it is blank. The identifier is: for Oregon, the channel in decimal, `-`, the rolling code as 2 lowercase hex digits; for Lacrosse and Lacrosse luminosity, `L` and the address in decimal; for X10, `X` and the address in decimal. The second value is the humidity rounded to whole %, capped at 99, then `%`, or the pressure rounded to whole hPa without unit. When both are present, the page shows humidity, then pressure on the alternate slot ([FUNC-DECODE-007](functional.md#func-decode-007)). With neither, it is blank. No age and no protocol name are shown. The page uses only `0-9`, space, `.`, `-`, `%`, `°`, `V l x L X a b c d e f`. Examples (big field / identifier / second value): Oregon 1, code 0x01, 23.5 °C, 67.0 % gives `23.5° ` / `1-01` / ` 67%`; Oregon 2, code 0x60, 18.8 °C, 77.0 %, 969.0 hPa gives `18.8° ` / `2-60` / ` 77%`, then ` 969` on the alternate slot; Oregon 3, code 0xB8, 21.5 °C only gives `21.5° ` / `3-b8` / ` `; Lacrosse 3, −10.2 °C, 42.5 % gives `-10.2°` / ` L3` / ` 43%`; Lacrosse 1, 21.5 °C, 42.5 %, 1013.4 hPa gives ` 43%`, then `1013` on the alternate slot; Lacrosse luminosity 2, 1000 lux gives `1000`, the `lx` cell, a space / ` L2` / ` `; 65535 lux gives `65535` then the `lx` cell; 0 lux gives `0`, the `lx` cell, 4 spaces; X10 204, 3960 mV gives `3.96V ` / `X204` / ` `; X10 10 without value gives 6 spaces / ` X10`; −0.5 °C gives `-0.5° `; 99.9 % gives ` 99%`. On the receiver, a source page shows its big field in big cells 0–5, its identifier in columns 12–15 of row 0 and its second value in columns 12–15 of row 2. ### UI-DECODE-002 **Title:** Small characters are the 8x16 Spleen glyphs of the characters the pages use **Status:** validated **Dependencies:** [UI-DECODE-001](#ui-decode-001) -**Description:** Text is drawn in 8x16 characters taken from the Spleen 8x16 font (BSD-2-Clause). The font holds only the 32 visible characters of the [UI-DECODE-001](#ui-decode-001) set and of the waiting text `Waiting for data` ([FUNC-DECODE-007](functional.md#func-decode-007)), which adds `W g i n o r t`; `°` is the degree sign. Space and any other character draw blank. Storage and generation: [TECH-DECODE-004](technical.md#tech-decode-004). Test: each of the 32 glyphs has a lit pixel and they are pairwise distinct; space, `A`, `C`, `s` and the null character draw blank. +**Description:** Text is drawn in 8x16 characters taken from the Spleen 8x16 font (BSD-2-Clause). The font holds only the 32 visible characters of the [UI-DECODE-001](#ui-decode-001) set and of the waiting text `Waiting for data` ([FUNC-DECODE-007](functional.md#func-decode-007)), which adds `W g i n o r t`; `°` is the degree sign. Space and any other character draw blank. Examples: space, `A`, `C`, `s` and the null character draw blank. ### UI-DECODE-003 **Title:** Big characters are the 8x16 glyphs doubled in width and height; the lux unit cell holds `lx` in plain 8x16 glyphs **Status:** validated **Dependencies:** [UI-DECODE-002](#ui-decode-002) -**Description:** A big 16x32 character is its 8x16 glyph ([UI-DECODE-002](#ui-decode-002)) with every pixel doubled horizontally and vertically, so big characters need no font of their own. The lux unit cell of [UI-DECODE-001](#ui-decode-001) is not doubled: its upper half is blank, and its lower half shows the 8x16 glyph of `l` in pixel columns 0–7 and that of `x` in columns 8–15. Test: for each [UI-DECODE-001](#ui-decode-001) character, the 4 pages of its big glyph have equal pixel pairs in both directions, and keeping one pixel of each pair gives back its 8x16 glyph; space is blank on the 4 pages; the unit cell has pages 0–1 blank, page 2 equal to the top halves of `l` then `x`, and page 3 equal to their bottom halves. \ No newline at end of file +**Description:** A big 16x32 character is its 8x16 glyph ([UI-DECODE-002](#ui-decode-002)) with every pixel doubled horizontally and vertically, so big characters need no font of their own. The lux unit cell of [UI-DECODE-001](#ui-decode-001) is not doubled: its upper half is blank, and its lower half shows the 8x16 glyph of `l` in pixel columns 0–7 and that of `x` in columns 8–15. \ No newline at end of file From ef99dd0db67bde2cca3374ea6851dd8e3c48f173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:49:04 +0100 Subject: [PATCH 11/32] test(PLAT-DECODE-003..005,PLAT-ISP-001,PLAT-POWER-008,PLAT-POWER-007,FUNC-SENSOR-001,PLAT-POWER-001,PLAT-POWER-003,PLAT-POWER-005,PLAT-POWER-006): bench test sheets and bring-up order Co-Authored-By: Claude Opus 5.5 --- tests/bench/FUNC-SENSOR-001.md | 21 +++++++++++++++++++++ tests/bench/PLAT-DECODE-003.md | 25 +++++++++++++++++++++++++ tests/bench/PLAT-DECODE-004.md | 24 ++++++++++++++++++++++++ tests/bench/PLAT-DECODE-005.md | 23 +++++++++++++++++++++++ tests/bench/PLAT-ISP-001.md | 23 +++++++++++++++++++++++ tests/bench/PLAT-POWER-001.md | 21 +++++++++++++++++++++ tests/bench/PLAT-POWER-003.md | 21 +++++++++++++++++++++ tests/bench/PLAT-POWER-005.md | 19 +++++++++++++++++++ tests/bench/PLAT-POWER-006.md | 21 +++++++++++++++++++++ tests/bench/PLAT-POWER-007.md | 20 ++++++++++++++++++++ tests/bench/PLAT-POWER-008.md | 22 ++++++++++++++++++++++ tests/bench/bring-up.md | 22 ++++++++++++++++++++++ 12 files changed, 262 insertions(+) create mode 100644 tests/bench/FUNC-SENSOR-001.md create mode 100644 tests/bench/PLAT-DECODE-003.md create mode 100644 tests/bench/PLAT-DECODE-004.md create mode 100644 tests/bench/PLAT-DECODE-005.md create mode 100644 tests/bench/PLAT-ISP-001.md create mode 100644 tests/bench/PLAT-POWER-001.md create mode 100644 tests/bench/PLAT-POWER-003.md create mode 100644 tests/bench/PLAT-POWER-005.md create mode 100644 tests/bench/PLAT-POWER-006.md create mode 100644 tests/bench/PLAT-POWER-007.md create mode 100644 tests/bench/PLAT-POWER-008.md create mode 100644 tests/bench/bring-up.md diff --git a/tests/bench/FUNC-SENSOR-001.md b/tests/bench/FUNC-SENSOR-001.md new file mode 100644 index 0000000..4c5a26a --- /dev/null +++ b/tests/bench/FUNC-SENSOR-001.md @@ -0,0 +1,21 @@ +# Bench test FUNC-SENSOR-001 — BME280 readings over several cycles + +Requirement: [FUNC-SENSOR-001](../../requirements/functional.md#func-sensor-001). Manual test, run at bring-up step **B5** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The board under test with its BME280, the receiver ([PLAT-DECODE-003](PLAT-DECODE-003.md)), a reference thermometer / hygrometer and the local sea-level pressure (weather service). + +## Setup +1. Board and reference side by side, indoors, 30 min to settle. + +## Steps +1. Read 10 consecutive cycles on the receiver (RFLink lines). +2. Note the reference values at the same time. + +## Pass criteria +- Every cycle sends a frame; values stable from cycle to cycle (temperature ± 0.3 °C, humidity ± 2 %). +- Within the BME280 accuracy of the reference: ± 1 °C, ± 3 %, pressure ± 2 hPa (pressure is station pressure, not sea level: compare with altitude in mind). + +## Results +| Date | Commit / build | Board | T / H / P (board) | T / H / P (reference) | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-DECODE-003.md b/tests/bench/PLAT-DECODE-003.md new file mode 100644 index 0000000..30e0341 --- /dev/null +++ b/tests/bench/PLAT-DECODE-003.md @@ -0,0 +1,25 @@ +# Bench test PLAT-DECODE-003 — receiver captures the radio pulses and keeps time + +Requirement: [PLAT-DECODE-003](../../requirements/platform.md#plat-decode-003). Manual test, run at bring-up step **A2** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The receiver (Pro Micro, production; Pro Mini, alternative) with its RXB6 and OLED, wired per `hardware/receiver/WIRING.md`. +- A sensor board in service, or the `devmodule` board, sending frames. +- A PC with `pio device monitor`. + +## Setup +1. Flash the receiver (`pio run -d tinyDecoders -e promicro --target upload`, or `-e promini` through a USB-serial adapter). +2. Open `pio device monitor -d tinyDecoders -b 57600`. + +## Steps +1. Put the sensor board 1–3 m from the receiver and let it send for 10 minutes. +2. Note the number of RFLink lines and the number of frames the sensor sent (each environment frame is sent twice, [FUNC-MAIN-001](../../requirements/functional.md#func-main-001)). +3. Switch the sensor off and time how long its page stays on the screen: a source leaves after 30 minutes without frames ([FUNC-DECODE-010](../../requirements/functional.md#func-decode-010)), which checks the time base. + +## Pass criteria +- Step 2: at least one line per sensor cycle, and no corrupted line. +- Step 3: the source leaves the screen 30 min (± 1 min) after its last frame. + +## Results +| Date | Commit / build | Board | Lines / frames sent | Expiry time | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-DECODE-004.md b/tests/bench/PLAT-DECODE-004.md new file mode 100644 index 0000000..a6c805e --- /dev/null +++ b/tests/bench/PLAT-DECODE-004.md @@ -0,0 +1,24 @@ +# Bench test PLAT-DECODE-004 — receiver drives the SSD1306 OLED + +Requirement: [PLAT-DECODE-004](../../requirements/platform.md#plat-decode-004). Manual test, run at bring-up step **A3** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The receiver of [PLAT-DECODE-003](PLAT-DECODE-003.md), powered over USB. +- At least two sources (an Oregon and a Lacrosse or X10 sensor). + +## Setup +1. Receiver flashed, OLED wired directly at 5 V (no level shifter). + +## Steps +1. Power on: note what the screen shows before any frame. +2. Let both sources send; watch the pages for 1 minute. +3. While a page changes, check the RFLink lines keep coming on the serial port. + +## Pass criteria +- Step 1: `Waiting for data` on the middle row, no garbage elsewhere. +- Step 2: one page per source every 10 s, big digits doubled cleanly, side column readable ([UI-DECODE-001](../../requirements/ui.md#ui-decode-001) to 003). +- Step 3: no gap in the lines while the screen redraws. + +## Results +| Date | Commit / build | Board | Waiting page | Pages OK | Lines during redraw | Pass | By | Notes | +|---|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-DECODE-005.md b/tests/bench/PLAT-DECODE-005.md new file mode 100644 index 0000000..48282e3 --- /dev/null +++ b/tests/bench/PLAT-DECODE-005.md @@ -0,0 +1,23 @@ +# Bench test PLAT-DECODE-005 — receiver writes RFLink lines without blocking + +Requirement: [PLAT-DECODE-005](../../requirements/platform.md#plat-decode-005). Manual test, run at bring-up step **A4** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The receiver of [PLAT-DECODE-003](PLAT-DECODE-003.md); on the Pro Mini, a USB-serial adapter on TX D1. +- A PC with `pio device monitor`. + +## Setup +1. `pio device monitor -d tinyDecoders -b 57600`. + +## Steps +1. With frames arriving, read the lines. +2. Close the monitor (Pro Micro: leave the USB host without a reader; Pro Mini: unplug the adapter) for 2 minutes, then open it again. +3. Watch the OLED during step 2. + +## Pass criteria +- Step 1: each line is `20;…;` and ends with `\r\n`; no startup banner. +- Steps 2–3: the screen keeps updating while nothing reads the serial port; lines resume when the monitor is back. + +## Results +| Date | Commit / build | Board | Line format | Screen without reader | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-ISP-001.md b/tests/bench/PLAT-ISP-001.md new file mode 100644 index 0000000..3c2d00d --- /dev/null +++ b/tests/bench/PLAT-ISP-001.md @@ -0,0 +1,23 @@ +# Bench test PLAT-ISP-001 — a v3.0 board is flashed with its BME280 fitted + +Requirement: [PLAT-ISP-001](../../requirements/platform.md#plat-isp-001). Manual test, run at bring-up step **B2** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- A v3.0 board with a BME280 breakout on J3 or J14, JP6 bridged 1–2 (I2C 0x76). +- The ISP programmer on J6, the battery or a 3 V bench supply on J13. +- The receiver ([PLAT-DECODE-003](PLAT-DECODE-003.md)). + +## Setup +1. BME280 fitted; programmer cable on J6. + +## Steps +1. Flash the board's environment (`pio run -d emitter -e --target upload`), avrdude verifying the flash. +2. Unplug the programmer and let the board run a few cycles. + +## Pass criteria +- Step 1: avrdude writes and verifies with no error, sensor still fitted. +- Step 2: the receiver shows a plausible temperature, humidity and pressure (through R9/R10 330 Ω). + +## Results +| Date | Commit / build | Board | Flash verified | Readings | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-001.md b/tests/bench/PLAT-POWER-001.md new file mode 100644 index 0000000..fbe1e55 --- /dev/null +++ b/tests/bench/PLAT-POWER-001.md @@ -0,0 +1,21 @@ +# Bench test PLAT-POWER-001 — hibernate length and sleep current + +Requirement: [PLAT-POWER-001](../../requirements/platform.md#plat-power-001). Manual test, run at bring-up step **B6** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The board under test, a multimeter in series in the J13 + wire (µA range), the receiver. + +## Setup +1. Board flashed with its environment; note `SLEEP_TIME_IN_SECONDS` (`docs/environments.md`). + +## Steps +1. Time 5 consecutive transmissions on the receiver. +2. Between two transmissions, read the current once it has settled. + +## Pass criteria +- Step 1: the interval is 8 × ⌊s / 8⌋ s (at least 8 s) plus the cycle time, within the watchdog tolerance (± 10 %). +- Step 2: below 10 µA at 3 V with the sensors off (ATtiny84A power-down with watchdog and BOD off: about 5 µA; BOD on would add about 20 µA). + +## Results +| Date | Commit / build | Board | Interval | Sleep current | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-003.md b/tests/bench/PLAT-POWER-003.md new file mode 100644 index 0000000..b941e11 --- /dev/null +++ b/tests/bench/PLAT-POWER-003.md @@ -0,0 +1,21 @@ +# Bench test PLAT-POWER-003 — pins and rails during hibernate + +Requirement: [PLAT-POWER-003](../../requirements/platform.md#plat-power-003). Manual test, run at bring-up step **B7** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The board under test asleep, a multimeter (V range). + +## Setup +1. As [PLAT-POWER-001](PLAT-POWER-001.md), between two transmissions. + +## Steps +1. Measure against GND: SENSOR_VCC (PA2), the radio DATA pin (PB0), SDA, SCL, the 1-Wire line. +2. Check the radio stays silent between transmissions (receiver: no stray frame, or a 433 MHz receiver output on a scope). + +## Pass criteria +- Step 1: all below 0.1 V. +- Step 2: no transmission outside the cycles. + +## Results +| Date | Commit / build | Board | PA2 / PB0 / SDA / SCL / 1-Wire | Radio silent | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-005.md b/tests/bench/PLAT-POWER-005.md new file mode 100644 index 0000000..4bba737 --- /dev/null +++ b/tests/bench/PLAT-POWER-005.md @@ -0,0 +1,19 @@ +# Bench test PLAT-POWER-005 — radio timings at 1 MHz + +Requirement: [PLAT-POWER-005](../../requirements/platform.md#plat-power-005). Manual test, run at bring-up step **B8** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The board under test, the receiver, an RFLink gateway if available. + +## Setup +1. Board fuses at the 1 MHz default (internal 8 MHz RC, CKDIV8). + +## Steps +1. Let the board send for 10 minutes; count decoded frames on the receiver and, if available, on the RFLink gateway. + +## Pass criteria +- Every protocol the board sends (Oregon or Lacrosse, X10, luminosity) is decoded by the receiver and by RFLink. + +## Results +| Date | Commit / build | Board | Frames decoded (receiver / RFLink) | Pass | By | Notes | +|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-006.md b/tests/bench/PLAT-POWER-006.md new file mode 100644 index 0000000..c5530f8 --- /dev/null +++ b/tests/bench/PLAT-POWER-006.md @@ -0,0 +1,21 @@ +# Bench test PLAT-POWER-006 — switched 5 V module on PB2 (LM35 variant only) + +Requirement: [PLAT-POWER-006](../../requirements/platform.md#plat-power-006). Manual test, run at bring-up step **B9** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- A board built per `hardware/tinysensor/VARIANTE_LM35.md`, with `USE_SWITCHED_5V`; a multimeter. + +## Setup +1. 5 V module and PNP on J8, LM35 on J7. + +## Steps +1. Measure the 5 V module output during a cycle and between cycles. +2. Measure PB2 against GND between cycles. + +## Pass criteria +- Step 1: 5 V present only during the measurement window, 0 V between cycles. +- Step 2: PB2 in high impedance (not driven), the PNP off. + +## Results +| Date | Commit / build | Board | 5 V in / out of window | PB2 asleep | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-007.md b/tests/bench/PLAT-POWER-007.md new file mode 100644 index 0000000..08a8d50 --- /dev/null +++ b/tests/bench/PLAT-POWER-007.md @@ -0,0 +1,20 @@ +# Bench test PLAT-POWER-007 — sensor bus pull-ups go to the switched sensor rail + +Requirement: [PLAT-POWER-007](../../requirements/platform.md#plat-power-007). Manual test, run at bring-up step **B4** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The board under test, unpowered, a multimeter (Ω range). + +## Setup +1. No battery, no sensor fitted. + +## Steps +1. Measure the resistance from SCL, SDA and the 1-Wire line (sensor connector side) to SENSOR_VCC, then to VCC. + +## Pass criteria +- About 4.7 kΩ to SENSOR_VCC on each line on v3.0 (R3, R2, R6); no direct path to VCC (much higher than to SENSOR_VCC). +- v2.2: SCL and SDA pulled to SENSOR_VCC (note the values). + +## Results +| Date | Commit / build | Board | SCL / SDA / 1-Wire to SENSOR_VCC | To VCC | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-008.md b/tests/bench/PLAT-POWER-008.md new file mode 100644 index 0000000..3afed50 --- /dev/null +++ b/tests/bench/PLAT-POWER-008.md @@ -0,0 +1,22 @@ +# Bench test PLAT-POWER-008 — awake: no internal pull-up on the sensor buses, the BME280 still reads + +Requirement: [PLAT-POWER-008](../../requirements/platform.md#plat-power-008). Manual test, run at bring-up step **B3** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. + +## Equipment +- The board under test: a v3.0 board, and the mushroom's v2.2 board once reflashed, each with its BME280. +- A scope (or a multimeter for a rough check), the receiver ([PLAT-DECODE-003](PLAT-DECODE-003.md)). + +## Setup +1. Board flashed with the current firmware (PORTA without internal pull-up). + +## Steps +1. Let the board run 10 cycles; read the values on the receiver. +2. Scope on SENSOR_VCC and SDA, triggered on SENSOR_VCC falling after the last transmission: watch until the board sleeps. + +## Pass criteria +- Step 1: every cycle gives a plausible temperature, humidity and pressure: the external pull-ups alone carry the I2C bus. +- Step 2: SENSOR_VCC and SDA fall to 0 and stay below 0.1 V while PA2 is low (no back-powering through the pull-ups). + +## Results +| Date | Commit / build | Board | 10 cycles read | SENSOR_VCC / SDA, PA2 low | Pass | By | Notes | +|---|---|---|---|---|---|---|---| diff --git a/tests/bench/bring-up.md b/tests/bench/bring-up.md new file mode 100644 index 0000000..90d7423 --- /dev/null +++ b/tests/bench/bring-up.md @@ -0,0 +1,22 @@ +# Bring-up and bench tests + +Order for a new board and for a reflash. A line ending in → links the bench test sheet that holds the procedure, the pass criteria and the results; the other lines are checks with no requirement behind them. Each sheet's *Results* table gets a line every time it is run, with the commit or build flashed. + +**A. Receiver** (needed to read the sensor boards) +1. Wiring checked against `hardware/receiver/WIRING.md`, receiver flashed. +2. Pulse capture and time base → [PLAT-DECODE-003](PLAT-DECODE-003.md) +3. OLED → [PLAT-DECODE-004](PLAT-DECODE-004.md) +4. RFLink serial lines → [PLAT-DECODE-005](PLAT-DECODE-005.md) + +**B. Sensor board** (v3.0; the mushroom's v2.2 board after a reflash) +1. Before power: the continuity checks at the end of `hardware/tinysensor/WIRING.md`; JP6 bridged 1–2 for a BME280 in I2C. +2. Flash with the BME280 fitted (v3.0 only) → [PLAT-ISP-001](PLAT-ISP-001.md) +3. Awake pin states, BME280 on the external pull-ups alone → [PLAT-POWER-008](PLAT-POWER-008.md) +4. Bus pull-ups to SENSOR_VCC → [PLAT-POWER-007](PLAT-POWER-007.md) +5. BME280 readings → [FUNC-SENSOR-001](FUNC-SENSOR-001.md) +6. Hibernate length and sleep current → [PLAT-POWER-001](PLAT-POWER-001.md) +7. Pins during hibernate → [PLAT-POWER-003](PLAT-POWER-003.md) +8. Radio timings at 1 MHz → [PLAT-POWER-005](PLAT-POWER-005.md) +9. LM35 variant only: switched 5 V → [PLAT-POWER-006](PLAT-POWER-006.md) + +The v2.0 release waits for B2, B3 and B5 on a v3.0 board and B3 on the reflashed mushroom. From 9482bb692732fef04af3ec5886c2a9a9092b28ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:49:40 +0100 Subject: [PATCH 12/32] arch(PLAT-POWER-008,PLAT-ISP-001,PLAT-DEBUG-001,PLAT-POWER-007): rows for the new PLAT requirements; deprecated TECH rows kept as design notes, AnalogFilter and dec32ToHex rows removed Co-Authored-By: Claude Opus 5.5 --- docs/architecture.md | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index aa1554f..540d889 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -42,7 +42,7 @@ graph TD | `TestHal_` | Host-native stub; records HAL calls as char tokens in `Orders` vector | — | | `OregonV3` | Encodes temperature/humidity/pressure into Oregon Scientific v2.1 frames (bit doubling, despite the class name) in the layout RFLink `Plugin_048.c` decodes: sync nibble in byte 0, IDs `EA4C`/`1A2D`/`5A5D`, rolling code byte 3, flags nibble 8, pressure byte 8 = hPa − 795 | — | | `LacrosseWS7000` | Encodes temperature/humidity/pressure/luminosity into Lacrosse WS7000 frames | — | -| `x10rf` | Encodes meter readings into X10 RF frames (battery voltage, analog sensors); routes all timing through Hal X10 delay methods | [TECH-X10-001](../requirements/technical.md#tech-x10-001), [TECH-X10-002](../requirements/technical.md#tech-x10-002) | +| `x10rf` | Encodes meter readings into X10 RF frames (battery voltage, analog sensors); routes all timing through Hal X10 delay methods | [FUNC-X10-005](../requirements/functional.md#func-x10-005), [TECH-HAL-001](../requirements/technical.md#tech-hal-001) | | `BMx280` | Abstracts BMP280/BME280 I2C sensor behind a common interface; no `Hal*`, hardware access delegated to SparkFun BME280 over TinyI2C; file-scope object in `main.cpp` | [FUNC-SENSOR-001](../requirements/functional.md#func-sensor-001), [TECH-HAL-001](../requirements/technical.md#tech-hal-001) | | `Ds18b20` | Wrapper class encapsulating DS18B20 1-Wire access; accepts `Hal*` at construction; exposes `Begin()`, `Convert()`, `Read()`; uses `hal->Delay1s()` between convert and read on AVR; stubs on non-AVR | [TECH-SENSOR-001](../requirements/technical.md#tech-sensor-001) | | `SoftSerial` | Software UART for debug logging (optional, `USE_SERIAL_LOG`) | — | @@ -52,8 +52,7 @@ graph TD | `Measurements` | Values of one cycle (`include/Measurements.h`): temperature, humidity, pressure, luminosity, each with a "present" flag | — | | `EnvironmentEncoder` | Build-time alias to `OregonV3` or `LacrosseWS7000` (`include/EnvironmentEncoder.h`) + `ConfigureEncoder()` and `ApplyMeasurements()` overloads | [FUNC-OREGON-012](../requirements/functional.md#func-oregon-012), [FUNC-LACROSSE-002](../requirements/functional.md#func-lacrosse-002), [FUNC-BATTERY-003](../requirements/functional.md#func-battery-003) | | `main.cpp` | `runCycle(Hal*)` (declared in `include/main.h`): one cycle, `hal->Init()` ([TECH-HAL-006](../requirements/technical.md#tech-hal-006)) → power on → read sensors → encode → transmit → power off → hibernate, with encoders and wrappers built from the injected `Hal*` (except the file-scope `BMx280`); `main()` (excluded under `UNIT_TEST`) = endless `runCycle(&hal)` loop | [TECH-MAIN-001](../requirements/technical.md#tech-main-001), [TECH-HAL-006](../requirements/technical.md#tech-hal-006), [FUNC-MAIN-001](../requirements/functional.md#func-main-001) | -| `AnalogFilter` | Accumulates ADC samples with configurable warm-up exclusion; returns integer floor mean | [TECH-FILTER-001](../requirements/technical.md#tech-filter-001), [TECH-FILTER-002](../requirements/technical.md#tech-filter-002) | -| `ConversionTools` | BCD-in-hex conversion utilities for 16-bit and 32-bit decimal values | [TECH-CONVERT-001](../requirements/technical.md#tech-convert-001), [TECH-CONVERT-002](../requirements/technical.md#tech-convert-002) | +| `ConversionTools` | `dec16ToHex`: BCD-in-hex conversion of a 16-bit decimal value (one digit per nibble, saturates at 0x9999) for the X10 meters | [FUNC-X10-006](../requirements/functional.md#func-x10-006), [FUNC-X10-007](../requirements/functional.md#func-x10-007) | ## Dependency Injection Map @@ -149,7 +148,7 @@ graph TD | Component | Responsibility | Requirement(s) | |-----------|----------------|----------------| -| `Loopback` (`tinyDecoders/lib/Loopback/`) | Native-only test helper: converts a `TestHal_::Orders` token sequence into `{high, durationUs}` pulses using each delay token's nominal duration, so decoder tests can be fed with real encoder output | [TECH-DECODE-001](../requirements/technical.md#tech-decode-001) | +| `Loopback` (`tinyDecoders/lib/Loopback/`) | Native-only test helper: converts a `TestHal_::Orders` token sequence into `{high, durationUs}` pulses using each delay token's nominal duration, so decoder tests can be fed with real encoder output | [FUNC-DECODE-001](../requirements/functional.md#func-decode-001) (its tests) | | `X10Decoder` (`tinyDecoders/lib/X10Decoder/`) | Rebuilds X10 RFXmeter frames from `(high, durationUs)` pulses; checks byte1 complement, packet type 0 and parity nibble; exposes `Address()` and raw `Value()` | [FUNC-DECODE-001](../requirements/functional.md#func-decode-001) | | `LacrosseDecoder` (`tinyDecoders/lib/LacrosseDecoder/`) | Rebuilds Lacrosse WS7000 frames from `(high, durationUs)` pulses; sync, `1` separators, frame length from the type nibble, XOR and sum checks; exposes `Type()`, `Address()` and measurements as integer tenths (temperature, humidity, pressure) or lux | [FUNC-DECODE-002](../requirements/functional.md#func-decode-002), [FUNC-DECODE-003](../requirements/functional.md#func-decode-003) | | `OregonDecoder` (`tinyDecoders/lib/OregonDecoder/`) | Rebuilds Oregon v2.1 frames (tinySensor `OregonV3` and commercial THN132N `EA4C`, THGR122N/228N `1A2D`, THGR918 `1A3D`, BTHR918 `5A5D`) from `(high, durationUs)` pulses; bit = level of each long pulse, windows short 150–731, long 732–1199 µs (RFLink origin, threshold at the 1024 Hz half-bit/bit midpoint), ≥ 12 one-bit preamble, LSB-first bytes from the sync nibble, frame length and checksum position from the device ID; exposes `DeviceId()`, `Channel()`, `RollingCode()`, `BatteryLow()` and the measurements the ID carries (temperature tenths, humidity %, pressure hPa) | [FUNC-DECODE-004](../requirements/functional.md#func-decode-004), [FUNC-DECODE-005](../requirements/functional.md#func-decode-005) | @@ -214,27 +213,26 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [FUNC-X10-006](../requirements/functional.md#func-x10-006) | `main.cpp` | Battery voltage BCD-encoded and transmitted via RFXmeter; suppressed when lowBattery | | [FUNC-X10-007](../requirements/functional.md#func-x10-007) | `main.cpp` | Analog sensor voltage BCD-encoded and transmitted via RFXmeter; suppressed when lowBattery | | [TECH-HAL-001](../requirements/technical.md#tech-hal-001) | `Hal` / `Attiny84aHal` / `TestHal_` / `OregonV3` / `LacrosseWS7000` / `x10rf` / `SoftSerial` / `Ds18b20` / `LightSensor` / `BMx280` | Encoders and HAL-using wrappers take Hal* at construction; BMx280 (third-party bus driver) takes none; no direct AVR register access except addresses passed to a bus driver | -| [TECH-HAL-002](../requirements/technical.md#tech-hal-002) | `TestHal_` | Orders vector char-token recording: H, L, D, P, A, S, W, Q, R, T, U, G, I | -| [TECH-HAL-003](../requirements/technical.md#tech-hal-003) | `Hal` | ComputeVccMv and ConvertAnalogValueToMv are non-virtual concrete methods on Hal base | -| [TECH-HAL-004](../requirements/technical.md#tech-hal-004) | `Attiny84aHal` | Constructor power-reduction: disables Timer1, ADC, analog comparator; `PORTA = 0` (no internal pull-up, bus pins rely on the external pull-ups of [PLAT-POWER-007](../requirements/platform.md#plat-power-007)); PA5 digital input buffer off (`DIDR0` bit `ADC5D`: PA5 has no pull-up; JP6 2–3 wires it to the BME280 SDO), pull-ups on PB2 and PB3 (PB2 cleared again with `USE_SWITCHED_5V`) | -| [TECH-HAL-005](../requirements/technical.md#tech-hal-005) | `Attiny84aHal` / `TestHal_` | LedOn/LedOff toggle PORTB PB1 on AVR; toggle IsLedOn in TestHal_ | +| [TECH-HAL-002](../requirements/technical.md#tech-hal-002) | `TestHal_` | Deprecated, kept as design note: Orders vector char-token recording: H, L, D, P, A, S, W, Q, R, T, U, G, I | +| [TECH-HAL-003](../requirements/technical.md#tech-hal-003) | `Hal` | Deprecated, kept as design note: ComputeVccMv and ConvertAnalogValueToMv are non-virtual concrete methods on Hal base | +| [PLAT-POWER-008](../requirements/platform.md#plat-power-008) | `Attiny84aHal` | Constructor power-reduction: disables Timer1, ADC, analog comparator; `PORTA = 0` (no internal pull-up, bus pins rely on the external pull-ups of [PLAT-POWER-007](../requirements/platform.md#plat-power-007)); PA5 digital input buffer off (`DIDR0` bit `ADC5D`: PA5 has no pull-up; JP6 2–3 wires it to the BME280 SDO), pull-ups on PB2 and PB3 (PB2 cleared again with `USE_SWITCHED_5V`) | +| [TECH-HAL-004](../requirements/technical.md#tech-hal-004) | — | Deprecated: now [PLAT-POWER-008](../requirements/platform.md#plat-power-008) | +| [TECH-HAL-005](../requirements/technical.md#tech-hal-005) | `Attiny84aHal` / `TestHal_` | Deprecated, kept as design note: LedOn/LedOff toggle PORTB PB1 on AVR; toggle IsLedOn in TestHal_ | | [TECH-HAL-006](../requirements/technical.md#tech-hal-006) | `main.cpp` / `Attiny84aHal` / `TestHal_` | runCycle calls Init() first, before PowerOnSensors; Init() calls TinyI2C.init() on AVR (USE_I2C); TestHal_ records 'I'; checked in test_main_cycle | -| [TECH-FILTER-001](../requirements/technical.md#tech-filter-001) | `AnalogFilter` | Discards first `exclusion` values; accumulates up to `samples`; Get() returns integer floor mean | -| [TECH-FILTER-002](../requirements/technical.md#tech-filter-002) | `AnalogFilter` | Push() after samples count reached is silently ignored; Get() returns mean of first samples values | -| [TECH-CONVERT-001](../requirements/technical.md#tech-convert-001) | `ConversionTools` | dec16ToHex packs each decimal digit of uint16_t into one nibble (BCD-in-hex) | -| [TECH-CONVERT-002](../requirements/technical.md#tech-convert-002) | `ConversionTools` | dec32ToHex packs each decimal digit of uint32_t into one nibble (BCD-in-hex) | -| [TECH-SERIAL-001](../requirements/technical.md#tech-serial-001) | `SoftSerial` | Output-only UART at 9600 baud; one SerialWriteBit call per bit, bit period (1 000 000 / 9600) − 25 µs held by the HAL | +| [TECH-CONVERT-001](../requirements/technical.md#tech-convert-001) | `ConversionTools` | Deprecated, kept as design note: dec16ToHex packs each decimal digit of uint16_t into one nibble (BCD-in-hex) | +| [PLAT-DEBUG-001](../requirements/platform.md#plat-debug-001) | `SoftSerial` | Output-only UART at 9600 baud on PA7 (`DIGITAL_OUT`); one SerialWriteBit call per bit, bit period (1 000 000 / 9600) − 25 µs held by the HAL | +| [TECH-SERIAL-001](../requirements/technical.md#tech-serial-001) | — | Deprecated: now [PLAT-DEBUG-001](../requirements/platform.md#plat-debug-001) | | [TECH-MAIN-001](../requirements/technical.md#tech-main-001) | `main.cpp` / `include/main.h` / `platformio.ini` | One cycle extracted into `runCycle(Hal*)`; encoders built from the injected Hal, BMx280 file-scope; `main()` only loops on runCycle, excluded under UNIT_TEST; five `native_cycle_*` envs run `test_main_cycle` | | [TECH-SERIAL-002](../requirements/technical.md#tech-serial-002) | `main.cpp` | Draft. SoftSerial instantiated and SerialPrintInfo active only when USE_SERIAL_LOG defined; otherwise no-op; no build environment sets USE_SERIAL_LOG | -| [TECH-X10-001](../requirements/technical.md#tech-x10-001) | `Hal` / `Attiny84aHal` / `TestHal_` | Five new pure-virtual Hal methods: DelayX10PreambleHigh (8960 µs), DelayX10PreambleLow (4500 µs), DelayX10BitShort (560 µs), DelayX10BitLong (1120 µs), DelayX10Gap (40000 µs) | -| [TECH-X10-002](../requirements/technical.md#tech-x10-002) | `x10rf` | x10rf replaces all file-static _delay_us() calls with the five new Hal timing methods; block removed | +| [TECH-X10-001](../requirements/technical.md#tech-x10-001) | `Hal` / `Attiny84aHal` / `TestHal_` | Deprecated, kept as design note: Five new pure-virtual Hal methods: DelayX10PreambleHigh (8960 µs), DelayX10PreambleLow (4500 µs), DelayX10BitShort (560 µs), DelayX10BitLong (1120 µs), DelayX10Gap (40000 µs) | +| [TECH-X10-002](../requirements/technical.md#tech-x10-002) | `x10rf` | Deprecated, kept as design note: x10rf replaces all file-static _delay_us() calls with the five new Hal timing methods; block removed | | [FUNC-BATTERY-001](../requirements/functional.md#func-battery-001) | `Hal` / `main.cpp` | ComputeVccMv reads internal 1.1 V ADC ref; calibrated constant supplied as INTERNAL_1v1 build flag | | [FUNC-BATTERY-002](../requirements/functional.md#func-battery-002) | `Hal` / `main.cpp` / `include/config.h` | batteryVoltageInMv = vccMv (BATTERY_IS_VCC) or ConvertAnalogValueToMv(GetRawBattery(), vccMv) × BATTERY_DIVIDER (default 1) | | [FUNC-BATTERY-003](../requirements/functional.md#func-battery-003) | `main.cpp` | lowBattery flag gates Oregon SetBatteryLow and suppresses all RFXmeter and luminosity transmissions | | [FUNC-SENSOR-001](../requirements/functional.md#func-sensor-001) | `BMx280` | Wraps BMP280/BME280 at I2C 0x76; Begin/GetTemperature/GetPressure/GetHumidity/Shutdown interface | | [FUNC-SENSOR-002](../requirements/functional.md#func-sensor-002) | `Ds18b20` | Draft. ds18b20convert + ds18b20read on PA3; raw / 16 = temperature in °C; accessed only through Ds18b20 wrapper | | [TECH-SENSOR-001](../requirements/technical.md#tech-sensor-001) | `Ds18b20` | Draft. DS18B20 access encapsulated in Ds18b20 wrapper; main.cpp must not reference PORTA/DDRA/PINA or ds18b20 library functions directly; PA3 to be released (input, no pull-up, not driven) after `Read()`, not implemented | -| [TECH-SENSOR-002](../requirements/technical.md#tech-sensor-002) | `BMx280` | `Begin`, `GetTemperature` (°C), `GetPressure` (Pa), `GetHumidity` (%), `Shutdown`; SparkFun BME280 library at 0x76 on AVR, stubs returning 0 on native; no `Hal*` | +| [TECH-SENSOR-002](../requirements/technical.md#tech-sensor-002) | `BMx280` | Deprecated, kept as design note: `Begin`, `GetTemperature` (°C), `GetPressure` (Pa), `GetHumidity` (%), `Shutdown`; SparkFun BME280 library at 0x76 on AVR, stubs returning 0 on native; no `Hal*` | | [FUNC-SENSOR-003](../requirements/functional.md#func-sensor-003) | `LightSensor` / `LacrosseWS7000` | While the battery is not low: BH1750 at I2C 0x23 ONE_TIME_HIGH_RES_MODE, 150 ms wait, lux reported as two Lacrosse type-5 frames | | [FUNC-ANALOG-001](../requirements/functional.md#func-analog-001) | `Hal` / `main.cpp` | GetRawAnalogSensor() reads PA0; ConvertAnalogValueToMv converts to mV using vccMv from [FUNC-BATTERY-001](../requirements/functional.md#func-battery-001) | | [FUNC-MAIN-001](../requirements/functional.md#func-main-001) | `main.cpp` | Environment frame sent twice per cycle; radio low between the copies for at least one frame length (Oregon ≥ 246 ms, Lacrosse ≥ 98 ms); X10 and luminosity frames unchanged | @@ -258,9 +256,10 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [PLAT-POWER-004](../requirements/platform.md#plat-power-004) | `main.cpp` | TRANSMIT_WITH_LED macro wraps every Send(): LedOn() before, LedOff() + Delay30ms() after | | [PLAT-POWER-005](../requirements/platform.md#plat-power-005) | `Attiny84aHal` / `platformio.ini` | ATtiny84a at F_CPU = 1 000 000 L; all HAL delay methods calibrated to this frequency | | [PLAT-POWER-006](../requirements/platform.md#plat-power-006) | `Attiny84aHal` | `USE_SWITCHED_5V`: PORTB.2 cleared in constructor; PowerOnSensors() sets DDRB.2 (PB2 low, PNP on), PowerOffSensors() clears it (high impedance) | -| [PLAT-POWER-007](../requirements/platform.md#plat-power-007) | board (`hardware/tinysensor`) | Board requirement, every board (v2.2: pull-ups to SENSOR_VCC, BME280 bench check with this firmware pending); on v3.0: I2C pull-ups R3 (SCL, PA4) / R2 (SDA, PA6), sensor side of the R9/R10 330 Ω series resistors and 1-Wire pull-up R6 (PA3), 4.7 kΩ to SENSOR_VCC (PA2); buses unpowered while PA2 is low. Firmware side: no internal pull-up on these pins ([TECH-HAL-004](../requirements/technical.md#tech-hal-004)); PA3 released after the DS18B20 read ([TECH-SENSOR-001](../requirements/technical.md#tech-sensor-001), draft, not implemented) | -| [TECH-HAL-007](../requirements/technical.md#tech-hal-007) | `Attiny84aHal` / `main.cpp` | `Hibernate(s)` → static `sleep(s)` (`s >> 3`, min 1; saves/restores PRR, DDRA, DDRB, PORTA, PORTB; `sleep_bod_disable()` before each `sleep_cpu()`); `PowerOnSensors`/`PowerOffSensors` drive PA2 (and `DDRB.2` with `USE_SWITCHED_5V`); `TRANSMIT_WITH_LED(code)` = `LedOn`, code, `LedOff`, `Delay30ms` | -| [TECH-DECODE-001](../requirements/technical.md#tech-decode-001) | `Loopback` (tinyDecoders) | Orders tokens to level/duration pulses with nominal durations (A 400, D 512, P 1024, T 560, U 1120, Q 8960, R 4500, G 40000 µs); native env of tinyDecoders builds repo `lib/` | +| [PLAT-POWER-007](../requirements/platform.md#plat-power-007) | board (`hardware/tinysensor`) | Board requirement, every board (v2.2: pull-ups to SENSOR_VCC, bench sheet `tests/bench/PLAT-POWER-007.md`); on v3.0: I2C pull-ups R3 (SCL, PA4) / R2 (SDA, PA6), sensor side of the R9/R10 330 Ω series resistors and 1-Wire pull-up R6 (PA3), 4.7 kΩ to SENSOR_VCC (PA2); buses unpowered while PA2 is low. Firmware side: no internal pull-up on these pins ([PLAT-POWER-008](../requirements/platform.md#plat-power-008)); PA3 released after the DS18B20 read ([TECH-SENSOR-001](../requirements/technical.md#tech-sensor-001), draft, not implemented) | +| [PLAT-ISP-001](../requirements/platform.md#plat-isp-001) | board (`hardware/tinysensor`) | v3.0: R9 (SCL) / R10 (SDA) 330 Ω between the MCU pins (nets `SCK` / `MOSI`, ISP header J6) and the sensor connectors (nets `SCL` / `SDA`), pull-ups R3 / R2 on the sensor side | +| [TECH-HAL-007](../requirements/technical.md#tech-hal-007) | `Attiny84aHal` / `main.cpp` | Deprecated, kept as design note: `Hibernate(s)` → static `sleep(s)` (`s >> 3`, min 1; saves/restores PRR, DDRA, DDRB, PORTA, PORTB; `sleep_bod_disable()` before each `sleep_cpu()`); `PowerOnSensors`/`PowerOffSensors` drive PA2 (and `DDRB.2` with `USE_SWITCHED_5V`); `TRANSMIT_WITH_LED(code)` = `LedOn`, code, `LedOff`, `Delay30ms` | +| [TECH-DECODE-001](../requirements/technical.md#tech-decode-001) | `Loopback` (tinyDecoders) | Deprecated, kept as design note: Orders tokens to level/duration pulses with nominal durations (A 400, D 512, P 1024, T 560, U 1120, Q 8960, R 4500, G 40000 µs); native env of tinyDecoders builds repo `lib/` | | [FUNC-DECODE-001](../requirements/functional.md#func-decode-001) | `X10Decoder` (tinyDecoders) | `Feed(high, durationUs)` true on the last bit of a valid RFXmeter frame; windows nominal ±30 % (Q 8960 / R 4500, bit 560 high, 560 or 1680 low); `Address()` = b0, `Value()` = (b4<<16)\|(b2<<8)\|b3 | | [FUNC-DECODE-002](../requirements/functional.md#func-decode-002) | `LacrosseDecoder` (tinyDecoders) | `Feed(high, durationUs)` true on the high pulse of the last separator of a valid WS7000 frame; bit 1 = 400/800, 0 = 800/400 µs ±30 %; ≥ 6 zero bits sync; types 0/1/4/5 → 3/6/10/7 data nibbles; `Type()`, `Address()` | | [FUNC-DECODE-003](../requirements/functional.md#func-decode-003) | `LacrosseDecoder` (tinyDecoders) | `TemperatureTenths()` (signed by address bit 3), `HumidityTenths()`, `PressureTenths()` (+2000), `Lux()` = mantissa × 10^d4 capped at 65535; 0 when the type does not carry the value | @@ -270,7 +269,7 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [UI-DECODE-001](../requirements/ui.md#ui-decode-001) | `PageFormatter` / `Receiver` (tinyDecoders) | `FormatPage(record, alternate, big[7], top[5], bottom[5])`; big = first of temperature `[-]I.T°`, lux `N` (1–5 digits) + `LuxUnit` cell, volts `I.FFV`; top = Oregon `ch-code` (2 lowercase hex), `L` + Lacrosse id, `X` + X10 id, right-aligned; bottom = humidity `NN%` (capped 99) or pressure hPa without unit, `alternate` picks pressure when both; no age, no protocol name; `Receiver` places `big` with `DrawBigChar` cols 0–5, `top` with `DrawChar` page 0 cols 12–15, `bottom` with `DrawChar` page 2 cols 12–15 (14 cells, whole 128x32 screen) | | [UI-DECODE-002](../requirements/ui.md#ui-decode-002) | `Font8x16` (tinyDecoders) | `ReadGlyph(c, glyph[16])` from `PROGMEM`; 32 glyphs ([UI-DECODE-001](../requirements/ui.md#ui-decode-001) set + `Waiting for data`); bytes 0–7 top page, 8–15 bottom page, bit 0 = top pixel; `'\x7F'` drawn as `°`; unknown and space give zeros; Spleen 8x16, BSD-2-Clause | | [UI-DECODE-003](../requirements/ui.md#ui-decode-003) | `Font8x16` (tinyDecoders) | `ReadBigGlyphPage(c, page 0–3, bytes[16])`: glyph byte `(page/2)*8 + x/2`, low nibble on even pages, high on odd, each bit doubled; no table; `LuxUnit`: pages 0–1 zero, pages 2–3 = 8x16 `l` (cols 0–7) and `x` (cols 8–15) | -| [TECH-DECODE-004](../requirements/technical.md#tech-decode-004) | `PageFormatter` / `Font8x16` (tinyDecoders) | `FormatPage(record, alternate, big, top, bottom)`; `ReadGlyph(c, glyph[16])` from a `PROGMEM` table (SSD1306 page byte order, generated by `scripts/gen_font8x16.py`); `ReadBigGlyphPage(c, page, bytes[16])` computed, no table; lux unit cell = `LuxUnit` `'\x01'`, drawn by `ReadBigGlyphPage` as small `lx` | +| [TECH-DECODE-004](../requirements/technical.md#tech-decode-004) | `PageFormatter` / `Font8x16` (tinyDecoders) | Deprecated, kept as design note: `FormatPage(record, alternate, big, top, bottom)`; `ReadGlyph(c, glyph[16])` from a `PROGMEM` table (SSD1306 page byte order, generated by `scripts/gen_font8x16.py`); `ReadBigGlyphPage(c, page, bytes[16])` computed, no table; lux unit cell = `LuxUnit` `'\x01'`, drawn by `ReadBigGlyphPage` as small `lx` | | [TECH-DECODE-002](../requirements/technical.md#tech-decode-002) | `ReceiverHal` / `TestReceiverHal` (tinyDecoders) | `typedef` per MCU (`__AVR_ATmega328P__` or `__AVR_ATmega32U4__` to `AtmegaReceiverHal`, native), `#error` otherwise; `PopPulse`, `NowSeconds`, `DrawChar(page 0–2, col, c)`, `DrawBigChar(col 0–5, c)`, `HasLineOutput`, `WriteLine`; double adds `PushPulse`, `SetNowSeconds`, `Row(page)`, `Big`, `DrawCount`, `Lines`; consumers take `ReceiverHal*` at construction | | [FUNC-DECODE-007](../requirements/functional.md#func-decode-007) | `Receiver` (tinyDecoders) | `Poll()`: pulses to X10, Lacrosse, Oregon decoders, `Update` on true; on new second or frame `Expire` then page `(now / 10) % Count()`, `alternate = (now / 2) % 2`; waiting page `Waiting for data` at page 1 only while the table is empty; source cells drawn big 0–5, then identifier, then second value (positions per [UI-DECODE-001](../requirements/ui.md#ui-decode-001)); layout switch redraws all cells (blank source cells before the waiting text); at most one draw per call | | [CONF-BUILD-015](../requirements/configuration.md#conf-build-015) | `.github/workflows/main.yml` | `test-native` runs `native_debug` and all five `native_cycle_*` envs; `build-avr` matrix = `default_envs` (incl. `mushroom`), artifacts `firmware-`, needed by `release` | @@ -284,4 +283,4 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [PLAT-DECODE-005](../requirements/platform.md#plat-decode-005) | `AtmegaReceiverHal` (tinyDecoders) | `Serial.begin(57600)`: debug UART TX D1 (Pro Mini, adapter optional) or USB CDC (Pro Micro); `WriteLine` drops the line when `availableForWrite() < len + 2`, else line + `\r\n`; no `operator bool`; input ignored, no banner | | [CONF-DECODE-003](../requirements/configuration.md#conf-decode-003) | `tinyDecoders/platformio.ini` / `tinyDecoders/src/main.cpp` | env `promicro` (production): `sparkfun_promicro16`, Arduino framework, avr109 upload; shared `src/main.cpp`, no `build_src_filter` | | [CONF-DECODE-004](../requirements/configuration.md#conf-decode-004) | `tinyDecoders/platformio.ini` / `tinyDecoders/src/main.cpp` | env `promini` (alternative build): `pro16MHzatmega328`, Arduino framework, default `arduino` upload through a USB-serial adapter, no `lib_deps`, `-DSERIAL_TX_BUFFER_SIZE=128`, USB 5 V on VCC; shared `src/main.cpp` | -| [TECH-DECODE-005](../requirements/technical.md#tech-decode-005) | `tinyDecoders/src/main.cpp` / `AtmegaReceiverHal` (tinyDecoders) | file-scope `hal` + `receiver`, `setup()` → `Init()`, `loop()` → `Poll()`; `ISR(TIMER1_CAPT_vect)`, `ISR(TIMER1_OVF_vect)`, `ATOMIC_BLOCK` reads; `Wire` at 400 kHz; `Serial.begin(57600)`, `availableForWrite()` guard, no `operator bool` | +| [TECH-DECODE-005](../requirements/technical.md#tech-decode-005) | `tinyDecoders/src/main.cpp` / `AtmegaReceiverHal` (tinyDecoders) | Deprecated, kept as design note: file-scope `hal` + `receiver`, `setup()` → `Init()`, `loop()` → `Poll()`; `ISR(TIMER1_CAPT_vect)`, `ISR(TIMER1_OVF_vect)`, `ATOMIC_BLOCK` reads; `Wire` at 400 kHz; `Serial.begin(57600)`, `availableForWrite()` guard, no `operator bool` | From 53e7b93175b678fadfd7f39cf7531971e660948c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 10:49:55 +0100 Subject: [PATCH 13/32] docs: point WIRING and BACKLOG to PLAT-POWER-008 (TECH-HAL-004 deprecated) Co-Authored-By: Claude Opus 5.5 --- hardware/tinysensor/BACKLOG.md | 2 +- hardware/tinysensor/WIRING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hardware/tinysensor/BACKLOG.md b/hardware/tinysensor/BACKLOG.md index d3abdb3..b70c239 100644 --- a/hardware/tinysensor/BACKLOG.md +++ b/hardware/tinysensor/BACKLOG.md @@ -22,7 +22,7 @@ Full reports, ERC/DRC and images: `review/2026-11-06/`. Rework of the already-bu | R8 | ✅ v3.0 (Minor) | Power | The global decoupling (2 × 10 µF) is weak for a CR2032, whose internal resistance is 10–20 Ω, against the radio current peak. | 100–470 µF low-leakage for the CR2032 versions. ✅ v3.0: C1 220 µF low-leakage for a CR2032 (2026-11-18). | S | | R9 | ✅ v3.0 (Minor) | Power | JP2 "DIRECT Vcc" shorts the DC-DC input to its output if J2 is fitted. | Note "JP2 closed ⇒ J2 not fitted". The firmware must then use `BATTERY_IS_VCC`. | S | | R10 | Question | Power | The J2 DC-DC module has no enable pin. Its quiescent current (often 10–100 µA) probably exceeds the sleeping ATtiny's. | **Decided (2026-11-07):** TPS63020 buck-boost module (Tars stock), wired to the J2 pads as in `REWORK_v2.2.md`. ◐ v3.0: J2 becomes a 1×03 header (1 +BATT, 2 GND, 3 VCC) on the same pads; v3.0 choice (2026-11-07): 2 AA or AAA cells on J13 and a 3.3 V boost module (in stock) on J2. A boost does not regulate if Vin > 3.3 V: with an 18650 (BT1), the TPS63020 buck-boost is needed. Without BME280 (DS18B20 on J5 or 3-pin analog sensor on J7, both up to 5.5 V), an 18650 with a boost is fine. v3.0 silkscreen: "18650: TPS63020, or boost without BME280". Measure its idle current (< 0.1 mA). | M | -| R11 | ✅ v3.0 (Question) | I2C | The BME280 CSB pin (J3.5) is floating; if seen low, the sensor goes into SPI. SDO is on GND, hence address 0x76, matching the firmware. | Tie CSB to SENSOR_VCC, or check that the breakout pulls it up. SDO selects the address in I2C (GND = 0x76, the firmware's), and is the data output in SPI: decided, it is an assembly-time choice through JP6 (see P4), with a note on the schematic. Beware: PA5 has no pull-up (`PORTA = 0`, TECH-HAL-004), so SDO wired to MISO (JP6 2-3) in I2C would float and leave the address undefined. | S | +| R11 | ✅ v3.0 (Question) | I2C | The BME280 CSB pin (J3.5) is floating; if seen low, the sensor goes into SPI. SDO is on GND, hence address 0x76, matching the firmware. | Tie CSB to SENSOR_VCC, or check that the breakout pulls it up. SDO selects the address in I2C (GND = 0x76, the firmware's), and is the data output in SPI: decided, it is an assembly-time choice through JP6 (see P4), with a note on the schematic. Beware: PA5 has no pull-up (`PORTA = 0`, PLAT-POWER-008), so SDO wired to MISO (JP6 2-3) in I2C would float and leave the address undefined. | S | | R12 | Question | I2C | The BH1750 (`USE_BH1750`, 0x23, env SOLAR_TEST) does not appear in the schematic. | Document it on the second I2C connector once R6 is done, with ADDR at 0. | S | | R13 | Question | Power | `USE_CHARGE_PUMP` (`platformio.ini`, envs `S_02` and `S_03`) is used by no code and matches no circuit. The TP4056 charger is not in the schematic. | Drop the flag or document the hardware concerned. | S | | R14 | Question | MCU | The fuses are not recorded, BODLEVEL in particular. The firmware turns the BOD off during sleep. | Record the intended fuses in the repository (BOD 1.8 V at 1 MHz). | S | diff --git a/hardware/tinysensor/WIRING.md b/hardware/tinysensor/WIRING.md index ad90479..06afb87 100644 --- a/hardware/tinysensor/WIRING.md +++ b/hardware/tinysensor/WIRING.md @@ -95,7 +95,7 @@ Module pin orders differ (an FS1000A is DATA/VCC/GND): match the pins by name, n - Mushroom: no wire, the breakout's 6-pin male header plugs into a 6-way 2.54 mm female header soldered under the board in J3. - CSB is not connected on the board: the breakout must pull it up (≈ 10 kΩ to VIN), otherwise the sensor starts in SPI. Check with a meter; if it is missing, add 10 kΩ from CSB to VIN on the breakout. The working v2.2 mushroom board has such a 10 kΩ on CSB. -- SDO needs no resistor: JP6 1-2 ties it straight to GND (address 0x76), as pad 6 of the v2.2 "I2C" footprint does. With JP6 2-3, SDO goes to MISO (PA5), which has no pull-up (`PORTA = 0`, TECH-HAL-004): in I2C mode it would float and the sensor address would be undefined. +- SDO needs no resistor: JP6 1-2 ties it straight to GND (address 0x76), as pad 6 of the v2.2 "I2C" footprint does. With JP6 2-3, SDO goes to MISO (PA5), which has no pull-up (`PORTA = 0`, PLAT-POWER-008): in I2C mode it would float and the sensor address would be undefined. ### DS18B20 on J5 From 45978971d7635f860adaaf8af21d8bedd7e580ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 12:05:24 +0100 Subject: [PATCH 14/32] plan: bench sheets carry an @req tag like tests; tag convention @req {id} matches C++ and Markdown Co-Authored-By: Claude Opus 5.5 --- .rbd/config.yml | 3 ++- CLAUDE.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.rbd/config.yml b/.rbd/config.yml index 7159d73..9a0b19b 100644 --- a/.rbd/config.yml +++ b/.rbd/config.yml @@ -6,7 +6,8 @@ id_format: test_tagging: language: cpp framework: unity - convention: "// @req {id}" # placed above the test function + convention: "@req {id}" # C++: "// @req {id}" above the test function; bench sheet: "" on its first line + bench_sheets: "tests/bench/{id}.md" # manual test of a requirement no software test can cover linter: # tinyDecoders/ is the 433 MHz receiver sub-project; its .pio/ build tree is skipped diff --git a/CLAUDE.md b/CLAUDE.md index e5c27c3..f2cb790 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -71,7 +71,7 @@ This project uses Requirement-Based Development. **Every code change must origin - Requirements live in `requirements/*.md` (functional, technical, performance, ui, configuration, platform). - Architecture is tracked in `docs/architecture.md` — updated with an `arch(ID):` commit whenever a requirement changes the component diagram. - Commit prefixes are mandatory: `req()`, `test()`, `feat()`, `tech()`, `perf()`, `ui()`, `conf()`, `arch()`, `plan:`. -- Every Unity test function must carry a `// @req FUNC-DOMAIN-NNN` tag on the line above it. +- Every Unity test function must carry a `// @req FUNC-DOMAIN-NNN` tag on the line above it, and every bench sheet a `` tag on its first line. - ID format: `FUNC-DOMAIN-NNN` (e.g. `FUNC-OREGON-001`, `TECH-HAL-001`). Requirements are a spec, not a plan. Each one passes four checks: @@ -82,7 +82,7 @@ Requirements are a spec, not a plan. Each one passes four checks: - The "how" (classes, helpers, registers, file layout) goes in `docs/architecture.md` and code comments. - **No test information in a requirement**: no "Verification:", "Test:", "Verified by", "native test", "bench check pending". Input → output examples that define the behaviour stay, as "Examples:". - A helper's unit tests are tagged with the requirement whose behaviour uses the helper (`dec16ToHex` tests → FUNC-X10-006/007). -- A requirement no software test can cover gets a bench test sheet `tests/bench/.md` (requirement link, equipment, setup, steps, pass criteria, results table filled at each run); `tests/bench/bring-up.md` gives the order. +- A requirement no software test can cover gets a bench test sheet `tests/bench/.md`, tagged like a test: `` on its first line, one line per requirement it covers (requirement link, equipment, setup, steps, pass criteria, results table filled at each run); `tests/bench/bring-up.md` gives the order. To start a new requirement: invoke `/rbd` and describe the intent. The workflow dispatches `requirement-analyst` → `test-builder` → `code-builder` in sequence. From 49a0bc4fb13609850c47302357e1d96e5091c462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 12:05:24 +0100 Subject: [PATCH 15/32] test(PLAT-DECODE-003..005,PLAT-ISP-001,PLAT-POWER-001,PLAT-POWER-003,PLAT-POWER-005..008,FUNC-SENSOR-001): @req tag on each bench sheet Co-Authored-By: Claude Opus 5.5 --- tests/bench/FUNC-SENSOR-001.md | 1 + tests/bench/PLAT-DECODE-003.md | 1 + tests/bench/PLAT-DECODE-004.md | 1 + tests/bench/PLAT-DECODE-005.md | 1 + tests/bench/PLAT-ISP-001.md | 1 + tests/bench/PLAT-POWER-001.md | 1 + tests/bench/PLAT-POWER-003.md | 1 + tests/bench/PLAT-POWER-005.md | 1 + tests/bench/PLAT-POWER-006.md | 1 + tests/bench/PLAT-POWER-007.md | 1 + tests/bench/PLAT-POWER-008.md | 1 + 11 files changed, 11 insertions(+) diff --git a/tests/bench/FUNC-SENSOR-001.md b/tests/bench/FUNC-SENSOR-001.md index 4c5a26a..7f6ac73 100644 --- a/tests/bench/FUNC-SENSOR-001.md +++ b/tests/bench/FUNC-SENSOR-001.md @@ -1,3 +1,4 @@ + # Bench test FUNC-SENSOR-001 — BME280 readings over several cycles Requirement: [FUNC-SENSOR-001](../../requirements/functional.md#func-sensor-001). Manual test, run at bring-up step **B5** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-DECODE-003.md b/tests/bench/PLAT-DECODE-003.md index 30e0341..f1bc24a 100644 --- a/tests/bench/PLAT-DECODE-003.md +++ b/tests/bench/PLAT-DECODE-003.md @@ -1,3 +1,4 @@ + # Bench test PLAT-DECODE-003 — receiver captures the radio pulses and keeps time Requirement: [PLAT-DECODE-003](../../requirements/platform.md#plat-decode-003). Manual test, run at bring-up step **A2** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-DECODE-004.md b/tests/bench/PLAT-DECODE-004.md index a6c805e..e06a230 100644 --- a/tests/bench/PLAT-DECODE-004.md +++ b/tests/bench/PLAT-DECODE-004.md @@ -1,3 +1,4 @@ + # Bench test PLAT-DECODE-004 — receiver drives the SSD1306 OLED Requirement: [PLAT-DECODE-004](../../requirements/platform.md#plat-decode-004). Manual test, run at bring-up step **A3** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-DECODE-005.md b/tests/bench/PLAT-DECODE-005.md index 48282e3..c9e2af8 100644 --- a/tests/bench/PLAT-DECODE-005.md +++ b/tests/bench/PLAT-DECODE-005.md @@ -1,3 +1,4 @@ + # Bench test PLAT-DECODE-005 — receiver writes RFLink lines without blocking Requirement: [PLAT-DECODE-005](../../requirements/platform.md#plat-decode-005). Manual test, run at bring-up step **A4** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-ISP-001.md b/tests/bench/PLAT-ISP-001.md index 3c2d00d..7c6f215 100644 --- a/tests/bench/PLAT-ISP-001.md +++ b/tests/bench/PLAT-ISP-001.md @@ -1,3 +1,4 @@ + # Bench test PLAT-ISP-001 — a v3.0 board is flashed with its BME280 fitted Requirement: [PLAT-ISP-001](../../requirements/platform.md#plat-isp-001). Manual test, run at bring-up step **B2** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-POWER-001.md b/tests/bench/PLAT-POWER-001.md index fbe1e55..d281fcc 100644 --- a/tests/bench/PLAT-POWER-001.md +++ b/tests/bench/PLAT-POWER-001.md @@ -1,3 +1,4 @@ + # Bench test PLAT-POWER-001 — hibernate length and sleep current Requirement: [PLAT-POWER-001](../../requirements/platform.md#plat-power-001). Manual test, run at bring-up step **B6** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-POWER-003.md b/tests/bench/PLAT-POWER-003.md index b941e11..ed31cb2 100644 --- a/tests/bench/PLAT-POWER-003.md +++ b/tests/bench/PLAT-POWER-003.md @@ -1,3 +1,4 @@ + # Bench test PLAT-POWER-003 — pins and rails during hibernate Requirement: [PLAT-POWER-003](../../requirements/platform.md#plat-power-003). Manual test, run at bring-up step **B7** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-POWER-005.md b/tests/bench/PLAT-POWER-005.md index 4bba737..ab0c526 100644 --- a/tests/bench/PLAT-POWER-005.md +++ b/tests/bench/PLAT-POWER-005.md @@ -1,3 +1,4 @@ + # Bench test PLAT-POWER-005 — radio timings at 1 MHz Requirement: [PLAT-POWER-005](../../requirements/platform.md#plat-power-005). Manual test, run at bring-up step **B8** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-POWER-006.md b/tests/bench/PLAT-POWER-006.md index c5530f8..6912515 100644 --- a/tests/bench/PLAT-POWER-006.md +++ b/tests/bench/PLAT-POWER-006.md @@ -1,3 +1,4 @@ + # Bench test PLAT-POWER-006 — switched 5 V module on PB2 (LM35 variant only) Requirement: [PLAT-POWER-006](../../requirements/platform.md#plat-power-006). Manual test, run at bring-up step **B9** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-POWER-007.md b/tests/bench/PLAT-POWER-007.md index 08a8d50..a3ff845 100644 --- a/tests/bench/PLAT-POWER-007.md +++ b/tests/bench/PLAT-POWER-007.md @@ -1,3 +1,4 @@ + # Bench test PLAT-POWER-007 — sensor bus pull-ups go to the switched sensor rail Requirement: [PLAT-POWER-007](../../requirements/platform.md#plat-power-007). Manual test, run at bring-up step **B4** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. diff --git a/tests/bench/PLAT-POWER-008.md b/tests/bench/PLAT-POWER-008.md index 3afed50..1c3e348 100644 --- a/tests/bench/PLAT-POWER-008.md +++ b/tests/bench/PLAT-POWER-008.md @@ -1,3 +1,4 @@ + # Bench test PLAT-POWER-008 — awake: no internal pull-up on the sensor buses, the BME280 still reads Requirement: [PLAT-POWER-008](../../requirements/platform.md#plat-power-008). Manual test, run at bring-up step **B3** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. From 68d05104bc61479bed0bbd5a11885b6477d0e867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 12:07:58 +0100 Subject: [PATCH 16/32] plan: bench tests are run by hand before each release; a release is tagged only when every sheet passes for it Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index f2cb790..3eec379 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -82,7 +82,7 @@ Requirements are a spec, not a plan. Each one passes four checks: - The "how" (classes, helpers, registers, file layout) goes in `docs/architecture.md` and code comments. - **No test information in a requirement**: no "Verification:", "Test:", "Verified by", "native test", "bench check pending". Input → output examples that define the behaviour stay, as "Examples:". - A helper's unit tests are tagged with the requirement whose behaviour uses the helper (`dec16ToHex` tests → FUNC-X10-006/007). -- A requirement no software test can cover gets a bench test sheet `tests/bench/.md`, tagged like a test: `` on its first line, one line per requirement it covers (requirement link, equipment, setup, steps, pass criteria, results table filled at each run); `tests/bench/bring-up.md` gives the order. +- A requirement no software test can cover gets a bench test sheet `tests/bench/.md`, tagged like a test: `` on its first line, one line per requirement it covers (requirement link, equipment, setup, steps, pass criteria, results table filled at each run); Bench tests are run by hand before each release, in the order of `tests/bench/bring-up.md`; a release is tagged only when every sheet has a passing line for it. To start a new requirement: invoke `/rbd` and describe the intent. The workflow dispatches `requirement-analyst` → `test-builder` → `code-builder` in sequence. From 5ad52ad184dae849b4b32eda35cbe47a01651cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 12:07:58 +0100 Subject: [PATCH 17/32] test(PLAT-DECODE-003..005,PLAT-ISP-001,PLAT-POWER-001,PLAT-POWER-003,PLAT-POWER-005..008,FUNC-SENSOR-001): bench sheets run per release, one Results line per release Co-Authored-By: Claude Opus 5.5 --- tests/bench/FUNC-SENSOR-001.md | 4 ++-- tests/bench/PLAT-DECODE-003.md | 4 ++-- tests/bench/PLAT-DECODE-004.md | 4 ++-- tests/bench/PLAT-DECODE-005.md | 4 ++-- tests/bench/PLAT-ISP-001.md | 4 ++-- tests/bench/PLAT-POWER-001.md | 4 ++-- tests/bench/PLAT-POWER-003.md | 4 ++-- tests/bench/PLAT-POWER-005.md | 4 ++-- tests/bench/PLAT-POWER-006.md | 4 ++-- tests/bench/PLAT-POWER-007.md | 4 ++-- tests/bench/PLAT-POWER-008.md | 4 ++-- tests/bench/bring-up.md | 6 +++--- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/bench/FUNC-SENSOR-001.md b/tests/bench/FUNC-SENSOR-001.md index 7f6ac73..6988907 100644 --- a/tests/bench/FUNC-SENSOR-001.md +++ b/tests/bench/FUNC-SENSOR-001.md @@ -1,7 +1,7 @@ # Bench test FUNC-SENSOR-001 — BME280 readings over several cycles -Requirement: [FUNC-SENSOR-001](../../requirements/functional.md#func-sensor-001). Manual test, run at bring-up step **B5** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [FUNC-SENSOR-001](../../requirements/functional.md#func-sensor-001). Manual test, run before each release, at step **B5** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The board under test with its BME280, the receiver ([PLAT-DECODE-003](PLAT-DECODE-003.md)), a reference thermometer / hygrometer and the local sea-level pressure (weather service). @@ -18,5 +18,5 @@ Requirement: [FUNC-SENSOR-001](../../requirements/functional.md#func-sensor-001) - Within the BME280 accuracy of the reference: ± 1 °C, ± 3 %, pressure ± 2 hPa (pressure is station pressure, not sea level: compare with altitude in mind). ## Results -| Date | Commit / build | Board | T / H / P (board) | T / H / P (reference) | Pass | By | Notes | +| Date | Release (tag / commit) | Board | T / H / P (board) | T / H / P (reference) | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-DECODE-003.md b/tests/bench/PLAT-DECODE-003.md index f1bc24a..ad2930a 100644 --- a/tests/bench/PLAT-DECODE-003.md +++ b/tests/bench/PLAT-DECODE-003.md @@ -1,7 +1,7 @@ # Bench test PLAT-DECODE-003 — receiver captures the radio pulses and keeps time -Requirement: [PLAT-DECODE-003](../../requirements/platform.md#plat-decode-003). Manual test, run at bring-up step **A2** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-DECODE-003](../../requirements/platform.md#plat-decode-003). Manual test, run before each release, at step **A2** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The receiver (Pro Micro, production; Pro Mini, alternative) with its RXB6 and OLED, wired per `hardware/receiver/WIRING.md`. @@ -22,5 +22,5 @@ Requirement: [PLAT-DECODE-003](../../requirements/platform.md#plat-decode-003). - Step 3: the source leaves the screen 30 min (± 1 min) after its last frame. ## Results -| Date | Commit / build | Board | Lines / frames sent | Expiry time | Pass | By | Notes | +| Date | Release (tag / commit) | Board | Lines / frames sent | Expiry time | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-DECODE-004.md b/tests/bench/PLAT-DECODE-004.md index e06a230..f20b30f 100644 --- a/tests/bench/PLAT-DECODE-004.md +++ b/tests/bench/PLAT-DECODE-004.md @@ -1,7 +1,7 @@ # Bench test PLAT-DECODE-004 — receiver drives the SSD1306 OLED -Requirement: [PLAT-DECODE-004](../../requirements/platform.md#plat-decode-004). Manual test, run at bring-up step **A3** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-DECODE-004](../../requirements/platform.md#plat-decode-004). Manual test, run before each release, at step **A3** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The receiver of [PLAT-DECODE-003](PLAT-DECODE-003.md), powered over USB. @@ -21,5 +21,5 @@ Requirement: [PLAT-DECODE-004](../../requirements/platform.md#plat-decode-004). - Step 3: no gap in the lines while the screen redraws. ## Results -| Date | Commit / build | Board | Waiting page | Pages OK | Lines during redraw | Pass | By | Notes | +| Date | Release (tag / commit) | Board | Waiting page | Pages OK | Lines during redraw | Pass | By | Notes | |---|---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-DECODE-005.md b/tests/bench/PLAT-DECODE-005.md index c9e2af8..db7c426 100644 --- a/tests/bench/PLAT-DECODE-005.md +++ b/tests/bench/PLAT-DECODE-005.md @@ -1,7 +1,7 @@ # Bench test PLAT-DECODE-005 — receiver writes RFLink lines without blocking -Requirement: [PLAT-DECODE-005](../../requirements/platform.md#plat-decode-005). Manual test, run at bring-up step **A4** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-DECODE-005](../../requirements/platform.md#plat-decode-005). Manual test, run before each release, at step **A4** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The receiver of [PLAT-DECODE-003](PLAT-DECODE-003.md); on the Pro Mini, a USB-serial adapter on TX D1. @@ -20,5 +20,5 @@ Requirement: [PLAT-DECODE-005](../../requirements/platform.md#plat-decode-005). - Steps 2–3: the screen keeps updating while nothing reads the serial port; lines resume when the monitor is back. ## Results -| Date | Commit / build | Board | Line format | Screen without reader | Pass | By | Notes | +| Date | Release (tag / commit) | Board | Line format | Screen without reader | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-ISP-001.md b/tests/bench/PLAT-ISP-001.md index 7c6f215..9c53674 100644 --- a/tests/bench/PLAT-ISP-001.md +++ b/tests/bench/PLAT-ISP-001.md @@ -1,7 +1,7 @@ # Bench test PLAT-ISP-001 — a v3.0 board is flashed with its BME280 fitted -Requirement: [PLAT-ISP-001](../../requirements/platform.md#plat-isp-001). Manual test, run at bring-up step **B2** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-ISP-001](../../requirements/platform.md#plat-isp-001). Manual test, run before each release, at step **B2** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - A v3.0 board with a BME280 breakout on J3 or J14, JP6 bridged 1–2 (I2C 0x76). @@ -20,5 +20,5 @@ Requirement: [PLAT-ISP-001](../../requirements/platform.md#plat-isp-001). Manual - Step 2: the receiver shows a plausible temperature, humidity and pressure (through R9/R10 330 Ω). ## Results -| Date | Commit / build | Board | Flash verified | Readings | Pass | By | Notes | +| Date | Release (tag / commit) | Board | Flash verified | Readings | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-001.md b/tests/bench/PLAT-POWER-001.md index d281fcc..7b50d53 100644 --- a/tests/bench/PLAT-POWER-001.md +++ b/tests/bench/PLAT-POWER-001.md @@ -1,7 +1,7 @@ # Bench test PLAT-POWER-001 — hibernate length and sleep current -Requirement: [PLAT-POWER-001](../../requirements/platform.md#plat-power-001). Manual test, run at bring-up step **B6** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-POWER-001](../../requirements/platform.md#plat-power-001). Manual test, run before each release, at step **B6** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The board under test, a multimeter in series in the J13 + wire (µA range), the receiver. @@ -18,5 +18,5 @@ Requirement: [PLAT-POWER-001](../../requirements/platform.md#plat-power-001). Ma - Step 2: below 10 µA at 3 V with the sensors off (ATtiny84A power-down with watchdog and BOD off: about 5 µA; BOD on would add about 20 µA). ## Results -| Date | Commit / build | Board | Interval | Sleep current | Pass | By | Notes | +| Date | Release (tag / commit) | Board | Interval | Sleep current | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-003.md b/tests/bench/PLAT-POWER-003.md index ed31cb2..1272ad3 100644 --- a/tests/bench/PLAT-POWER-003.md +++ b/tests/bench/PLAT-POWER-003.md @@ -1,7 +1,7 @@ # Bench test PLAT-POWER-003 — pins and rails during hibernate -Requirement: [PLAT-POWER-003](../../requirements/platform.md#plat-power-003). Manual test, run at bring-up step **B7** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-POWER-003](../../requirements/platform.md#plat-power-003). Manual test, run before each release, at step **B7** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The board under test asleep, a multimeter (V range). @@ -18,5 +18,5 @@ Requirement: [PLAT-POWER-003](../../requirements/platform.md#plat-power-003). Ma - Step 2: no transmission outside the cycles. ## Results -| Date | Commit / build | Board | PA2 / PB0 / SDA / SCL / 1-Wire | Radio silent | Pass | By | Notes | +| Date | Release (tag / commit) | Board | PA2 / PB0 / SDA / SCL / 1-Wire | Radio silent | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-005.md b/tests/bench/PLAT-POWER-005.md index ab0c526..f536e2c 100644 --- a/tests/bench/PLAT-POWER-005.md +++ b/tests/bench/PLAT-POWER-005.md @@ -1,7 +1,7 @@ # Bench test PLAT-POWER-005 — radio timings at 1 MHz -Requirement: [PLAT-POWER-005](../../requirements/platform.md#plat-power-005). Manual test, run at bring-up step **B8** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-POWER-005](../../requirements/platform.md#plat-power-005). Manual test, run before each release, at step **B8** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The board under test, the receiver, an RFLink gateway if available. @@ -16,5 +16,5 @@ Requirement: [PLAT-POWER-005](../../requirements/platform.md#plat-power-005). Ma - Every protocol the board sends (Oregon or Lacrosse, X10, luminosity) is decoded by the receiver and by RFLink. ## Results -| Date | Commit / build | Board | Frames decoded (receiver / RFLink) | Pass | By | Notes | +| Date | Release (tag / commit) | Board | Frames decoded (receiver / RFLink) | Pass | By | Notes | |---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-006.md b/tests/bench/PLAT-POWER-006.md index 6912515..dfde38f 100644 --- a/tests/bench/PLAT-POWER-006.md +++ b/tests/bench/PLAT-POWER-006.md @@ -1,7 +1,7 @@ # Bench test PLAT-POWER-006 — switched 5 V module on PB2 (LM35 variant only) -Requirement: [PLAT-POWER-006](../../requirements/platform.md#plat-power-006). Manual test, run at bring-up step **B9** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-POWER-006](../../requirements/platform.md#plat-power-006). Manual test, run before each release, at step **B9** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - A board built per `hardware/tinysensor/VARIANTE_LM35.md`, with `USE_SWITCHED_5V`; a multimeter. @@ -18,5 +18,5 @@ Requirement: [PLAT-POWER-006](../../requirements/platform.md#plat-power-006). Ma - Step 2: PB2 in high impedance (not driven), the PNP off. ## Results -| Date | Commit / build | Board | 5 V in / out of window | PB2 asleep | Pass | By | Notes | +| Date | Release (tag / commit) | Board | 5 V in / out of window | PB2 asleep | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-007.md b/tests/bench/PLAT-POWER-007.md index a3ff845..31091aa 100644 --- a/tests/bench/PLAT-POWER-007.md +++ b/tests/bench/PLAT-POWER-007.md @@ -1,7 +1,7 @@ # Bench test PLAT-POWER-007 — sensor bus pull-ups go to the switched sensor rail -Requirement: [PLAT-POWER-007](../../requirements/platform.md#plat-power-007). Manual test, run at bring-up step **B4** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-POWER-007](../../requirements/platform.md#plat-power-007). Manual test, run before each release, at step **B4** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The board under test, unpowered, a multimeter (Ω range). @@ -17,5 +17,5 @@ Requirement: [PLAT-POWER-007](../../requirements/platform.md#plat-power-007). Ma - v2.2: SCL and SDA pulled to SENSOR_VCC (note the values). ## Results -| Date | Commit / build | Board | SCL / SDA / 1-Wire to SENSOR_VCC | To VCC | Pass | By | Notes | +| Date | Release (tag / commit) | Board | SCL / SDA / 1-Wire to SENSOR_VCC | To VCC | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/PLAT-POWER-008.md b/tests/bench/PLAT-POWER-008.md index 1c3e348..b7dc212 100644 --- a/tests/bench/PLAT-POWER-008.md +++ b/tests/bench/PLAT-POWER-008.md @@ -1,7 +1,7 @@ # Bench test PLAT-POWER-008 — awake: no internal pull-up on the sensor buses, the BME280 still reads -Requirement: [PLAT-POWER-008](../../requirements/platform.md#plat-power-008). Manual test, run at bring-up step **B3** ([bring-up.md](bring-up.md)); add a line to *Results* every time it is run. +Requirement: [PLAT-POWER-008](../../requirements/platform.md#plat-power-008). Manual test, run before each release, at step **B3** ([bring-up.md](bring-up.md)); add a line to *Results* for each release. ## Equipment - The board under test: a v3.0 board, and the mushroom's v2.2 board once reflashed, each with its BME280. @@ -19,5 +19,5 @@ Requirement: [PLAT-POWER-008](../../requirements/platform.md#plat-power-008). Ma - Step 2: SENSOR_VCC and SDA fall to 0 and stay below 0.1 V while PA2 is low (no back-powering through the pull-ups). ## Results -| Date | Commit / build | Board | 10 cycles read | SENSOR_VCC / SDA, PA2 low | Pass | By | Notes | +| Date | Release (tag / commit) | Board | 10 cycles read | SENSOR_VCC / SDA, PA2 low | Pass | By | Notes | |---|---|---|---|---|---|---|---| diff --git a/tests/bench/bring-up.md b/tests/bench/bring-up.md index 90d7423..e6f239b 100644 --- a/tests/bench/bring-up.md +++ b/tests/bench/bring-up.md @@ -1,6 +1,6 @@ -# Bring-up and bench tests +# Release bench tests -Order for a new board and for a reflash. A line ending in → links the bench test sheet that holds the procedure, the pass criteria and the results; the other lines are checks with no requirement behind them. Each sheet's *Results* table gets a line every time it is run, with the commit or build flashed. +Run by hand before each release, in this order, with the release candidate flashed on every board: a release is tagged only when every sheet has a passing line for it. A line ending in → links the bench test sheet that holds the procedure, the pass criteria and the results; the other lines are checks with no requirement behind them. Each sheet's *Results* table gets one line per release (tag, or commit of the candidate). **A. Receiver** (needed to read the sensor boards) 1. Wiring checked against `hardware/receiver/WIRING.md`, receiver flashed. @@ -19,4 +19,4 @@ Order for a new board and for a reflash. A line ending in → links the bench te 8. Radio timings at 1 MHz → [PLAT-POWER-005](PLAT-POWER-005.md) 9. LM35 variant only: switched 5 V → [PLAT-POWER-006](PLAT-POWER-006.md) -The v2.0 release waits for B2, B3 and B5 on a v3.0 board and B3 on the reflashed mushroom. +For v2.0: every sheet on a v3.0 board, and B3 on the reflashed mushroom. From adaab59fe95a9cbe29d695a7e1add294ab784162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 13:03:53 +0100 Subject: [PATCH 18/32] plan: a requirement checked by build or inspection carries a Verification: build|inspection line; manual hardware checks stay in bench sheets Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3eec379..0f4fd74 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -80,7 +80,7 @@ Requirements are a spec, not a plan. Each one passes four checks: 3. **States its reason** when it is not obvious. 4. **Verifiable on its own**. - The "how" (classes, helpers, registers, file layout) goes in `docs/architecture.md` and code comments. -- **No test information in a requirement**: no "Verification:", "Test:", "Verified by", "native test", "bench check pending". Input → output examples that define the behaviour stay, as "Examples:". +- **No test information in a requirement**: no "Test:", "Verified by", "Acceptance:", "native test", "bench check pending". Input → output examples that define the behaviour stay, as "Examples:". One exception: a requirement checked automatically by something that is not a test carries `**Verification:** build — ` or `**Verification:** inspection — ` (before the description); manual hardware checks never go there, they are bench sheets. - A helper's unit tests are tagged with the requirement whose behaviour uses the helper (`dec16ToHex` tests → FUNC-X10-006/007). - A requirement no software test can cover gets a bench test sheet `tests/bench/.md`, tagged like a test: `` on its first line, one line per requirement it covers (requirement link, equipment, setup, steps, pass criteria, results table filled at each run); Bench tests are run by hand before each release, in the order of `tests/bench/bring-up.md`; a release is tagged only when every sheet has a passing line for it. From 8a34334d8a2c890e5f975b916941c32148059c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 13:03:53 +0100 Subject: [PATCH 19/32] req(TECH-HAL-001,TECH-DECODE-003,TECH-SERIAL-002,CONF-BUILD-003,CONF-BUILD-007,CONF-BUILD-011,CONF-BUILD-014,CONF-BUILD-015,CONF-DECODE-002..004,FUNC-SENSOR-002,PLAT-POWER-001,PLAT-POWER-003): Verification: build|inspection line where a build or an inspection checks the requirement Co-Authored-By: Claude Opus 5.5 --- requirements/configuration.md | 8 ++++++++ requirements/functional.md | 1 + requirements/platform.md | 2 ++ requirements/technical.md | 3 +++ 4 files changed, 14 insertions(+) diff --git a/requirements/configuration.md b/requirements/configuration.md index f019bfe..b384128 100644 --- a/requirements/configuration.md +++ b/requirements/configuration.md @@ -20,6 +20,7 @@ **Title:** Set Oregon channel and rolling code per environment **Status:** validated **Dependencies:** [CONF-BUILD-001](#conf-build-001) +**Verification:** inspection — each Oregon environment of `emitter/platformio.ini` sets both flags within range **Description:** An Oregon build sets `OREGON_CHANNEL` to 1, 2 or 3 and `OREGON_RCODE` to a rolling code 0x00–0xFF ([FUNC-OREGON-010](functional.md#func-oregon-010); the old 0xA5 limit came from the former layout that split the code over bytes 2 and 3). Every Oregon frame carries them ([FUNC-OREGON-009](functional.md#func-oregon-009), [FUNC-OREGON-010](functional.md#func-oregon-010)). ### CONF-BUILD-004 @@ -44,6 +45,7 @@ **Title:** Configure low-battery threshold via LOW_BATTERY_VOLTAGE **Status:** validated **Dependencies:** [FUNC-BATTERY-003](functional.md#func-battery-003) +**Verification:** inspection — the default and the per-environment values in `emitter/platformio.ini` **Description:** `LOW_BATTERY_VOLTAGE` sets the battery voltage, in mV, below which the battery is low ([FUNC-BATTERY-003](functional.md#func-battery-003)). The default is 2000 mV. ### CONF-BUILD-008 @@ -68,6 +70,7 @@ **Title:** Document charge-pump sensor rail via USE_CHARGE_PUMP **Status:** validated **Dependencies:** — +**Verification:** inspection — no firmware source reads `USE_CHARGE_PUMP` **Description:** `USE_CHARGE_PUMP` only records that the board's sensor rail is boosted by a charge pump. It changes nothing in the firmware. ### CONF-BUILD-012 @@ -86,28 +89,33 @@ **Title:** `mushroom` environment builds the 18650-powered BME280 Oregon sensor in the mushroom enclosure **Status:** validated **Dependencies:** [CONF-BUILD-003](#conf-build-003), [CONF-BUILD-005](#conf-build-005), [CONF-BUILD-007](#conf-build-007), [CONF-BUILD-008](#conf-build-008), [CONF-BUILD-012](#conf-build-012), [CONF-BUILD-013](#conf-build-013) +**Verification:** build — `pio run -d emitter -e mushroom` **Description:** The `mushroom` board is a cut-down v2.2 with a BME280. Its 18650 is charged by a TP4056, and a 3.3 V buck-boost supplies VCC, so VCC is not the battery voltage and PA1 reads half of it. It sends Oregon temperature and humidity without pressure on channel 3 with rolling code 0x3C. The X10 meter 7 reports the battery through a divider of 2 every 5 minutes. The low-battery threshold is 3000 mV, so the discharge stays tracked down to 3.0 V while the buck-boost keeps VCC steady. The 1.1 V reference is calibrated at 1104 mV (4040 mV measured on J13 against 4026 mV reported). The environment is part of the default build, and the environment docs list it with its battery and threshold. ### CONF-BUILD-015 **Title:** CI runs every emitter native test environment and builds every emitter board environment **Status:** validated **Dependencies:** [CONF-BUILD-014](#conf-build-014), [TECH-MAIN-001](technical.md#tech-main-001) +**Verification:** build — the CI workflow against `emitter/platformio.ini`, and its run **Description:** The CI (`.github/workflows/main.yml`) runs `pio test -d emitter` on `native_debug` and on every `native_cycle_*` environment of `emitter/platformio.ini`: `native_cycle_oregon`, `native_cycle_oregon_vcc`, `native_cycle_oregon_divider`, `native_cycle_lacrosse` and `native_cycle_x10`. It builds every environment in `default_envs`: `S_02`, `S_03`, `S_04`, `S_05`, `robot`, `devmodule`, `SOLAR_TEST` and `mushroom`. It publishes each board firmware (`.hex`, `.elf`) as `firmware-`, and the release waits for these builds. ### CONF-DECODE-002 **Title:** CI and pre-commit cover tinyDecoders: lint, native tests and the promini and promicro builds **Status:** validated **Dependencies:** [CONF-DECODE-003](#conf-decode-003), [CONF-DECODE-004](#conf-decode-004) +**Verification:** build — the CI workflow and its run **Description:** The CI (`.github/workflows/main.yml`) lints `tinyDecoders` with the `.rbd/config.yml` linter command (build trees `*/.pio` skipped), runs the `tinyDecoders` native tests, and builds the `promini` and `promicro` environments. It publishes the promicro firmware (`.hex`, `.elf`, production) as `firmware-tinydecoders-promicro` and the promini one as `firmware-tinydecoders-promini`, and the release waits for these builds. The PlatformIO cache follows changes to `tinyDecoders/platformio.ini`. The pre-commit clang-format hook covers `tinyDecoders/src`, `tinyDecoders/lib` and `tinyDecoders/test`. ### CONF-DECODE-003 **Title:** tinyDecoders promicro environment builds the production receiver for the Pro Micro 5 V / 16 MHz (ATmega32U4) **Status:** validated **Dependencies:** [FUNC-DECODE-009](functional.md#func-decode-009), [PLAT-DECODE-003](platform.md#plat-decode-003), [PLAT-DECODE-004](platform.md#plat-decode-004), [PLAT-DECODE-005](platform.md#plat-decode-005) +**Verification:** build — `pio run -d tinyDecoders -e promicro` **Description:** The production tinyDecoders receiver is a standalone viewer on a Pro Micro 5 V / 16 MHz (ATmega32U4), powered and flashed through its micro-USB. Its native USB needs no USB-serial (FTDI) adapter, and its RFLink lines go out on the USB CDC serial port. Its wiring is in [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. The Pro Mini is the alternative build ([CONF-DECODE-004](#conf-decode-004)). `tinyDecoders/platformio.ini` has `[env:promicro]`: `platform = atmelavr`, `board = sparkfun_promicro16`, `framework = arduino`, the default upload (`avr109`, Caterina bootloader over USB) and no `lib_deps`. It builds the same receiver firmware as the Pro Mini; the Arduino core keeps the Pro Micro USB stack running. ### CONF-DECODE-004 **Title:** tinyDecoders promini environment builds the alternative receiver for the Pro Mini 5 V / 16 MHz (ATmega328P) **Status:** validated **Dependencies:** [FUNC-DECODE-007](functional.md#func-decode-007), [FUNC-DECODE-009](functional.md#func-decode-009), [PLAT-DECODE-003](platform.md#plat-decode-003), [PLAT-DECODE-004](platform.md#plat-decode-004), [PLAT-DECODE-005](platform.md#plat-decode-005) +**Verification:** build — `pio run -d tinyDecoders -e promini` **Description:** The alternative tinyDecoders receiver is a standalone viewer on an Arduino Pro Mini 5 V / 16 MHz (ATmega328P), fed USB 5 V on its VCC pin, bypassing the onboard regulator. The production receiver is the Pro Micro ([CONF-DECODE-003](#conf-decode-003)). The Pro Mini has no native USB: flashing it needs a USB-serial adapter on its programming header, and its RFLink lines go out on the debug UART. Its wiring is in [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. `tinyDecoders/platformio.ini` has `[env:promini]`: `platform = atmelavr`, `board = pro16MHzatmega328`, `framework = arduino`, the default upload (`arduino` protocol through the Pro Mini bootloader, over a USB-serial adapter on the programming header), no `lib_deps`, and `build_flags = -DSERIAL_TX_BUFFER_SIZE=128`: the core default of 64 B leaves 63 free bytes, exactly the longest RFLink line plus `\r\n`, and 128 B leaves room for a second line. It builds the same receiver firmware as the Pro Micro ([CONF-DECODE-003](#conf-decode-003)). \ No newline at end of file diff --git a/requirements/functional.md b/requirements/functional.md index 2e2ea73..d434df6 100644 --- a/requirements/functional.md +++ b/requirements/functional.md @@ -218,6 +218,7 @@ **Title:** DS18B20 temperature read on the 1-Wire bus on PA3, in whole °C **Status:** draft **Dependencies:** — +**Verification:** build — the AVR builds with `USE_DS18B20`; no sensor unit in service uses a DS18B20 **Description:** On a build with a DS18B20, each cycle starts a conversion on the 1-Wire bus on PA3, waits 1 s and reads the result. The temperature in whole °C is the raw 1/16 °C value divided by 16. A result of 0 °C counts as a failed read, so a real 0 °C is lost too: the cycle then has no temperature and, with no other temperature source, sends no environment frame ([CONF-BUILD-002](configuration.md#conf-build-002)). Wrapper details: [TECH-SENSOR-001](technical.md#tech-sensor-001). ### FUNC-SENSOR-003 diff --git a/requirements/platform.md b/requirements/platform.md index d940838..c47cfc2 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -9,6 +9,7 @@ **Status:** validated **Dependencies:** [PLAT-POWER-008](#plat-power-008) **derives_from:** [PLAT-POWER-008](#plat-power-008) +**Verification:** inspection — sleep loop and BOD-disable sequence in the AVR `Hal` and the disassembly; current and period measured by the bench sheet **Description:** A hibernate of `s` seconds puts the ATtiny84A in power-down sleep for `s / 8` periods of the 8-second hardware watchdog, rounded down, and at least one: a request under 8 s still sleeps one period. Brownout detection is off during each sleep period. --- @@ -27,6 +28,7 @@ **Status:** validated **Dependencies:** [PLAT-POWER-001](#plat-power-001), [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-008](#plat-power-008) **derives_from:** [PLAT-POWER-008](#plat-power-008) +**Verification:** inspection — PRR, DDR and PORT values set before sleep and restored after, in the AVR `Hal`; pin levels measured by the bench sheet **Description:** Before the first sleep period, the power reduction register stops the USI, Timer0, Timer1 and the ADC. PA2 (`SENSOR_VCC`) and PB0 (radio data, the radio being always powered) are outputs held low, so the sensor rail stays off and the transmitter cannot key itself from a floating input. PA3 (1-Wire), PA4 (SCL), PA5 (MISO) and PA6 (SDA) are inputs without internal pull-up: their external pull-ups go to `SENSOR_VCC`, or (PA5) they may reach the sensor SDO in SPI wiring, so an internal pull-up would back-power the unpowered sensors. A floating input costs nothing in power-down, where the input buffers are clamped. Every other pin is an input: PA0 and PA1 without pull-up, PB3 (RESET) pulled up, PB2 pulled up except with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)), and PA7 (digital output) and PB1 (LED) keep their last output level as pull-up state. After the last sleep period, PRR, DDRA, DDRB, PORTA and PORTB get back their values from before sleep. --- diff --git a/requirements/technical.md b/requirements/technical.md index 963bb1e..3a0fa37 100644 --- a/requirements/technical.md +++ b/requirements/technical.md @@ -8,6 +8,7 @@ **Title:** Protocol and sensor logic reach the hardware only through the injected `Hal` interface, so it runs unchanged in native builds **Status:** validated **Dependencies:** — +**Verification:** inspection — outside the AVR implementation of `Hal`, the only AVR registers in `emitter/` and `lib/` are the addresses passed to the ds18b20 driver **Description:** Every protocol encoder, and every sensor wrapper that times or drives I/O itself, gets the hardware through a `Hal*` given at construction (`lib/hal/Hal.h`, the boundary between the firmware logic and the MCU) and touches no AVR register. So the same code builds and runs on the host against a test double. Only the AVR implementation of `Hal` accesses registers, with one exception: register addresses passed as arguments to a third-party bus driver. A wrapper whose I/O is entirely done by a third-party driver takes no `Hal*`. --- @@ -104,6 +105,7 @@ **Title:** Debug logging via SoftSerial is compiled only when USE_SERIAL_LOG is defined **Status:** draft **Dependencies:** [PLAT-DEBUG-001](platform.md#plat-debug-001) +**Verification:** build — no environment sets `USE_SERIAL_LOG` yet **Description:** When `USE_SERIAL_LOG` is defined, `emitter/src/main.cpp` includes `SoftSerial.h`, instantiates `SoftSerial swSerial(&hal)`, and implements `SerialPrintInfo(name, value, unit)` using it. When `USE_SERIAL_LOG` is absent, `SerialPrintInfo` is a no-op inline function and `SoftSerial` is not instantiated. --- @@ -164,6 +166,7 @@ **Title:** Receiver logic is plain C++ without dynamic allocation or `printf`, independent of the hardware **Status:** validated **Dependencies:** [TECH-DECODE-002](#tech-decode-002) +**Verification:** build — `pio run -d tinyDecoders` compiles the receiver logic for AVR, and the native build runs it **Description:** The decoders, the source table, the RFLink formatter, the page formatter and the receiver loop depend only on ``, on each other and on `ReceiverHal` ([TECH-DECODE-002](#tech-decode-002)): no `Hal`, no AVR register, no dynamic allocation, no `printf`. They therefore run unchanged in native builds, and their RAM use is fixed at build time: the source table holds 16 sources on AVR, about 288 B, which fits the Pro Mini and the Pro Micro, and 8 in native builds. The RFLink formatter is linked only when `ReceiverHal::HasLineOutput` is true. ### TECH-DECODE-004 From ec05447c4a6a5989b959b2a4572ae11e2d3d30fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 13:04:10 +0100 Subject: [PATCH 20/32] req(PLAT-POWER-001,PLAT-POWER-003,PLAT-POWER-008,PLAT-ISP-001,PLAT-DEBUG-001): derives_from a FUNC or TECH requirement (T7), not another PLAT Co-Authored-By: Claude Opus 5.5 --- requirements/platform.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements/platform.md b/requirements/platform.md index c47cfc2..dc01fd1 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -8,7 +8,7 @@ **Title:** Hibernate is s / 8 watchdog periods of power-down sleep, rounded down, at least one **Status:** validated **Dependencies:** [PLAT-POWER-008](#plat-power-008) -**derives_from:** [PLAT-POWER-008](#plat-power-008) +**derives_from:** [TECH-MAIN-001](technical.md#tech-main-001) **Verification:** inspection — sleep loop and BOD-disable sequence in the AVR `Hal` and the disassembly; current and period measured by the bench sheet **Description:** A hibernate of `s` seconds puts the ATtiny84A in power-down sleep for `s / 8` periods of the 8-second hardware watchdog, rounded down, and at least one: a request under 8 s still sleeps one period. Brownout detection is off during each sleep period. @@ -27,7 +27,7 @@ **Title:** Hibernate stops USI, Timer0, Timer1 and ADC, holds the sensor rail and radio data low, leaves the sensor-rail pull-up pins unpulled; everything is restored on wake **Status:** validated **Dependencies:** [PLAT-POWER-001](#plat-power-001), [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-008](#plat-power-008) -**derives_from:** [PLAT-POWER-008](#plat-power-008) +**derives_from:** [TECH-MAIN-001](technical.md#tech-main-001) **Verification:** inspection — PRR, DDR and PORT values set before sleep and restored after, in the AVR `Hal`; pin levels measured by the bench sheet **Description:** Before the first sleep period, the power reduction register stops the USI, Timer0, Timer1 and the ADC. PA2 (`SENSOR_VCC`) and PB0 (radio data, the radio being always powered) are outputs held low, so the sensor rail stays off and the transmitter cannot key itself from a floating input. PA3 (1-Wire), PA4 (SCL), PA5 (MISO) and PA6 (SDA) are inputs without internal pull-up: their external pull-ups go to `SENSOR_VCC`, or (PA5) they may reach the sensor SDO in SPI wiring, so an internal pull-up would back-power the unpowered sensors. A floating input costs nothing in power-down, where the input buffers are clamped. Every other pin is an input: PA0 and PA1 without pull-up, PB3 (RESET) pulled up, PB2 pulled up except with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)), and PA7 (digital output) and PB1 (LED) keep their last output level as pull-up state. After the last sleep period, PRR, DDRA, DDRB, PORTA and PORTB get back their values from before sleep. @@ -73,7 +73,7 @@ **Title:** While awake, no internal pull-up on PORTA, the floating MISO input buffer off, PB2 and PB3 pulled up, unused peripherals off **Status:** validated **Dependencies:** [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-007](#plat-power-007) -**derives_from:** [PLAT-POWER-007](#plat-power-007) +**derives_from:** [FUNC-SENSOR-001](functional.md#func-sensor-001) **Description:** From reset until the first sleep, and between sleeps, the ATtiny84A enables no internal pull-up on any PORTA pin. PA0 and PA1 are analog inputs, PA2 (`SENSOR_VCC`) and PA7 are outputs, and PA3, PA4 and PA6 are bus pins pulled up externally to `SENSOR_VCC` ([PLAT-POWER-007](#plat-power-007)). While PA2 is low (at boot, at wake before the sensors are powered, after they are powered off), an internal pull-up on a bus pin would drive current through the external pull-up into PA2 and back-power the sensors. PA5 (MISO) has no pull-up at all. It reaches the ISP header J6 and pad 3 of the BME280 SDO jumper JP6, which v3.0 delivers open: bridged 1–2, SDO goes to GND and the sensor answers at I2C address 0x76, the one the firmware reads; bridged 2–3, SDO follows PA5, for SPI. The PA5 digital input buffer is disabled, so the floating pin draws no current in the input stage; reset enables it again, so ISP programming is unaffected. PB2 and PB3 (RESET) are pulled up, the ATtiny84A having no PB4–PB7, except PB2 with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)). PB0 (radio data) and PB1 (LED) are outputs. The analog comparator and Timer1 stay off, and the ADC is on only while it measures. --- @@ -82,7 +82,7 @@ **Title:** A v3.0 board is flashed over ISP with its I2C sensor fitted **Status:** validated **Dependencies:** [PLAT-POWER-007](#plat-power-007) -**derives_from:** [PLAT-POWER-007](#plat-power-007) +**derives_from:** [FUNC-SENSOR-001](functional.md#func-sensor-001) **Description:** The ISP lines SCK (PA4) and MOSI (PA6) are also the I2C SCL and SDA. On v3.0, the sensor connector reaches them through 330 Ω series resistors, R9 on SCL and R10 on SDA, with the sensor pull-ups on the connector side ([PLAT-POWER-007](#plat-power-007)), while the ISP header J6 is wired directly to the MCU pins. The programmer therefore drives SCK and MOSI without the sensor loading them, and the board is flashed with the BME280 in place; the sensor still reads correctly through the resistors afterwards. v2.2 boards have no such resistors: their sensor is removed before flashing. --- @@ -91,7 +91,7 @@ **Title:** Debug serial output: transmit only on PA7, 9600 baud 8N1, line idle high **Status:** validated **Dependencies:** [PLAT-POWER-005](#plat-power-005) -**derives_from:** [PLAT-POWER-005](#plat-power-005) +**derives_from:** [TECH-SERIAL-002](technical.md#tech-serial-002) **Description:** The emitter's debug serial output is a software UART on PA7: 9600 baud, each byte a low start bit, 8 data bits least significant first, then a high stop bit. The line is idle high from the start of the output. Numbers are written as text, in decimal unless another base is asked for, and a written line ends with `\r\n`. There is no receive path. The bit time is calibrated for the 1 MHz clock ([PLAT-POWER-005](#plat-power-005)). --- From 7a654bcc6550874a7be04a1b15c228e574e53ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 14:53:12 +0100 Subject: [PATCH 21/32] plan: audit 2026-11-20, since b015593, on ec05447 (12 findings open) Co-Authored-By: Claude Opus 5.5 --- audits/2026-11-20-audit.md | 111 +++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 audits/2026-11-20-audit.md diff --git a/audits/2026-11-20-audit.md b/audits/2026-11-20-audit.md new file mode 100644 index 0000000..5561712 --- /dev/null +++ b/audits/2026-11-20-audit.md @@ -0,0 +1,111 @@ +# Audit Report — 2026-11-20 + +Audited commit: ec05447c4a6a5989b959b2a4572ae11e2d3d30fc — branch `req/abstraction` — PR #94 + +Mode: since b015593debedb10daefb64cd59726661532b0947 + +Plugin rbd 0.16.0. Agents: `audit-traceability`, `audit-coherence`; both returned valid output. Bench test sheets (`tests/bench/.md`, ``) are not known to 0.16.0; the agents were told about them and say so where it matters. rbd 0.17.0 (bench sheets, release gate), arcadien/claude-marketplace#42, is not released yet. + +31 raw entries (17 traceability, 14 coherence) merged into 12 findings and 8 info items. + +## Summary + +| # | Finding | Status | +|---|---------|--------| +| 1 | PLAT-DEBUG-001 is validated but derives_from the draft TECH-SERIAL-002, which depends back on it | open | +| 2 | TECH-DECODE-002 still depends on the deprecated TECH-DECODE-001 | open | +| 3 | The native variants of the two LED tests have no `@req` tag | open | +| 4 | PLAT-POWER-008 and PLAT-DEBUG-001: their code was committed under the now deprecated TECH-HAL-004 / TECH-SERIAL-001 | open | +| 5 | PLAT-ISP-001, FUNC-SENSOR-001, PLAT-POWER-005, PLAT-POWER-007: bench sheet only, no implementation commit | open | +| 6 | PLAT-POWER-001, 003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, 011: build/inspection verification, no implementation commit | open | +| 7 | PLAT-ISP-001 and PLAT-POWER-007 both state the R9/R10 topology and its reason | open | +| 8 | TECH-SERIAL-002 is still written as a plan; its Verification line verifies nothing | open | +| 9 | PLAT-DEBUG-001: no baud tolerance; number formatting is software output, not hardware use | open | +| 10 | PLAT-ISP-001: "still reads correctly" has no criterion; docs/debugging.md still says "bench check pending" | open | +| 11 | Architecture row of TECH-MAIN-001 restates the native test environments the requirement dropped | open | +| 12 | Architecture row of PLAT-DEBUG-001 omits `Attiny84aHal` (PA7, bit timing) and the line format | open | + +## Findings + +### Finding 1 +**Type:** Traceability — PLAT derives_from (T7) and coherence — dependency validity (C3) +**Requirements:** PLAT-DEBUG-001, TECH-SERIAL-002 +**Issue:** PLAT-DEBUG-001 (validated) derives_from TECH-SERIAL-002, which is draft; TECH-SERIAL-002 lists PLAT-DEBUG-001 as a dependency, so each points to the other. Either validate TECH-SERIAL-002 (the open USE_SERIAL_LOG decision) or derive PLAT-DEBUG-001 from a validated FUNC/TECH requirement. +**Status:** open + +### Finding 2 +**Type:** Coherence — dependency validity (C3) +**Requirement:** TECH-DECODE-002 +**Issue:** Reworded in this range, it still lists the deprecated TECH-DECODE-001 (the Loopback test helper) as a dependency; its new text no longer uses it. The link was removed from FUNC-DECODE-001/002/004 and CONF-DECODE-002 but not here. +**Status:** open + +### Finding 3 +**Type:** Traceability — test tag coverage (T6a) +**File:** emitter/test/test_led/ledTest.cpp:48, :53 +**Issue:** `Expect_led_can_switch_on` and `Expect_led_can_switch_off` exist twice, under `#ifdef AVR` and `#else`. Only the AVR variants carry `// @req PLAT-POWER-004`; the native ones, which `native_debug` runs, have no tag (already untagged before this range). +**Status:** open + +### Finding 4 +**Type:** Traceability — implementation coverage (T3) +**Requirements:** PLAT-POWER-008, PLAT-DEBUG-001 +**Issue:** The code behind PLAT-POWER-008 was committed as `tech(TECH-HAL-004)` (18f6b47, 19b1ff7), that behind PLAT-DEBUG-001 as `tech(TECH-SERIAL-001)` (6817d72); both IDs are now deprecated, so no implementation commit cites the new IDs. The `**Superseded by:**` field of rbd 0.17.0 would carry the link. +**Status:** open + +### Finding 5 +**Type:** Traceability — implementation coverage (T3) +**Requirements:** PLAT-ISP-001, FUNC-SENSOR-001, PLAT-POWER-005, PLAT-POWER-007 +**Issue:** Their only commits besides `req(...)` are the bench sheet `test(...)` commits (ef99dd0, 49a0bc4, 5ad52ad); no implementation commit cites them. PLAT-ISP-001 and PLAT-POWER-007 are hardware properties (R9/R10, pull-ups), implemented by `hw:` commits that carry no ID. +**Status:** open + +### Finding 6 +**Type:** Traceability — implementation coverage (T3, warning) +**Requirements:** PLAT-POWER-001, PLAT-POWER-003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, CONF-BUILD-011 +**Issue:** Their new `**Verification:** build|inspection` line means they need an implementation commit, and none cites them: pre-RBD code (TECH-HAL-001, CONF-BUILD-007/011), `fix(PLAT-POWER-003)` (22eacc3) instead of an implementation prefix, and code committed under other IDs. CONF-BUILD-003 is in the same state and already excluded by HIST-COMMIT-MISMATCH-001. +**Status:** open + +### Finding 7 +**Type:** Coherence — overlap (C1) +**Requirements:** PLAT-ISP-001, PLAT-POWER-007 +**Issue:** Both describe R9 (SCL) / R10 (SDA) 330 Ω with R3/R2 on the sensor-connector side, and PLAT-POWER-007 gives the reason ("keep the ISP lines free of the sensor") that PLAT-ISP-001 requires. Keep the topology in PLAT-ISP-001 and have PLAT-POWER-007 cite it. +**Status:** open + +### Finding 8 +**Type:** Coherence — precision (C2) +**Requirement:** TECH-SERIAL-002 +**Issue:** Changed in this range but still names a file (`emitter/src/main.cpp`), a header, a class instance (`SoftSerial swSerial(&hal)`) and a function (`SerialPrintInfo`). Its Verification line ("build — no environment sets USE_SERIAL_LOG yet") says nothing builds it, which verifies nothing. +**Status:** open + +### Finding 9 +**Type:** Coherence — precision (C2) +**Requirement:** PLAT-DEBUG-001 +**Issue:** "9600 baud" with no tolerance (a UART receiver needs about ±2 %; the architecture uses (1 000 000 / 9600) − 25 µs), so no pass threshold. "In decimal unless another base is asked for" does not say which bases; number formatting is software output, out of place in a PLAT requirement. +**Status:** open + +### Finding 10 +**Type:** Coherence — precision (C2) +**Requirement:** PLAT-ISP-001 +**Issue:** "The sensor still reads correctly through the resistors afterwards" has no criterion (it could cite FUNC-SENSOR-001). docs/debugging.md:24 still says the sensor stays in place on v3.0 "(bench check pending)", test information the bench sheet now holds. +**Status:** open + +### Finding 11 +**Type:** Coherence — architecture coherence (C5) +**Requirement:** TECH-MAIN-001 +**Issue:** The traceability row still says "five `native_cycle_*` envs run `test_main_cycle`" and names `include/main.h` / `platformio.ini`, text the requirement dropped in this range. +**Status:** open + +### Finding 12 +**Type:** Coherence — architecture coherence (C5) +**Requirement:** PLAT-DEBUG-001 +**Issue:** The row lists `SoftSerial` only, while PA7 and the bit timing live in `Attiny84aHal::SerialWriteBit`; it also leaves out the idle-high line, the text number output and the `\r\n` line end. +**Status:** open + +## Info (no action required) + +- **T1, build / inspection, no test required:** TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-003, 007, 011, 014, 015, CONF-DECODE-002..004 (and the drafts TECH-SERIAL-002, FUNC-SENSOR-002). +- **T1, bench sheet only** (`tests/bench/.md`, unknown to 0.16.0): FUNC-SENSOR-001, PLAT-DECODE-003..005, PLAT-ISP-001, PLAT-POWER-001, 003, 005, 006, 007, 008. No sheet has a Results row yet: all pending for v2.0. +- **C3:** PLAT-POWER-001 now depends on PLAT-POWER-008 (one-for-one swap of TECH-HAL-004), but nothing in it relies on the awake pin states. +- **C1:** PLAT-POWER-004 derives_from FUNC-X10-005 only, though it frames every transmission; the LED sentence of FUNC-X10-005 duplicates it. +- **C2:** TECH-MAIN-001 (`emitter/include/main.h`) and TECH-HAL-001 (`lib/hal/Hal.h`) still give file paths; the boundary names are allowed, their locations belong in docs/architecture.md. +- **C2:** the Verification lines of PLAT-POWER-001 and 003 end with "… measured by the bench sheet", test information outside the build/inspection ``. +- **C5:** the `Loopback` component row cites FUNC-DECODE-001 "(its tests)"; a test helper would better be marked as test infrastructure with no requirement, like `TestHal_`. +- **Checks with no finding:** T2 (only TECH-SENSOR-001 draft tags, excluded by DRAFT-TAG-DS18B20-001; no tag cites a deprecated ID), T4 (as in 2026-11-19), T5, T6b (within TEST-GWT-001), T8 (all IDs linked), no cycle in Dependencies. Not checked by the agents: whether 02cbdea left a caller of `AnalogFilter` / `dec32ToHex` (checked by hand before the commit: none, and every board builds). From 81fcb8fbd45e8295c777daf9944483d0500336db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:09:34 +0100 Subject: [PATCH 22/32] req(TECH-DECODE-002,TECH-SERIAL-002,TECH-HAL-003..005,TECH-SERIAL-001,TECH-CONVERT-001,TECH-X10-001..002,TECH-SENSOR-002,TECH-DECODE-004..005): drop the deprecated TECH-DECODE-001 dependency, TECH-SERIAL-002 at spec level, Superseded by on deprecated TECH requirements (audit 2026-11-20 findings 2, 4, 8) Co-Authored-By: Claude Opus 5.5 --- requirements/technical.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/requirements/technical.md b/requirements/technical.md index 3a0fa37..c8faa1e 100644 --- a/requirements/technical.md +++ b/requirements/technical.md @@ -25,6 +25,7 @@ **Title:** ComputeVccMv and ConvertAnalogValueToMv are non-virtual concrete methods on the Hal base class **Status:** deprecated **Dependencies:** — +**Superseded by:** [FUNC-BATTERY-001](functional.md#func-battery-001) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the VCC and pin voltage formulas are [FUNC-BATTERY-001](functional.md#func-battery-001). --- @@ -33,6 +34,7 @@ **Title:** Attiny84aHal constructor disables Timer1, ADC, and analog comparator; no pull-up on PORTA, PA5 digital input buffer off, pull-ups on PB2 and PB3 **Status:** deprecated **Dependencies:** [PLAT-POWER-007](platform.md#plat-power-007) +**Superseded by:** [PLAT-POWER-008](platform.md#plat-power-008) **Description:** Deprecated 2026-11-20: the awake pin states and their reason are now [PLAT-POWER-008](platform.md#plat-power-008); the constructor details are in [docs/architecture.md](../docs/architecture.md). --- @@ -41,6 +43,7 @@ **Title:** LedOn and LedOff toggle PORTB PB1 on AVR hardware and toggle IsLedOn in TestHal_ **Status:** deprecated **Dependencies:** — +**Superseded by:** [PLAT-POWER-004](platform.md#plat-power-004) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the LED behaviour is [PLAT-POWER-004](platform.md#plat-power-004). --- @@ -81,6 +84,7 @@ **Title:** dec16ToHex returns the BCD hex representation of a uint16_t with each decimal digit in one nibble **Status:** deprecated **Dependencies:** — +**Superseded by:** [FUNC-X10-006](functional.md#func-x10-006) **Description:** Deprecated 2026-11-20: helper detail; the BCD encoding it serves is [FUNC-X10-006](functional.md#func-x10-006) and [FUNC-X10-007](functional.md#func-x10-007). --- @@ -97,6 +101,7 @@ **Title:** SoftSerial transmits output-only UART at 9600 baud using the SerialWriteBit HAL call **Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001) +**Superseded by:** [PLAT-DEBUG-001](platform.md#plat-debug-001) **Description:** Deprecated 2026-11-20: the debug serial output is now [PLAT-DEBUG-001](platform.md#plat-debug-001); the `SoftSerial` / `SerialWriteBit` split is in [docs/architecture.md](../docs/architecture.md). --- @@ -105,8 +110,7 @@ **Title:** Debug logging via SoftSerial is compiled only when USE_SERIAL_LOG is defined **Status:** draft **Dependencies:** [PLAT-DEBUG-001](platform.md#plat-debug-001) -**Verification:** build — no environment sets `USE_SERIAL_LOG` yet -**Description:** When `USE_SERIAL_LOG` is defined, `emitter/src/main.cpp` includes `SoftSerial.h`, instantiates `SoftSerial swSerial(&hal)`, and implements `SerialPrintInfo(name, value, unit)` using it. When `USE_SERIAL_LOG` is absent, `SerialPrintInfo` is a no-op inline function and `SoftSerial` is not instantiated. +**Description:** With `USE_SERIAL_LOG`, each cycle writes every value it measures (battery, analog input, luminosity, temperature, humidity, pressure) as one `name value unit` line on the debug serial output ([PLAT-DEBUG-001](platform.md#plat-debug-001)). Without it, the firmware has no debug output and links no serial code, which keeps flash and cycle time for the sensor builds. --- @@ -114,6 +118,7 @@ **Title:** Hal must expose five timing methods for X10 RF signal intervals **Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001) +**Superseded by:** [FUNC-X10-005](functional.md#func-x10-005) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the X10 timings are [FUNC-X10-005](functional.md#func-x10-005). --- @@ -122,6 +127,7 @@ **Title:** x10rf must call only Hal timing methods for all delays; direct _delay_us() calls are forbidden **Status:** deprecated **Dependencies:** [TECH-X10-001](#tech-x10-001) +**Superseded by:** [FUNC-X10-005](functional.md#func-x10-005) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the X10 timings are [FUNC-X10-005](functional.md#func-x10-005), and [TECH-HAL-001](#tech-hal-001) keeps all timing behind the HAL. --- @@ -138,6 +144,7 @@ **Title:** BMx280 wraps BMP280 and BME280 behind one class; stubs return 0 on native builds **Status:** deprecated **Dependencies:** [TECH-HAL-001](#tech-hal-001), [FUNC-SENSOR-001](functional.md#func-sensor-001) +**Superseded by:** [FUNC-SENSOR-001](functional.md#func-sensor-001) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the sensor behaviour is [FUNC-SENSOR-001](functional.md#func-sensor-001), and [TECH-HAL-001](#tech-hal-001) covers wrappers built on a third-party driver. --- @@ -159,7 +166,7 @@ ### TECH-DECODE-002 **Title:** Receiver hardware is reached only through a compile-time `ReceiverHal` interface given by pointer, with a native test double **Status:** validated -**Dependencies:** [TECH-DECODE-001](#tech-decode-001) +**Dependencies:** — **Description:** The receiver logic gets the hardware through a `ReceiverHal*` given at construction and touches no AVR register. `ReceiverHal` is chosen at compile time, without virtual call: the ATmega implementation on the ATmega328P and ATmega32U4, a test double on native builds; any other target fails to compile. Its operations: pop the oldest ended pulse (level, duration in µs; false when none), read the current second, draw an 8x16 cell (text page 0–2, column 0–15), draw a 16x32 cell (column 0–5), and, when the compile-time `HasLineOutput` is true, write one text line without terminator. The test double lets a caller push pulses, set the time, and read back the drawn cells, the number of draws and the written lines. ### TECH-DECODE-003 @@ -173,10 +180,12 @@ **Title:** FormatPage, ReadGlyph and ReadBigGlyphPage build the OLED cells without dynamic allocation **Status:** deprecated **Dependencies:** [TECH-DECODE-003](#tech-decode-003), [UI-DECODE-001](ui.md#ui-decode-001), [UI-DECODE-002](ui.md#ui-decode-002), [UI-DECODE-003](ui.md#ui-decode-003) +**Superseded by:** [UI-DECODE-003](ui.md#ui-decode-003) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the screen content is [UI-DECODE-001](ui.md#ui-decode-001) to 003. ### TECH-DECODE-005 **Title:** Arduino receiver: shared entry point, and AtmegaReceiverHal built on Timer1 interrupts, Wire and Serial **Status:** deprecated **Dependencies:** [TECH-DECODE-002](#tech-decode-002), [TECH-DECODE-003](#tech-decode-003), [PLAT-DECODE-003](platform.md#plat-decode-003), [PLAT-DECODE-004](platform.md#plat-decode-004), [PLAT-DECODE-005](platform.md#plat-decode-005), [CONF-DECODE-003](configuration.md#conf-decode-003), [CONF-DECODE-004](configuration.md#conf-decode-004) +**Superseded by:** [PLAT-DECODE-003](platform.md#plat-decode-003) **Description:** Deprecated 2026-11-20: design detail, described in [docs/architecture.md](../docs/architecture.md); the receiver hardware use is [PLAT-DECODE-003](platform.md#plat-decode-003) to 005. From ce96f946d8b322ebefe8a87c1377ffa793b17cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:09:34 +0100 Subject: [PATCH 23/32] req(PLAT-DEBUG-001,PLAT-POWER-007,PLAT-ISP-001): PLAT-DEBUG-001 derives from TECH-HAL-001 with a baud tolerance and exact number formats; R9/R10 topology only in PLAT-ISP-001, which cites FUNC-SENSOR-001 (audit 2026-11-20 findings 1, 7, 9, 10) Co-Authored-By: Claude Opus 5.5 --- requirements/platform.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements/platform.md b/requirements/platform.md index dc01fd1..1b23700 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -65,7 +65,7 @@ **Status:** validated **Dependencies:** [PLAT-POWER-002](#plat-power-002) **derives_from:** [FUNC-SENSOR-001](functional.md#func-sensor-001) -**Description:** Every board running this firmware has external pull-ups on its sensor buses, to `SENSOR_VCC`, the sensor rail switched by PA2: SCL (PA4) and SDA (PA6) for the I2C bus, and the 1-Wire bus (PA3), which serves the DS18B20. The firmware enables no internal pull-up on these pins ([PLAT-POWER-008](#plat-power-008)), so a board without them has no working I2C bus. On v3.0 they are three 4.7 kΩ resistors: R3 on SCL, R2 on SDA, R6 on 1-Wire; R3 and R2 sit on the sensor-connector side of the 330 Ω series resistors R9 (SCL) and R10 (SDA), which keep the ISP lines free of the sensor. Both buses are therefore unpowered whenever PA2 is low ([PLAT-POWER-002](#plat-power-002)). The v2.2 board of the mushroom also has its I2C pull-ups on `SENSOR_VCC` (values not recorded). +**Description:** Every board running this firmware has external pull-ups on its sensor buses, to `SENSOR_VCC`, the sensor rail switched by PA2: SCL (PA4) and SDA (PA6) for the I2C bus, and the 1-Wire bus (PA3), which serves the DS18B20. The firmware enables no internal pull-up on these pins ([PLAT-POWER-008](#plat-power-008)), so a board without them has no working I2C bus. On v3.0 they are three 4.7 kΩ resistors: R3 on SCL, R2 on SDA, R6 on 1-Wire; R3 and R2 sit on the sensor-connector side of the ISP isolation resistors ([PLAT-ISP-001](#plat-isp-001)). Both buses are therefore unpowered whenever PA2 is low ([PLAT-POWER-002](#plat-power-002)). The v2.2 board of the mushroom also has its I2C pull-ups on `SENSOR_VCC` (values not recorded). --- @@ -83,16 +83,16 @@ **Status:** validated **Dependencies:** [PLAT-POWER-007](#plat-power-007) **derives_from:** [FUNC-SENSOR-001](functional.md#func-sensor-001) -**Description:** The ISP lines SCK (PA4) and MOSI (PA6) are also the I2C SCL and SDA. On v3.0, the sensor connector reaches them through 330 Ω series resistors, R9 on SCL and R10 on SDA, with the sensor pull-ups on the connector side ([PLAT-POWER-007](#plat-power-007)), while the ISP header J6 is wired directly to the MCU pins. The programmer therefore drives SCK and MOSI without the sensor loading them, and the board is flashed with the BME280 in place; the sensor still reads correctly through the resistors afterwards. v2.2 boards have no such resistors: their sensor is removed before flashing. +**Description:** The ISP lines SCK (PA4) and MOSI (PA6) are also the I2C SCL and SDA. On v3.0, the sensor connector reaches them through 330 Ω series resistors, R9 on SCL and R10 on SDA, with the sensor pull-ups on the connector side ([PLAT-POWER-007](#plat-power-007)), while the ISP header J6 is wired directly to the MCU pins. The programmer therefore drives SCK and MOSI without the sensor loading them, and the board is flashed with the BME280 in place; the sensor then reads as [FUNC-SENSOR-001](functional.md#func-sensor-001) requires, through the resistors. v2.2 boards have no such resistors: their sensor is removed before flashing. --- ### PLAT-DEBUG-001 -**Title:** Debug serial output: transmit only on PA7, 9600 baud 8N1, line idle high +**Title:** Debug serial output: transmit only on PA7, 9600 baud ± 2 % 8N1, line idle high **Status:** validated **Dependencies:** [PLAT-POWER-005](#plat-power-005) -**derives_from:** [TECH-SERIAL-002](technical.md#tech-serial-002) -**Description:** The emitter's debug serial output is a software UART on PA7: 9600 baud, each byte a low start bit, 8 data bits least significant first, then a high stop bit. The line is idle high from the start of the output. Numbers are written as text, in decimal unless another base is asked for, and a written line ends with `\r\n`. There is no receive path. The bit time is calibrated for the 1 MHz clock ([PLAT-POWER-005](#plat-power-005)). +**derives_from:** [TECH-HAL-001](technical.md#tech-hal-001) +**Description:** The emitter's debug serial output is a software UART on PA7: 9600 baud ± 2 %, each byte a low start bit, 8 data bits least significant first, then a high stop bit. The line is idle high from the start of the output. Numbers go out as text: signed decimal by default, unsigned in a base from 2 to 16 with upper-case digits when one is given, or as the raw byte with base 0. A line ends with `\r\n`. There is no receive path. The bit time is calibrated for the 1 MHz clock ([PLAT-POWER-005](#plat-power-005)). --- From 97906e8a1ee9cc988d8a71da5face81112ee9543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:09:51 +0100 Subject: [PATCH 24/32] test(PLAT-POWER-004): tag the native LED tests too (audit 2026-11-20 finding 3) Co-Authored-By: Claude Opus 5.5 --- emitter/test/test_led/ledTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emitter/test/test_led/ledTest.cpp b/emitter/test/test_led/ledTest.cpp index 1ae6d22..b28a145 100644 --- a/emitter/test/test_led/ledTest.cpp +++ b/emitter/test/test_led/ledTest.cpp @@ -45,11 +45,13 @@ void Expect_led_can_switch_off() { #else #include +// @req PLAT-POWER-004 void Expect_led_can_switch_on() { TestHal.LedOn(); TEST_ASSERT(TestHal.IsLedOn); } +// @req PLAT-POWER-004 void Expect_led_can_switch_off() { TestHal.LedOff(); TEST_ASSERT(!(TestHal.IsLedOn)); From 60c8ce5a70a92833fe0e085861d5883fdef5b6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:09:51 +0100 Subject: [PATCH 25/32] arch(TECH-MAIN-001,PLAT-DEBUG-001): TECH-MAIN-001 row without test environments; PLAT-DEBUG-001 row names Attiny84aHal and the line format (audit 2026-11-20 findings 11, 12) Co-Authored-By: Claude Opus 5.5 --- docs/architecture.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 540d889..72df616 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -220,9 +220,9 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [TECH-HAL-005](../requirements/technical.md#tech-hal-005) | `Attiny84aHal` / `TestHal_` | Deprecated, kept as design note: LedOn/LedOff toggle PORTB PB1 on AVR; toggle IsLedOn in TestHal_ | | [TECH-HAL-006](../requirements/technical.md#tech-hal-006) | `main.cpp` / `Attiny84aHal` / `TestHal_` | runCycle calls Init() first, before PowerOnSensors; Init() calls TinyI2C.init() on AVR (USE_I2C); TestHal_ records 'I'; checked in test_main_cycle | | [TECH-CONVERT-001](../requirements/technical.md#tech-convert-001) | `ConversionTools` | Deprecated, kept as design note: dec16ToHex packs each decimal digit of uint16_t into one nibble (BCD-in-hex) | -| [PLAT-DEBUG-001](../requirements/platform.md#plat-debug-001) | `SoftSerial` | Output-only UART at 9600 baud on PA7 (`DIGITAL_OUT`); one SerialWriteBit call per bit, bit period (1 000 000 / 9600) − 25 µs held by the HAL | +| [PLAT-DEBUG-001](../requirements/platform.md#plat-debug-001) | `SoftSerial` / `Attiny84aHal` | `SoftSerial`: one `SerialWriteBit` call per bit (start low, 8 data bits LSB first, stop high), `begin()` sets the line idle high, `print` / `println` write numbers as text (decimal, or base 2–16, or the raw byte with base 0) and end lines with `\r\n`. `Attiny84aHal::SerialWriteBit` drives PA7 (`DIGITAL_OUT`) and holds each bit (1 000 000 / 9600) − 25 µs at 1 MHz | | [TECH-SERIAL-001](../requirements/technical.md#tech-serial-001) | — | Deprecated: now [PLAT-DEBUG-001](../requirements/platform.md#plat-debug-001) | -| [TECH-MAIN-001](../requirements/technical.md#tech-main-001) | `main.cpp` / `include/main.h` / `platformio.ini` | One cycle extracted into `runCycle(Hal*)`; encoders built from the injected Hal, BMx280 file-scope; `main()` only loops on runCycle, excluded under UNIT_TEST; five `native_cycle_*` envs run `test_main_cycle` | +| [TECH-MAIN-001](../requirements/technical.md#tech-main-001) | `main.cpp` / `include/main.h` / `platformio.ini` | One cycle extracted into `runCycle(Hal*)`; encoders built from the injected Hal, BMx280 file-scope; `main()` only loops on runCycle, excluded under UNIT_TEST | | [TECH-SERIAL-002](../requirements/technical.md#tech-serial-002) | `main.cpp` | Draft. SoftSerial instantiated and SerialPrintInfo active only when USE_SERIAL_LOG defined; otherwise no-op; no build environment sets USE_SERIAL_LOG | | [TECH-X10-001](../requirements/technical.md#tech-x10-001) | `Hal` / `Attiny84aHal` / `TestHal_` | Deprecated, kept as design note: Five new pure-virtual Hal methods: DelayX10PreambleHigh (8960 µs), DelayX10PreambleLow (4500 µs), DelayX10BitShort (560 µs), DelayX10BitLong (1120 µs), DelayX10Gap (40000 µs) | | [TECH-X10-002](../requirements/technical.md#tech-x10-002) | `x10rf` | Deprecated, kept as design note: x10rf replaces all file-static _delay_us() calls with the five new Hal timing methods; block removed | From 7bd56426cfc6a773b2ab12258b493ffbfb488424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:09:51 +0100 Subject: [PATCH 26/32] docs: debugging.md points to PLAT-ISP-001 and its bench sheet instead of 'bench check pending' (audit 2026-11-20 finding 10) Co-Authored-By: Claude Opus 5.5 --- docs/debugging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/debugging.md b/docs/debugging.md index d2c12ee..9fb5d0a 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -21,7 +21,7 @@ Two ways, both over the 6-pin ISP connector: - **USB driver:** PlatformIO's avrdude 6.3 talks to the Dragon through libusb only. With the Atmel/Microchip (Jungo) driver, it fails with `usbdev_open(): did not find any USB device "usb" (0x03eb:0x2107)` and still prints `avrdude done. Thank you.`. Fix once with [Zadig](https://zadig.akeo.ie): *Options → List All Devices*, pick **AVR Dragon** (`03EB 2107`), install **libusb-win32**, replug. Microchip Studio no longer sees the Dragon afterwards (reinstall the Atmel driver from the Device Manager to go back). - **Check the exit code**, not the last line: avrdude ends with `done. Thank you.` even on failure. Under Git Bash its messages only show when stderr is redirected to a file (`2> avrdude.err`). -- **v2.2 and earlier: remove the BME280 (or any I2C sensor) before flashing.** SCK/MOSI are SCL/SDA, and the I2C pull-ups R2/R3 go to SENSOR_VCC (PA2), which is unpowered while the chip is held in reset. Driving SCK/MOSI then back-powers the sensor rail through the pull-ups and the sensor's protection diodes, and the Dragon fails with `ISP activation failed` / `RSP_DEBUGWIRE_SYNC_FAILED`, even with VCC and RESET at 3.3 V and a slow clock (`-B32`). Hardware fix: BACKLOG R19, R9/R10 330 Ω on v3.0, where the sensor should stay in place (bench check pending). In the v2.2 mushroom board, this means opening the gill disc for every flash. +- **v2.2 and earlier: remove the BME280 (or any I2C sensor) before flashing.** SCK/MOSI are SCL/SDA, and the I2C pull-ups R2/R3 go to SENSOR_VCC (PA2), which is unpowered while the chip is held in reset. Driving SCK/MOSI then back-powers the sensor rail through the pull-ups and the sensor's protection diodes, and the Dragon fails with `ISP activation failed` / `RSP_DEBUGWIRE_SYNC_FAILED`, even with VCC and RESET at 3.3 V and a slow clock (`-B32`). Hardware fix: BACKLOG R19, R9/R10 330 Ω on v3.0, where the sensor stays in place ([PLAT-ISP-001](../requirements/platform.md#plat-isp-001), bench sheet [`tests/bench/PLAT-ISP-001.md`](../tests/bench/PLAT-ISP-001.md)). In the v2.2 mushroom board, this means opening the gill disc for every flash. - **Replug the Dragon after a failed sync:** it then answers `sign-on command: status -1` to everything until it is unplugged from USB. - Read before writing: `avrdude -P usb -B8 -pt84 -cdragon_isp -C /avrdude.conf -U lfuse:r:-:h` prints the signature (`0x1e930c`) and Vtarget. If the fuses already read `DF`/`62`/`FF`, flash only (`-U flash:w::i`, verified by default). From 27fd3a0a0d33d629a10e7c8b2b93c45a79b9081a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:10:11 +0100 Subject: [PATCH 27/32] plan: audit 2026-11-20, 11 findings fixed, 1 excluded (HIST-COMMIT-MISMATCH-001 extended) Co-Authored-By: Claude Opus 5.5 --- audits/2026-11-20-audit.md | 59 ++++++++++++++++++++++---------------- audits/exclusions.yml | 4 +-- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/audits/2026-11-20-audit.md b/audits/2026-11-20-audit.md index 5561712..fee6423 100644 --- a/audits/2026-11-20-audit.md +++ b/audits/2026-11-20-audit.md @@ -12,18 +12,28 @@ Plugin rbd 0.16.0. Agents: `audit-traceability`, `audit-coherence`; both returne | # | Finding | Status | |---|---------|--------| -| 1 | PLAT-DEBUG-001 is validated but derives_from the draft TECH-SERIAL-002, which depends back on it | open | -| 2 | TECH-DECODE-002 still depends on the deprecated TECH-DECODE-001 | open | -| 3 | The native variants of the two LED tests have no `@req` tag | open | -| 4 | PLAT-POWER-008 and PLAT-DEBUG-001: their code was committed under the now deprecated TECH-HAL-004 / TECH-SERIAL-001 | open | -| 5 | PLAT-ISP-001, FUNC-SENSOR-001, PLAT-POWER-005, PLAT-POWER-007: bench sheet only, no implementation commit | open | -| 6 | PLAT-POWER-001, 003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, 011: build/inspection verification, no implementation commit | open | -| 7 | PLAT-ISP-001 and PLAT-POWER-007 both state the R9/R10 topology and its reason | open | -| 8 | TECH-SERIAL-002 is still written as a plan; its Verification line verifies nothing | open | -| 9 | PLAT-DEBUG-001: no baud tolerance; number formatting is software output, not hardware use | open | -| 10 | PLAT-ISP-001: "still reads correctly" has no criterion; docs/debugging.md still says "bench check pending" | open | -| 11 | Architecture row of TECH-MAIN-001 restates the native test environments the requirement dropped | open | -| 12 | Architecture row of PLAT-DEBUG-001 omits `Attiny84aHal` (PA7, bit timing) and the line format | open | +| 1 | PLAT-DEBUG-001 is validated but derives_from the draft TECH-SERIAL-002, which depends back on it | fixed | +| 2 | TECH-DECODE-002 still depends on the deprecated TECH-DECODE-001 | fixed | +| 3 | The native variants of the two LED tests have no `@req` tag | fixed | +| 4 | PLAT-POWER-008 and PLAT-DEBUG-001: their code was committed under the now deprecated TECH-HAL-004 / TECH-SERIAL-001 | fixed | +| 5 | PLAT-ISP-001, FUNC-SENSOR-001, PLAT-POWER-005, PLAT-POWER-007: bench sheet only, no implementation commit | fixed | +| 6 | PLAT-POWER-001, 003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, 011: build/inspection verification, no implementation commit | excluded | +| 7 | PLAT-ISP-001 and PLAT-POWER-007 both state the R9/R10 topology and its reason | fixed | +| 8 | TECH-SERIAL-002 is still written as a plan; its Verification line verifies nothing | fixed | +| 9 | PLAT-DEBUG-001: no baud tolerance; number formatting is software output, not hardware use | fixed | +| 10 | PLAT-ISP-001: "still reads correctly" has no criterion; docs/debugging.md still says "bench check pending" | fixed | +| 11 | Architecture row of TECH-MAIN-001 restates the native test environments the requirement dropped | fixed | +| 12 | Architecture row of PLAT-DEBUG-001 omits `Attiny84aHal` (PA7, bit timing) and the line format | fixed | + +## Resolution (2026-11-20) + +- 1, 8: PLAT-DEBUG-001 derives from TECH-HAL-001; TECH-SERIAL-002 stays draft (USE_SERIAL_LOG not decided), reworded at spec level without Verification line. +- 2, 7, 9, 10: requirements fixed (TECH-DECODE-002 dependency, R9/R10 only in PLAT-ISP-001, PLAT-DEBUG-001 tolerance and number formats, PLAT-ISP-001 cites FUNC-SENSOR-001, debugging.md points to the bench sheet). +- 3: native LED tests tagged PLAT-POWER-004. +- 4: `**Superseded by:**` on the deprecated TECH requirements (rbd 0.17.0). +- 5: fixed by rbd 0.17.0: a requirement whose only tests are bench sheets needs no implementation commit. +- 6: excluded, HIST-COMMIT-MISMATCH-001 extended. +- 11, 12: architecture rows fixed. ## Findings @@ -31,73 +41,74 @@ Plugin rbd 0.16.0. Agents: `audit-traceability`, `audit-coherence`; both returne **Type:** Traceability — PLAT derives_from (T7) and coherence — dependency validity (C3) **Requirements:** PLAT-DEBUG-001, TECH-SERIAL-002 **Issue:** PLAT-DEBUG-001 (validated) derives_from TECH-SERIAL-002, which is draft; TECH-SERIAL-002 lists PLAT-DEBUG-001 as a dependency, so each points to the other. Either validate TECH-SERIAL-002 (the open USE_SERIAL_LOG decision) or derive PLAT-DEBUG-001 from a validated FUNC/TECH requirement. -**Status:** open +**Status:** fixed ### Finding 2 **Type:** Coherence — dependency validity (C3) **Requirement:** TECH-DECODE-002 **Issue:** Reworded in this range, it still lists the deprecated TECH-DECODE-001 (the Loopback test helper) as a dependency; its new text no longer uses it. The link was removed from FUNC-DECODE-001/002/004 and CONF-DECODE-002 but not here. -**Status:** open +**Status:** fixed ### Finding 3 **Type:** Traceability — test tag coverage (T6a) **File:** emitter/test/test_led/ledTest.cpp:48, :53 **Issue:** `Expect_led_can_switch_on` and `Expect_led_can_switch_off` exist twice, under `#ifdef AVR` and `#else`. Only the AVR variants carry `// @req PLAT-POWER-004`; the native ones, which `native_debug` runs, have no tag (already untagged before this range). -**Status:** open +**Status:** fixed ### Finding 4 **Type:** Traceability — implementation coverage (T3) **Requirements:** PLAT-POWER-008, PLAT-DEBUG-001 **Issue:** The code behind PLAT-POWER-008 was committed as `tech(TECH-HAL-004)` (18f6b47, 19b1ff7), that behind PLAT-DEBUG-001 as `tech(TECH-SERIAL-001)` (6817d72); both IDs are now deprecated, so no implementation commit cites the new IDs. The `**Superseded by:**` field of rbd 0.17.0 would carry the link. -**Status:** open +**Status:** fixed ### Finding 5 **Type:** Traceability — implementation coverage (T3) **Requirements:** PLAT-ISP-001, FUNC-SENSOR-001, PLAT-POWER-005, PLAT-POWER-007 **Issue:** Their only commits besides `req(...)` are the bench sheet `test(...)` commits (ef99dd0, 49a0bc4, 5ad52ad); no implementation commit cites them. PLAT-ISP-001 and PLAT-POWER-007 are hardware properties (R9/R10, pull-ups), implemented by `hw:` commits that carry no ID. -**Status:** open +**Status:** fixed ### Finding 6 **Type:** Traceability — implementation coverage (T3, warning) **Requirements:** PLAT-POWER-001, PLAT-POWER-003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, CONF-BUILD-011 **Issue:** Their new `**Verification:** build|inspection` line means they need an implementation commit, and none cites them: pre-RBD code (TECH-HAL-001, CONF-BUILD-007/011), `fix(PLAT-POWER-003)` (22eacc3) instead of an implementation prefix, and code committed under other IDs. CONF-BUILD-003 is in the same state and already excluded by HIST-COMMIT-MISMATCH-001. -**Status:** open +**Status:** excluded +**Exclusion ref:** HIST-COMMIT-MISMATCH-001 ### Finding 7 **Type:** Coherence — overlap (C1) **Requirements:** PLAT-ISP-001, PLAT-POWER-007 **Issue:** Both describe R9 (SCL) / R10 (SDA) 330 Ω with R3/R2 on the sensor-connector side, and PLAT-POWER-007 gives the reason ("keep the ISP lines free of the sensor") that PLAT-ISP-001 requires. Keep the topology in PLAT-ISP-001 and have PLAT-POWER-007 cite it. -**Status:** open +**Status:** fixed ### Finding 8 **Type:** Coherence — precision (C2) **Requirement:** TECH-SERIAL-002 **Issue:** Changed in this range but still names a file (`emitter/src/main.cpp`), a header, a class instance (`SoftSerial swSerial(&hal)`) and a function (`SerialPrintInfo`). Its Verification line ("build — no environment sets USE_SERIAL_LOG yet") says nothing builds it, which verifies nothing. -**Status:** open +**Status:** fixed ### Finding 9 **Type:** Coherence — precision (C2) **Requirement:** PLAT-DEBUG-001 **Issue:** "9600 baud" with no tolerance (a UART receiver needs about ±2 %; the architecture uses (1 000 000 / 9600) − 25 µs), so no pass threshold. "In decimal unless another base is asked for" does not say which bases; number formatting is software output, out of place in a PLAT requirement. -**Status:** open +**Status:** fixed ### Finding 10 **Type:** Coherence — precision (C2) **Requirement:** PLAT-ISP-001 **Issue:** "The sensor still reads correctly through the resistors afterwards" has no criterion (it could cite FUNC-SENSOR-001). docs/debugging.md:24 still says the sensor stays in place on v3.0 "(bench check pending)", test information the bench sheet now holds. -**Status:** open +**Status:** fixed ### Finding 11 **Type:** Coherence — architecture coherence (C5) **Requirement:** TECH-MAIN-001 **Issue:** The traceability row still says "five `native_cycle_*` envs run `test_main_cycle`" and names `include/main.h` / `platformio.ini`, text the requirement dropped in this range. -**Status:** open +**Status:** fixed ### Finding 12 **Type:** Coherence — architecture coherence (C5) **Requirement:** PLAT-DEBUG-001 **Issue:** The row lists `SoftSerial` only, while PA7 and the bit timing live in `Attiny84aHal::SerialWriteBit`; it also leaves out the idle-high line, the text number output and the `\r\n` line end. -**Status:** open +**Status:** fixed ## Info (no action required) diff --git a/audits/exclusions.yml b/audits/exclusions.yml index 2c8362c..746bf29 100644 --- a/audits/exclusions.yml +++ b/audits/exclusions.yml @@ -4,8 +4,8 @@ exclusions: justification: "The code predates the RBD workflow; the test commits tagged existing tests (FUNC-ANALOG-001 to PLAT-POWER-004 added on 2026-11-17 by 7f4c027, 6fdc43a, 4919547). Adding implementation commits would mean rewriting master history." date: 2026-11-17 - id: HIST-COMMIT-MISMATCH-001 - finding: "Commit history mismatches for CONF-BUILD-002, CONF-BUILD-003, CONF-BUILD-013, FUNC-DECODE-003, FUNC-DECODE-005, TECH-SERIAL-001, CONF-BUILD-012, FUNC-SENSOR-003" - justification: "Merged history (chore: CI wiring, tests or code bundled in a neighbour commit). TECH-SERIAL-001 (6817d72 added its tests inside the tech commit), CONF-BUILD-012 (code in 0d775cc feat(FUNC-BATTERY-002), tag in d64fb61) and FUNC-SENSOR-003 (tags in a5987fb, tech: without ID) added on 2026-11-17 (audit 3, finding 10). It cannot change without rewriting master; the current tags and code are traced." + finding: "Commit history mismatches for CONF-BUILD-002, CONF-BUILD-003, CONF-BUILD-013, FUNC-DECODE-003, FUNC-DECODE-005, TECH-SERIAL-001, CONF-BUILD-012, FUNC-SENSOR-003, PLAT-POWER-001, PLAT-POWER-003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, CONF-BUILD-011" + justification: "Merged history (chore: CI wiring, tests or code bundled in a neighbour commit). TECH-SERIAL-001 (6817d72 added its tests inside the tech commit), CONF-BUILD-012 (code in 0d775cc feat(FUNC-BATTERY-002), tag in d64fb61) and FUNC-SENSOR-003 (tags in a5987fb, tech: without ID) added on 2026-11-17 (audit 3, finding 10). It cannot change without rewriting master; the current tags and code are traced. Added on 2026-11-20 (audit 2026-11-20, finding 6): build/inspection requirements whose code predates RBD (TECH-HAL-001, CONF-BUILD-007, CONF-BUILD-011), was committed with fix(PLAT-POWER-003) (22eacc3), or under neighbour IDs (PLAT-POWER-001 under TECH-HAL-007, TECH-DECODE-003 under the FUNC-DECODE commits)." date: 2026-11-17 - id: HIST-PREFIX-001 finding: "Plan and architecture files changed by commits with the wrong prefix (.rbd/config.yml, requirements/technical.md, requirements/platform.md, docs/architecture.md)" From 6cc14bc18da7710753550d236fd713c73a128814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:14:16 +0100 Subject: [PATCH 28/32] plan: audit 2026-11-20 (2), full, rbd 0.17.0, on 27fd3a0 (7 findings open) Co-Authored-By: Claude Opus 5.5 --- audits/2026-11-20-audit-2.md | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 audits/2026-11-20-audit-2.md diff --git a/audits/2026-11-20-audit-2.md b/audits/2026-11-20-audit-2.md new file mode 100644 index 0000000..cd197d4 --- /dev/null +++ b/audits/2026-11-20-audit-2.md @@ -0,0 +1,75 @@ +# Audit Report — 2026-11-20 + +Audited commit: 27fd3a0a0d33d629a10e7c8b2b93c45a79b9081a — branch `req/abstraction` — PR #94 + +Mode: full + +Plugin rbd 0.17.0 (bench sheets count as tests). Agents: `audit-traceability`, `audit-coherence`; both returned valid output. `audits/exclusions.yml` holds 7 exclusions; the entries they cover are not repeated. + +30 raw entries (14 traceability, 16 coherence) merged into 7 findings and 20 info items. + +## Summary + +| # | Finding | Status | +|---|---------|--------| +| 1 | PLAT-DEBUG-001 has a test commit but no implementation commit (code committed under the deprecated TECH-SERIAL-001) | open | +| 2 | Two old `arch()` commits cite IDs removed since (CONF-DECODE-001, PLAT-DECODE-001) | open | +| 3 | TECH-SENSOR-001 (draft) only names the code behind FUNC-SENSOR-002 and ends with plan text | open | +| 4 | TECH-SERIAL-002 (draft): the `name value unit` line is not pinned down; its title names `SoftSerial` | open | +| 5 | PLAT-POWER-001 and 003: their Verification line mentions the bench sheet | open | +| 6 | FUNC-X10-005 and PLAT-POWER-004 both state the X10 LED framing; PLAT-POWER-004 derives from FUNC-X10-005 only | open | +| 7 | Back-references in text make parent and child depend on each other (TECH-MAIN-001 / FUNC-MAIN-001, TECH-HAL-006; UI-DECODE-001 / FUNC-DECODE-007, UI-DECODE-003; PLAT-DECODE-005 / CONF-DECODE-004) | open | + +## Findings + +### Finding 1 +**Type:** Traceability — implementation coverage (T3) +**Requirement:** PLAT-DEBUG-001 +**Issue:** `test(PLAT-DEBUG-001)` (0298503) exists, but no implementation commit cites PLAT-DEBUG-001: the code is 6817d72 `tech(TECH-SERIAL-001)`, now deprecated with `**Superseded by:** PLAT-DEBUG-001`. 0298503 is not a tag-only backfill (it also edits comments), and neither HIST-COMMIT-MISMATCH-001 nor HIST-BACKFILL-001 lists PLAT-DEBUG-001. PLAT-POWER-008, in the same situation, is not flagged because its only tests are bench sheets. +**Status:** open + +### Finding 2 +**Type:** Traceability — architecture currency (T5) +**Requirements:** CONF-DECODE-001, PLAT-DECODE-001 +**Issue:** ee76804 `arch(CONF-DECODE-001)` and b7b07fc `arch(PLAT-DECODE-001)` (2026-11-09) cite IDs that were later removed from the requirement files (aecbdb3, a25dc41). Valid when committed; historical. +**Status:** open + +### Finding 3 +**Type:** Coherence — precision (C2) +**Requirement:** TECH-SENSOR-001 +**Issue:** The draft names the `Ds18b20` class, `emitter/include/Ds18b20.h`, `Begin()` / `Convert()` / `Read()`, `hal->Delay1s()` and the driver calls, and ends with "Not implemented yet: to do when the DS18B20 path is validated again". Keep the constraint and its reason (PA3 released after the read, no AVR register in the cycle); the rest belongs in docs/architecture.md. To do with the DS18B20 rework (#54, #56). +**Status:** open + +### Finding 4 +**Type:** Coherence — precision (C2) +**Requirement:** TECH-SERIAL-002 +**Issue:** The line format `name value unit` gives no exact name and unit per value, no order and no number format, so two implementations would differ. The title still names the `SoftSerial` class. +**Status:** open + +### Finding 5 +**Type:** Coherence — precision (C2) +**Requirements:** PLAT-POWER-001, PLAT-POWER-003 +**Issue:** "…; current and period measured by the bench sheet" and "…; pin levels measured by the bench sheet" are test information in the Verification line. The sheet carries the tag; the requirement need not mention it. Keep only the inspection ``. +**Status:** open + +### Finding 6 +**Type:** Coherence — overlap (C1) +**Requirements:** FUNC-X10-005, PLAT-POWER-004 +**Issue:** FUNC-X10-005 says "the LED is lit from before the first copy until after the last", which PLAT-POWER-004 defines for every transmission. PLAT-POWER-004 derives from and depends on FUNC-X10-005 only, though it also covers FUNC-SENSOR-003 and FUNC-MAIN-001. Keep the LED sentence in PLAT-POWER-004 only. +**Status:** open + +### Finding 7 +**Type:** Coherence — circular dependency (C4, in substance) +**Requirements:** TECH-MAIN-001, FUNC-MAIN-001, TECH-HAL-006; UI-DECODE-001, FUNC-DECODE-007, UI-DECODE-003; PLAT-DECODE-005, CONF-DECODE-004 +**Issue:** The declared Dependencies graph has no cycle, but in each group the parent's text cites a child that lists the parent as a dependency (e.g. TECH-MAIN-001 cites FUNC-MAIN-001 and TECH-HAL-006, which both depend on TECH-MAIN-001). Either move the cited behaviour out of the parent, or accept these as back-references. +**Status:** open + +## Info (no action required) + +- **T1, build or inspection:** CONF-BUILD-003, 007, 011, 014, 015, CONF-DECODE-002..004, TECH-HAL-001, TECH-DECODE-003. +- **T1, bench check pending for the latest release tag v1.0.0** (every Results table is empty): tests/bench/FUNC-SENSOR-001.md, PLAT-DECODE-003.md, PLAT-DECODE-004.md, PLAT-DECODE-005.md, PLAT-ISP-001.md, PLAT-POWER-001.md, PLAT-POWER-003.md, PLAT-POWER-005.md, PLAT-POWER-006.md, PLAT-POWER-007.md, PLAT-POWER-008.md. +- **T3:** bench-only requirements need no implementation commit: FUNC-SENSOR-001, PLAT-POWER-005, 007, 008, PLAT-ISP-001. +- **C2:** CONF-BUILD-012 ends with "which closes BACKLOG F1"; CONF-BUILD-003 keeps a history note (the old 0xA5 limit); CONF-BUILD-014 says "the environment docs list it" without naming docs/environments.md or the fields; FUNC-OREGON-009 does not say what byte 2 holds before any valid channel is set. +- **C1:** the low-battery muting rule is written in FUNC-BATTERY-003 and repeated as "while the battery is not low" in FUNC-X10-006, FUNC-X10-007, FUNC-SENSOR-003 and FUNC-ANALOG-001; they agree today. +- **C5:** the FUNC-X10-005 row points to the deprecated TECH-X10-001, whose note gives DelayX10BitLong 1120 µs where FUNC-X10-005 says a `1` low is 1680 µs (560 + 1120); the TECH-MAIN-001 row omits the call order and still lists `platformio.ini`; the component diagram shows `LightSensor -->|Delay30ms|` while FUNC-SENSOR-003 waits 150 ms, and the "Luminosity always uses Lacrosse" note says "Oregon v3"; the CONF-BUILD-014 row omits the 1104 mV calibration and the docs listing; the BMx280 Dependency Injection Map row is "— (none)" on purpose (TECH-HAL-001). +- **Checks with no finding:** T2 (no unknown ID; no bench sheet cites a draft or deprecated requirement), T5 (every validated requirement has a row), T6a (all 145 Unity test functions, 3 shell checks and 11 bench sheets tagged), T7 (every PLAT derives from a validated FUNC or TECH requirement), T8 (all IDs linked), C3 (no validated requirement rests on a draft), no cycle in Dependencies. From c4ec819ff4e722512c7f1691b59963140e7f1dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:30:49 +0100 Subject: [PATCH 29/32] req(TECH-SENSOR-001,TECH-SERIAL-002): constraint and reason only for the DS18B20 draft; exact debug log lines (audit 2026-11-20 (2) findings 3, 4) Co-Authored-By: Claude Opus 5.5 --- requirements/technical.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements/technical.md b/requirements/technical.md index c8faa1e..4dc1f7a 100644 --- a/requirements/technical.md +++ b/requirements/technical.md @@ -107,10 +107,10 @@ --- ### TECH-SERIAL-002 -**Title:** Debug logging via SoftSerial is compiled only when USE_SERIAL_LOG is defined +**Title:** With USE_SERIAL_LOG only, each cycle writes its measured values as text lines on the debug serial output **Status:** draft **Dependencies:** [PLAT-DEBUG-001](platform.md#plat-debug-001) -**Description:** With `USE_SERIAL_LOG`, each cycle writes every value it measures (battery, analog input, luminosity, temperature, humidity, pressure) as one `name value unit` line on the debug serial output ([PLAT-DEBUG-001](platform.md#plat-debug-001)). Without it, the firmware has no debug output and links no serial code, which keeps flash and cycle time for the sensor builds. +**Description:** With `USE_SERIAL_LOG`, each cycle writes one line per value it measures on the debug serial output ([PLAT-DEBUG-001](platform.md#plat-debug-001)), as `: ` with the value an unsigned decimal, in this order and only for the values the build measures: `Vbatt: mV`, `Raw analog: ADC`, `Analog voltage: mV`, `Luminosity: Lux`, `Temp.: °C`, `RH : <%> %`, `Pressure : hPA`. Without it, the firmware writes nothing and links no serial code, which keeps flash and cycle time for the sensor builds. --- @@ -133,10 +133,10 @@ --- ### TECH-SENSOR-001 -**Title:** DS18B20 access encapsulated in a Ds18b20 wrapper class; main.cpp must not reference AVR registers or ds18b20 library functions directly +**Title:** With a DS18B20, the cycle touches no AVR register and PA3 is released after each read **Status:** draft **Dependencies:** [TECH-HAL-001](#tech-hal-001), [FUNC-SENSOR-002](functional.md#func-sensor-002) -**Description:** A `Ds18b20` wrapper class (header `emitter/include/Ds18b20.h`) must encapsulate all 1-Wire DS18B20 interactions. On AVR, `Ds18b20` must accept a `Hal*` at construction and expose `Begin()`, `Convert()`, `Read()` (returning `int16_t` temperature in °C as integer), and use `hal->Delay1s()` between `ds18b20convert` and `ds18b20read` internally. On non-AVR targets all methods must be stubs returning 0. `main.cpp` must not call `ds18b20convert()`, `ds18b20read()`, or reference `PORTA`, `DDRA`, or `PINA` in any `USE_DS18B20` code path; all such calls are delegated exclusively to `Ds18b20`. Once `Read()` has finished, `Ds18b20` releases PA3: input, no internal pull-up, never left driven high (the 1-Wire library leaves it an output driven high). R6 pulls the line up to `SENSOR_VCC` while the sensors are powered ([PLAT-POWER-007](platform.md#plat-power-007)), so a released PA3 never powers the DS18B20 with the sensor rail off. Not implemented yet: to do when the DS18B20 path is validated again. +**Description:** On a DS18B20 build, all 1-Wire access goes through a sensor wrapper given the `Hal` ([TECH-HAL-001](#tech-hal-001)): the cycle (`runCycle`) touches no AVR register and calls no 1-Wire driver function, so native builds run it with the sensor reading 0. After each read, PA3 is released: an input without internal pull-up, never left driven high (the 1-Wire driver leaves it driven high). R6 pulls the line up to `SENSOR_VCC` while the sensors are powered ([PLAT-POWER-007](platform.md#plat-power-007)), so a released PA3 never powers the DS18B20 with the sensor rail off. --- From 1a5c44bdc53de6cc3db79b69877b235ee6ae3685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:30:49 +0100 Subject: [PATCH 30/32] req(PLAT-POWER-001,PLAT-POWER-003,PLAT-POWER-004,FUNC-X10-005): Verification lines without bench mention; LED framing only in PLAT-POWER-004, which also depends on FUNC-SENSOR-003 (audit 2026-11-20 (2) findings 5, 6) Co-Authored-By: Claude Opus 5.5 --- requirements/functional.md | 4 ++-- requirements/platform.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements/functional.md b/requirements/functional.md index d434df6..02ec90b 100644 --- a/requirements/functional.md +++ b/requirements/functional.md @@ -173,10 +173,10 @@ **Description:** An X10 security frame is 6 bytes: byte 0 is the address; byte 1 is the address with its low nibble inverted; byte 2 is the command and byte 3 its complement; byte 4 is the id; byte 5 is the parity of the frame, 0x00 or 0x01: the XOR of bytes 0–4 folded down to one bit. It is sent per [FUNC-X10-005](#func-x10-005). ### FUNC-X10-005 -**Title:** Each X10 frame is repeated with a 40 ms gap, the LED on throughout +**Title:** Each X10 frame is repeated with a 40 ms gap **Status:** validated **Dependencies:** — -**Description:** An X10 frame is sent twice in each sensor cycle (the encoder takes the copy count at construction). Each copy is a preamble, radio high 8960 µs then low 4500 µs, then the frame bits most significant first and a one stop bit, each bit being high 560 µs then low 560 µs (`0`) or 1680 µs (`1`), followed by a 40 ms silence. The LED is lit from before the first copy until after the last. +**Description:** An X10 frame is sent twice in each sensor cycle (the encoder takes the copy count at construction). Each copy is a preamble, radio high 8960 µs then low 4500 µs, then the frame bits most significant first and a one stop bit, each bit being high 560 µs then low 560 µs (`0`) or 1680 µs (`1`), followed by a 40 ms silence. ### FUNC-X10-006 **Title:** Battery voltage in mV is sent as BCD in an RFXmeter frame while the battery is not low diff --git a/requirements/platform.md b/requirements/platform.md index 1b23700..50934cb 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -9,7 +9,7 @@ **Status:** validated **Dependencies:** [PLAT-POWER-008](#plat-power-008) **derives_from:** [TECH-MAIN-001](technical.md#tech-main-001) -**Verification:** inspection — sleep loop and BOD-disable sequence in the AVR `Hal` and the disassembly; current and period measured by the bench sheet +**Verification:** inspection — sleep loop and BOD-disable sequence in the AVR `Hal` and the disassembly **Description:** A hibernate of `s` seconds puts the ATtiny84A in power-down sleep for `s / 8` periods of the 8-second hardware watchdog, rounded down, and at least one: a request under 8 s still sleeps one period. Brownout detection is off during each sleep period. --- @@ -28,7 +28,7 @@ **Status:** validated **Dependencies:** [PLAT-POWER-001](#plat-power-001), [PLAT-POWER-002](#plat-power-002), [PLAT-POWER-008](#plat-power-008) **derives_from:** [TECH-MAIN-001](technical.md#tech-main-001) -**Verification:** inspection — PRR, DDR and PORT values set before sleep and restored after, in the AVR `Hal`; pin levels measured by the bench sheet +**Verification:** inspection — PRR, DDR and PORT values set before sleep and restored after, in the AVR `Hal` **Description:** Before the first sleep period, the power reduction register stops the USI, Timer0, Timer1 and the ADC. PA2 (`SENSOR_VCC`) and PB0 (radio data, the radio being always powered) are outputs held low, so the sensor rail stays off and the transmitter cannot key itself from a floating input. PA3 (1-Wire), PA4 (SCL), PA5 (MISO) and PA6 (SDA) are inputs without internal pull-up: their external pull-ups go to `SENSOR_VCC`, or (PA5) they may reach the sensor SDO in SPI wiring, so an internal pull-up would back-power the unpowered sensors. A floating input costs nothing in power-down, where the input buffers are clamped. Every other pin is an input: PA0 and PA1 without pull-up, PB3 (RESET) pulled up, PB2 pulled up except with `USE_SWITCHED_5V` ([PLAT-POWER-006](#plat-power-006)), and PA7 (digital output) and PB1 (LED) keep their last output level as pull-up state. After the last sleep period, PRR, DDRA, DDRB, PORTA and PORTB get back their values from before sleep. --- @@ -36,7 +36,7 @@ ### PLAT-POWER-004 **Title:** Every radio transmission is framed by the LED: on before, off after, then a 30 ms pause **Status:** validated -**Dependencies:** [FUNC-X10-005](functional.md#func-x10-005) +**Dependencies:** [FUNC-X10-005](functional.md#func-x10-005), [FUNC-SENSOR-003](functional.md#func-sensor-003) **derives_from:** [FUNC-X10-005](functional.md#func-x10-005) **Description:** A transmission is one frame of an encoder, with all its copies: the repeated copies of an X10 frame ([FUNC-X10-005](functional.md#func-x10-005)) are one transmission, while each luminosity copy ([FUNC-SENSOR-003](functional.md#func-sensor-003)) and each environment copy ([FUNC-MAIN-001](functional.md#func-main-001)) is its own transmission. Every transmission of a cycle turns the LED on before its first bit, turns it off after its last bit, then waits 30 ms; for an X10 frame, the 30 ms come after the 40 ms gap of its last copy. From 4f4c4348dc4c123a52ac933ba053f9eadb6b5db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:30:49 +0100 Subject: [PATCH 31/32] arch(FUNC-X10-005,FUNC-SENSOR-003): X10 row restates the current timings, LightSensor edge shows 5 x 30 ms, Oregon v2.1 in the luminosity note Co-Authored-By: Claude Opus 5.5 --- docs/architecture.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 72df616..08f9955 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -20,7 +20,7 @@ graph TD Ds18b20 -->|"1-Wire PA3"| ds18b20["ds18b20 (1-Wire driver library)"] main -->|Hal*| LightSensor["LightSensor (BH1750 wrapper)"] LightSensor -->|"I2C 0x23"| BH1750["BH1750 (I2C light sensor)"] - LightSensor -->|Delay30ms| HAL + LightSensor -->|Delay30ms ×5, 150 ms| HAL HAL["Hal (interface)"] --> Attiny84aHal["Attiny84aHal (AVR)"] HAL --> TestHal["TestHal_ (host/test)"] @@ -84,7 +84,7 @@ Protocol encoders and sensor wrappers that use the HAL receive `Hal*` at constru Design choices: - **Static interface, no virtual call.** The protocol is fixed at build time, so `EnvironmentEncoder` is a `typedef` and `ApplyMeasurements()` an overload per encoder. On an ATtiny84a (8 KB flash) this avoids a vtable and indirect calls while keeping a single call site in `main.cpp`. -- **Luminosity always uses Lacrosse.** Oregon v3 has no light frame, and a Lacrosse frame carrying luminosity cannot carry other fields (`LacrosseWS7000::Send()` gives luminosity priority). Targets with `USE_BH1750` therefore need `LACROSSE_ID`, whatever the environment protocol. +- **Luminosity always uses Lacrosse.** Oregon v2.1 has no light frame, and a Lacrosse frame carrying luminosity cannot carry other fields (`LacrosseWS7000::Send()` gives luminosity priority). Targets with `USE_BH1750` therefore need `LACROSSE_ID`, whatever the environment protocol. - **Encoders and sensors are built inside `runCycle`** from the injected `Hal*` and configured (`ConfigureEncoder()`, `SetAddress()`) on every cycle; the low-battery flag and battery voltage are locals of the cycle. Exception: `BMx280` is a file-scope object, because built per cycle it costs ~288 B flash on `robot` (97.7 % vs 93.9 %): LTO can no longer resolve the SparkFun driver at a fixed address. It only holds the driver configuration, re-initialised by `Begin()` every cycle. Otherwise nothing persists between cycles, so a field absent in a cycle no longer keeps its previous value in the encoder; this is harmless because the environment frame is only sent when a temperature is present. - **Native cycle tests.** `test_main_cycle` runs only in dedicated native envs that build `src/` (`test_build_src = yes`) with `SLEEP_TIME_IN_SECONDS=0` (`TestHal_::Hibernate` really sleeps); `native_debug` ignores it. One env per build variant family: @@ -209,7 +209,7 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [FUNC-X10-002](../requirements/functional.md#func-x10-002) | `x10rf` | RFXsensor 4-byte frame: address+type bits, partial complement, value, packet-type status + nibble-sum parity | | [FUNC-X10-003](../requirements/functional.md#func-x10-003) | `x10rf` | Deprecated: x10Switch is removed, no X10 switch frame is sent | | [FUNC-X10-004](../requirements/functional.md#func-x10-004) | `x10rf` | x10Security 6-byte frame: address, address with its low nibble inverted, command + complement, id, XOR-fold parity | -| [FUNC-X10-005](../requirements/functional.md#func-x10-005) | `x10rf` | Two copies per cycle, each followed by a 40 ms silence via DelayX10Gap (see [TECH-X10-001](../requirements/technical.md#tech-x10-001)); LED lit from before the first copy until after the last | +| [FUNC-X10-005](../requirements/functional.md#func-x10-005) | `x10rf` | Two copies per cycle, each a preamble (DelayX10PreambleHigh 8960 µs, DelayX10PreambleLow 4500 µs), bits high DelayX10BitShort 560 µs then low 560 µs (`0`) or DelayX10BitShort + DelayX10BitLong = 1680 µs (`1`), then a 40 ms silence (DelayX10Gap); LED framing per [PLAT-POWER-004](../requirements/platform.md#plat-power-004) | | [FUNC-X10-006](../requirements/functional.md#func-x10-006) | `main.cpp` | Battery voltage BCD-encoded and transmitted via RFXmeter; suppressed when lowBattery | | [FUNC-X10-007](../requirements/functional.md#func-x10-007) | `main.cpp` | Analog sensor voltage BCD-encoded and transmitted via RFXmeter; suppressed when lowBattery | | [TECH-HAL-001](../requirements/technical.md#tech-hal-001) | `Hal` / `Attiny84aHal` / `TestHal_` / `OregonV3` / `LacrosseWS7000` / `x10rf` / `SoftSerial` / `Ds18b20` / `LightSensor` / `BMx280` | Encoders and HAL-using wrappers take Hal* at construction; BMx280 (third-party bus driver) takes none; no direct AVR register access except addresses passed to a bus driver | From 2ff756f149b5ca2317d66d82b830b452833459e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:31:12 +0100 Subject: [PATCH 32/32] plan: audit 2026-11-20 (2), 4 findings fixed, 3 excluded (HIST-COMMIT-MISMATCH-001 extended, HIST-ARCH-REMOVED-ID-001, TEXT-BACKREF-001) Co-Authored-By: Claude Opus 5.5 --- audits/2026-11-20-audit-2.md | 41 ++++++++++++++++++++++++------------ audits/exclusions.yml | 12 +++++++++-- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/audits/2026-11-20-audit-2.md b/audits/2026-11-20-audit-2.md index cd197d4..ef1e748 100644 --- a/audits/2026-11-20-audit-2.md +++ b/audits/2026-11-20-audit-2.md @@ -12,13 +12,23 @@ Plugin rbd 0.17.0 (bench sheets count as tests). Agents: `audit-traceability`, ` | # | Finding | Status | |---|---------|--------| -| 1 | PLAT-DEBUG-001 has a test commit but no implementation commit (code committed under the deprecated TECH-SERIAL-001) | open | -| 2 | Two old `arch()` commits cite IDs removed since (CONF-DECODE-001, PLAT-DECODE-001) | open | -| 3 | TECH-SENSOR-001 (draft) only names the code behind FUNC-SENSOR-002 and ends with plan text | open | -| 4 | TECH-SERIAL-002 (draft): the `name value unit` line is not pinned down; its title names `SoftSerial` | open | -| 5 | PLAT-POWER-001 and 003: their Verification line mentions the bench sheet | open | -| 6 | FUNC-X10-005 and PLAT-POWER-004 both state the X10 LED framing; PLAT-POWER-004 derives from FUNC-X10-005 only | open | -| 7 | Back-references in text make parent and child depend on each other (TECH-MAIN-001 / FUNC-MAIN-001, TECH-HAL-006; UI-DECODE-001 / FUNC-DECODE-007, UI-DECODE-003; PLAT-DECODE-005 / CONF-DECODE-004) | open | +| 1 | PLAT-DEBUG-001 has a test commit but no implementation commit (code committed under the deprecated TECH-SERIAL-001) | excluded | +| 2 | Two old `arch()` commits cite IDs removed since (CONF-DECODE-001, PLAT-DECODE-001) | excluded | +| 3 | TECH-SENSOR-001 (draft) only names the code behind FUNC-SENSOR-002 and ends with plan text | fixed | +| 4 | TECH-SERIAL-002 (draft): the `name value unit` line is not pinned down; its title names `SoftSerial` | fixed | +| 5 | PLAT-POWER-001 and 003: their Verification line mentions the bench sheet | fixed | +| 6 | FUNC-X10-005 and PLAT-POWER-004 both state the X10 LED framing; PLAT-POWER-004 derives from FUNC-X10-005 only | fixed | +| 7 | Back-references in text make parent and child depend on each other (TECH-MAIN-001 / FUNC-MAIN-001, TECH-HAL-006; UI-DECODE-001 / FUNC-DECODE-007, UI-DECODE-003; PLAT-DECODE-005 / CONF-DECODE-004) | excluded | + +## Resolution (2026-11-20) + +- 1: excluded, HIST-COMMIT-MISMATCH-001 extended with PLAT-DEBUG-001 (reported to the rbd plugin: T3 should follow `**Superseded by:**`). +- 2: excluded, HIST-ARCH-REMOVED-ID-001. +- 3, 4: TECH-SENSOR-001 reduced to its constraint and reason; TECH-SERIAL-002 lists the exact lines `main.cpp` writes. +- 5: PLAT-POWER-001 and 003 Verification lines keep only the inspection. +- 6: the LED sentence leaves FUNC-X10-005; PLAT-POWER-004 also depends on FUNC-SENSOR-003 (not on FUNC-MAIN-001, which already depends on it). +- 7: excluded, TEXT-BACKREF-001. +- Info items fixed with them: the FUNC-X10-005 architecture row (current timings, no deprecated link), the LightSensor edge (5 × 30 ms), "Oregon v2.1" in the luminosity note. ## Findings @@ -26,43 +36,46 @@ Plugin rbd 0.17.0 (bench sheets count as tests). Agents: `audit-traceability`, ` **Type:** Traceability — implementation coverage (T3) **Requirement:** PLAT-DEBUG-001 **Issue:** `test(PLAT-DEBUG-001)` (0298503) exists, but no implementation commit cites PLAT-DEBUG-001: the code is 6817d72 `tech(TECH-SERIAL-001)`, now deprecated with `**Superseded by:** PLAT-DEBUG-001`. 0298503 is not a tag-only backfill (it also edits comments), and neither HIST-COMMIT-MISMATCH-001 nor HIST-BACKFILL-001 lists PLAT-DEBUG-001. PLAT-POWER-008, in the same situation, is not flagged because its only tests are bench sheets. -**Status:** open +**Status:** excluded +**Exclusion ref:** HIST-COMMIT-MISMATCH-001 ### Finding 2 **Type:** Traceability — architecture currency (T5) **Requirements:** CONF-DECODE-001, PLAT-DECODE-001 **Issue:** ee76804 `arch(CONF-DECODE-001)` and b7b07fc `arch(PLAT-DECODE-001)` (2026-11-09) cite IDs that were later removed from the requirement files (aecbdb3, a25dc41). Valid when committed; historical. -**Status:** open +**Status:** excluded +**Exclusion ref:** HIST-ARCH-REMOVED-ID-001 ### Finding 3 **Type:** Coherence — precision (C2) **Requirement:** TECH-SENSOR-001 **Issue:** The draft names the `Ds18b20` class, `emitter/include/Ds18b20.h`, `Begin()` / `Convert()` / `Read()`, `hal->Delay1s()` and the driver calls, and ends with "Not implemented yet: to do when the DS18B20 path is validated again". Keep the constraint and its reason (PA3 released after the read, no AVR register in the cycle); the rest belongs in docs/architecture.md. To do with the DS18B20 rework (#54, #56). -**Status:** open +**Status:** fixed ### Finding 4 **Type:** Coherence — precision (C2) **Requirement:** TECH-SERIAL-002 **Issue:** The line format `name value unit` gives no exact name and unit per value, no order and no number format, so two implementations would differ. The title still names the `SoftSerial` class. -**Status:** open +**Status:** fixed ### Finding 5 **Type:** Coherence — precision (C2) **Requirements:** PLAT-POWER-001, PLAT-POWER-003 **Issue:** "…; current and period measured by the bench sheet" and "…; pin levels measured by the bench sheet" are test information in the Verification line. The sheet carries the tag; the requirement need not mention it. Keep only the inspection ``. -**Status:** open +**Status:** fixed ### Finding 6 **Type:** Coherence — overlap (C1) **Requirements:** FUNC-X10-005, PLAT-POWER-004 **Issue:** FUNC-X10-005 says "the LED is lit from before the first copy until after the last", which PLAT-POWER-004 defines for every transmission. PLAT-POWER-004 derives from and depends on FUNC-X10-005 only, though it also covers FUNC-SENSOR-003 and FUNC-MAIN-001. Keep the LED sentence in PLAT-POWER-004 only. -**Status:** open +**Status:** fixed ### Finding 7 **Type:** Coherence — circular dependency (C4, in substance) **Requirements:** TECH-MAIN-001, FUNC-MAIN-001, TECH-HAL-006; UI-DECODE-001, FUNC-DECODE-007, UI-DECODE-003; PLAT-DECODE-005, CONF-DECODE-004 **Issue:** The declared Dependencies graph has no cycle, but in each group the parent's text cites a child that lists the parent as a dependency (e.g. TECH-MAIN-001 cites FUNC-MAIN-001 and TECH-HAL-006, which both depend on TECH-MAIN-001). Either move the cited behaviour out of the parent, or accept these as back-references. -**Status:** open +**Status:** excluded +**Exclusion ref:** TEXT-BACKREF-001 ## Info (no action required) diff --git a/audits/exclusions.yml b/audits/exclusions.yml index 746bf29..e576a1f 100644 --- a/audits/exclusions.yml +++ b/audits/exclusions.yml @@ -4,8 +4,8 @@ exclusions: justification: "The code predates the RBD workflow; the test commits tagged existing tests (FUNC-ANALOG-001 to PLAT-POWER-004 added on 2026-11-17 by 7f4c027, 6fdc43a, 4919547). Adding implementation commits would mean rewriting master history." date: 2026-11-17 - id: HIST-COMMIT-MISMATCH-001 - finding: "Commit history mismatches for CONF-BUILD-002, CONF-BUILD-003, CONF-BUILD-013, FUNC-DECODE-003, FUNC-DECODE-005, TECH-SERIAL-001, CONF-BUILD-012, FUNC-SENSOR-003, PLAT-POWER-001, PLAT-POWER-003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, CONF-BUILD-011" - justification: "Merged history (chore: CI wiring, tests or code bundled in a neighbour commit). TECH-SERIAL-001 (6817d72 added its tests inside the tech commit), CONF-BUILD-012 (code in 0d775cc feat(FUNC-BATTERY-002), tag in d64fb61) and FUNC-SENSOR-003 (tags in a5987fb, tech: without ID) added on 2026-11-17 (audit 3, finding 10). It cannot change without rewriting master; the current tags and code are traced. Added on 2026-11-20 (audit 2026-11-20, finding 6): build/inspection requirements whose code predates RBD (TECH-HAL-001, CONF-BUILD-007, CONF-BUILD-011), was committed with fix(PLAT-POWER-003) (22eacc3), or under neighbour IDs (PLAT-POWER-001 under TECH-HAL-007, TECH-DECODE-003 under the FUNC-DECODE commits)." + finding: "Commit history mismatches for CONF-BUILD-002, CONF-BUILD-003, CONF-BUILD-013, FUNC-DECODE-003, FUNC-DECODE-005, TECH-SERIAL-001, CONF-BUILD-012, FUNC-SENSOR-003, PLAT-POWER-001, PLAT-POWER-003, TECH-HAL-001, TECH-DECODE-003, CONF-BUILD-007, CONF-BUILD-011, PLAT-DEBUG-001" + justification: "Merged history (chore: CI wiring, tests or code bundled in a neighbour commit). TECH-SERIAL-001 (6817d72 added its tests inside the tech commit), CONF-BUILD-012 (code in 0d775cc feat(FUNC-BATTERY-002), tag in d64fb61) and FUNC-SENSOR-003 (tags in a5987fb, tech: without ID) added on 2026-11-17 (audit 3, finding 10). It cannot change without rewriting master; the current tags and code are traced. Added on 2026-11-20 (audit 2026-11-20, finding 6): build/inspection requirements whose code predates RBD (TECH-HAL-001, CONF-BUILD-007, CONF-BUILD-011), was committed with fix(PLAT-POWER-003) (22eacc3), or under neighbour IDs (PLAT-POWER-001 under TECH-HAL-007, TECH-DECODE-003 under the FUNC-DECODE commits). PLAT-DEBUG-001 added on 2026-11-20 (audit 2026-11-20 (2), finding 1): its code is 6817d72 tech(TECH-SERIAL-001), deprecated with **Superseded by:** PLAT-DEBUG-001; T3 does not follow Superseded by yet." date: 2026-11-17 - id: HIST-PREFIX-001 finding: "Plan and architecture files changed by commits with the wrong prefix (.rbd/config.yml, requirements/technical.md, requirements/platform.md, docs/architecture.md)" @@ -27,3 +27,11 @@ exclusions: finding: "4 tests in emitter/test/test_ds18b20/ds18b20Test.cpp are tagged with the draft TECH-SENSOR-001" justification: "TECH-SENSOR-001 went back to draft pending the DS18B20 rework (PA3 release, 0 °C reading, FUNC-SENSOR-002). The tests still check the current driver wrapper; the tag stays so they are re-traced when the requirement is validated again." date: 2026-11-17 + - id: HIST-ARCH-REMOVED-ID-001 + finding: "ee76804 arch(CONF-DECODE-001) and b7b07fc arch(PLAT-DECODE-001) cite IDs later removed from the requirement files (aecbdb3, a25dc41)" + justification: "The IDs were valid when committed (2026-11-09) and the tinyDecoders requirements were renumbered afterwards. Rewriting master is not worth it." + date: 2026-11-20 + - id: TEXT-BACKREF-001 + finding: "A parent requirement cites in its text a child that lists it as a dependency (TECH-MAIN-001 / FUNC-MAIN-001, TECH-HAL-006; UI-DECODE-001 / FUNC-DECODE-007, UI-DECODE-003; PLAT-DECODE-005 / CONF-DECODE-004)" + justification: "These citations give context (where the behaviour is specified), not a dependency: each parent is fully specified without the child, and the declared Dependencies graph has no cycle." + date: 2026-11-20