From 6132405000b2292cf60ab7bb8ccaf22dafa3efb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Labrosse?= Date: Fri, 20 Nov 2026 16:36:55 +0100 Subject: [PATCH] style: blank line between requirement fields, so each field renders on its own line Co-Authored-By: Claude Opus 5.5 --- requirements/configuration.md | 62 ++++++++++++++ requirements/functional.md | 148 ++++++++++++++++++++++++++++++++++ requirements/platform.md | 54 +++++++++++++ requirements/technical.md | 81 +++++++++++++++++++ requirements/ui.md | 9 +++ 5 files changed, 354 insertions(+) diff --git a/requirements/configuration.md b/requirements/configuration.md index b384128..5f6270e 100644 --- a/requirements/configuration.md +++ b/requirements/configuration.md @@ -6,116 +6,178 @@ ### CONF-BUILD-001 **Title:** Select at most one environment protocol per build + **Status:** validated + **Dependencies:** — + **Description:** A build selects at most one environment protocol, `USE_OREGON` or `USE_LACROSSE`; selecting both fails at compile time. With neither, the sensor sends no environment frame; the X10 meters and the luminosity are still sent. ### CONF-BUILD-002 **Title:** Select temperature and luminosity sensors via build flags + **Status:** validated + **Dependencies:** [FUNC-SENSOR-001](functional.md#func-sensor-001), [FUNC-SENSOR-003](functional.md#func-sensor-003) + **Description:** `USE_BMP280` or `USE_BME280` selects a BMx280 sensor for the temperature; `USE_BME280` adds humidity and pressure and wins when both are set. `USE_DS18B20` selects the DS18B20; combined with a BMx280, the DS18B20 gives the temperature and the BMx280 the humidity and pressure. With no temperature sensor, no environment frame is sent. `USE_BH1750` adds luminosity reporting, whatever the temperature sensor and the environment protocol. `USE_BMP280`, `USE_BME280` or `USE_BH1750` turns on the I2C bus (`USE_I2C`) when the build does not set it. ### CONF-BUILD-003 **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 **Title:** Set Lacrosse device address per environment + **Status:** validated + **Dependencies:** [CONF-BUILD-001](#conf-build-001), [FUNC-SENSOR-003](functional.md#func-sensor-003) + **Description:** A build with `USE_LACROSSE` or `USE_BH1750` sets `LACROSSE_ID` to a Lacrosse address, whatever the environment protocol. Without it, the build fails at compile time with an error naming [CONF-BUILD-004](#conf-build-004). ### CONF-BUILD-005 **Title:** Supply individually calibrated internal 1.1 V reference per board + **Status:** validated + **Dependencies:** [FUNC-BATTERY-001](functional.md#func-battery-001) + **Description:** Each physical board's environment sets `INTERNAL_1v1` to the measured voltage, in mV, of that chip's internal 1.1 V reference, which varies from chip to chip. The VCC measurement uses it ([FUNC-BATTERY-001](functional.md#func-battery-001)). ### CONF-BUILD-006 **Title:** Configure hibernate duration via SLEEP_TIME_IN_SECONDS + **Status:** validated + **Dependencies:** — + **Description:** `SLEEP_TIME_IN_SECONDS` sets how long, in seconds, the sensor sleeps between two cycles. The default is 32 s. ### CONF-BUILD-007 **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 **Title:** Assign a unique X10 meter address for battery voltage reporting + **Status:** validated + **Dependencies:** [FUNC-X10-006](functional.md#func-x10-006) + **Description:** `BATTERY_VOLTAGE_X10_ID` sets the X10 meter address of the battery voltage ([FUNC-X10-006](functional.md#func-x10-006)). It is set on every board and is unique among the boards heard by the same receiver. ### CONF-BUILD-009 **Title:** Optionally assign an X10 meter address for auxiliary analog reporting + **Status:** validated + **Dependencies:** [FUNC-X10-007](functional.md#func-x10-007), [FUNC-ANALOG-001](functional.md#func-analog-001) + **Description:** `ANALOG1_X10_ID`, when set, turns on the auxiliary analog measurement on PA0 and sets its X10 meter address ([FUNC-ANALOG-001](functional.md#func-analog-001), [FUNC-X10-007](functional.md#func-x10-007)). Without it, nothing is measured or sent for that input. The address is unique among the boards heard by the same receiver. ### CONF-BUILD-010 **Title:** Signal direct VCC battery measurement via BATTERY_IS_VCC + **Status:** validated + **Dependencies:** [FUNC-BATTERY-002](functional.md#func-battery-002) + **Description:** `BATTERY_IS_VCC` marks a board with no divider on PA1, where the battery powers the chip: it selects the VCC case of [FUNC-BATTERY-002](functional.md#func-battery-002). ### CONF-BUILD-011 **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 **Title:** BATTERY_DIVIDER sets the battery divider ratio on PA1 + **Status:** validated + **Dependencies:** [FUNC-BATTERY-002](functional.md#func-battery-002) + **Description:** `BATTERY_DIVIDER` sets the divider ratio of [FUNC-BATTERY-002](functional.md#func-battery-002) on boards with a resistor divider on PA1: 2 for the 1 MΩ / 1 MΩ divider of the v2.2 rework and of v3.0, which closes BACKLOG F1. ### CONF-BUILD-013 **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. ### 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) + **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 02ec90b..112757c 100644 --- a/requirements/functional.md +++ b/requirements/functional.md @@ -6,297 +6,445 @@ ### FUNC-OREGON-001 **Title:** Oregon zero bit is radio high 512 µs, low 1024 µs, high 512 µs + **Status:** validated + **Dependencies:** — + **Description:** The Oregon encoder sends a zero bit as the radio output high for 512 µs, low for 1024 µs, then high for 512 µs. A zero bit has no other form on air. ### FUNC-OREGON-002 **Title:** Oregon one bit is radio low 512 µs, high 1024 µs, low 512 µs + **Status:** validated + **Dependencies:** — + **Description:** The Oregon encoder sends a one bit as the radio output low for 512 µs, high for 1024 µs, then low for 512 µs. A one bit has no other form on air. ### FUNC-OREGON-003 **Title:** Oregon bytes go out low nibble first + **Status:** validated + **Dependencies:** [FUNC-OREGON-001](#func-oregon-001), [FUNC-OREGON-002](#func-oregon-002) + **Description:** Every byte of an Oregon frame (preamble, payload and postamble) goes out low nibble (bits 0–3) first, then high nibble (bits 4–7), each bit as in [FUNC-OREGON-001](#func-oregon-001) and [FUNC-OREGON-002](#func-oregon-002). ### FUNC-OREGON-004 **Title:** Oregon frame is 24 one bits, the 11-byte payload, then 8 zero bits + **Status:** validated + **Dependencies:** [FUNC-OREGON-001](#func-oregon-001), [FUNC-OREGON-002](#func-oregon-002) + **Description:** Every Oregon frame starts with a 24 one-bit preamble (three `0xFF` bytes), then carries the 11-byte payload, and ends with an 8 zero-bit postamble (one `0x00` byte). ### FUNC-OREGON-005 **Title:** Positive temperature rounded to the tenth, clamped to 99.9 °C, sent as tenths, units and tens digits in payload bytes 4–5 + **Status:** validated + **Dependencies:** — + **Description:** A non-negative temperature is rounded to the nearest tenth (halves up), then clamped to 99.9 °C, and sent as three decimal digits: tenths in the high nibble of byte 4, units in the low nibble of byte 5, tens in the high nibble of byte 5 (frame nibbles 9, 10, 11, the sync nibble being nibble 0). Rounding comes before the split, so each digit is 0–9: 21.97 °C sends 22.0, 21.94 °C sends 21.9, 99.96 °C and 120 °C send 99.9. This is the Oregon v2.1 layout read by RFLink (`Plugins/Plugin_048.c`, couin3, lines 733-734). The low nibble of byte 4 holds the flags ([FUNC-OREGON-011](#func-oregon-011)). ### FUNC-OREGON-006 **Title:** Negative temperature sets the sign bit, bit 3 of byte 6, and sends the absolute value + **Status:** validated + **Dependencies:** [FUNC-OREGON-005](#func-oregon-005) + **Description:** A temperature that is negative after rounding to the nearest tenth sets bit 3 of byte 6 (`0x08`, frame nibble 12, RFLink line 734). It sends its absolute value with the [FUNC-OREGON-005](#func-oregon-005) rounding, clamp and layout: −10.25 °C sends −10.3, −120 °C sends −99.9, and −0.04 °C sends 0.0 with the sign bit clear. ### FUNC-OREGON-007 **Title:** Humidity rounded to whole %, clamped to 0–99 %, units in the high nibble of byte 6, tens in the low nibble of byte 7 + **Status:** validated + **Dependencies:** — + **Description:** The humidity is rounded to the nearest whole percent (halves up), then clamped to 0–99 %, and sent as two decimal digits: units in the high nibble of byte 6, tens in the low nibble of byte 7 (frame nibbles 13 and 14, RFLink line 737). 67.4 % sends 67, 67.5 % sends 68, 99.6 % and 100 % send 99. The high nibble of byte 7 (comfort) stays 0. ### FUNC-OREGON-008 **Title:** Pressure rounded to whole hPa, sent as hPa − 795 in byte 8; weather forecast in byte 9 + **Status:** validated + **Dependencies:** — + **Description:** Byte 8 (frame nibbles 16–17) holds the pressure rounded to the nearest whole hPa (halves up), minus 795, clamped to 0–255 (795–1050 hPa): 1013.4 hPa sends 218, 1013.5 hPa sends 219. Offset source: the user's RFLink gateway shows an early tinySensor (old firmware, this same layout) as Home Assistant `sensor.oregonbth_5a23` at 975 hPa while the receiver captured byte 8 = `0xB4` (180 + 795) in the same frame (2026-11-11); this restores that firmware's layout. Byte 9 holds a forecast code chosen from the rounded pressure: 0x30 (rain, < 1000 hPa), 0x20 (cloudy, < 1010), 0x60 (partly cloudy, < 1025) or 0xC0 (sunny, ≥ 1025). ### FUNC-OREGON-009 **Title:** Channel 1–3 sent as a one-bit mask in the high nibble of byte 2; another value is ignored + **Status:** validated + **Dependencies:** — + **Description:** Channel 1, 2 or 3 sets the high nibble of byte 2 to 0x1, 0x2 or 0x4 (byte 2 = 0x10, 0x20 or 0x40). Any other channel value is ignored: byte 2 keeps its previous value. ### FUNC-OREGON-010 **Title:** Rolling code sent as byte 3 + **Status:** validated + **Dependencies:** — + **Description:** The rolling code, any value 0x00–0xFF, is byte 3 (frame nibbles 6–7, RFLink `osdata[3]`, line 711). The low nibble of byte 2 (last device ID nibble) stays 0. ### FUNC-OREGON-011 **Title:** Battery-low flag is bit 2 of byte 4 + **Status:** validated + **Dependencies:** — + **Description:** A low battery sets bit 2 of byte 4 (flags nibble 8, RFLink line 714); a good battery clears it. The other bits of byte 4 are unchanged. ### FUNC-OREGON-012 **Title:** Emulated Oregon device and checksum follow the measurements the frame carries + **Status:** validated + **Dependencies:** [FUNC-OREGON-001](#func-oregon-001), [FUNC-OREGON-002](#func-oregon-002) + **Description:** Payload bytes 0–1 are the device ID, the low nibble of byte 0 being the sync nibble 0xA. Temperature only gives `0xEA 0x4C` (THN132N); temperature and humidity give `0x1A 0x2D` (THGR228N); temperature, humidity and pressure give `0x5A 0x5D` (BTHR918) (RFLink lines 650, 696, 730). The checksum is (sum of all preceding nibbles − 0xA) & 0xFF, low nibble first: nibbles 13–14 (high nibble of byte 6, low nibble of byte 7) for THN132N, byte 8 for THGR228N, byte 10 for BTHR918 (RFLink lines 465, 654, 698). ### FUNC-OREGON-013 **Title:** An Oregon frame carries every measurement loaded since the encoder was created + **Status:** validated + **Dependencies:** [FUNC-OREGON-001](#func-oregon-001), [FUNC-OREGON-002](#func-oregon-002) + **Description:** The encoder starts with no measurement. Loading a temperature, a humidity or a pressure adds it to the measurements the encoder reports and sends; nothing removes one. This set chooses the device ID ([FUNC-OREGON-012](#func-oregon-012)). ### FUNC-OREGON-014 **Title:** Full payload matches the Oregon v2.1 reference payloads decoded by RFLink + **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-005](#func-oregon-005), [FUNC-OREGON-006](#func-oregon-006), [FUNC-OREGON-007](#func-oregon-007), [FUNC-OREGON-008](#func-oregon-008), [FUNC-OREGON-009](#func-oregon-009), [FUNC-OREGON-010](#func-oregon-010), [FUNC-OREGON-011](#func-oregon-011), [FUNC-OREGON-012](#func-oregon-012), [FUNC-OREGON-013](#func-oregon-013) + **Description:** The 11-byte payload is: THN132N channel 1, rolling code 0x3C, battery low, −10.2 °C gives `EA4C103C2410D803000000`; THGR228N channel 3, rolling code 0xC4, 21.5 °C, 67 % gives `1A2D40C450217006390000`; BTHR918 channel 3, rolling code 0x7E, battery low, 21.5 °C, 60 %, 1013 hPa gives `5A5D407E54210006DA605F`. Read with the RFLink `Plugins/Plugin_048.c` (couin3) field formulas and the 795 hPa offset ([FUNC-OREGON-008](#func-oregon-008)), these payloads give back their inputs. ### FUNC-OREGON-015 **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)). 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 + **Status:** validated + **Dependencies:** — + **Description:** Every Lacrosse frame starts with exactly 10 zero bits, with nothing before them, followed by a single one bit before the first nibble. ### FUNC-LACROSSE-002 **Title:** Type nibble follows the measurements the frame carries; an unknown combination sends 0xF + **Status:** validated + **Dependencies:** — + **Description:** The first nibble is the sensor type: temperature only gives 0x0, temperature and humidity 0x1, temperature, humidity and pressure 0x4, luminosity only 0x5. Any other combination gives 0xF. ### FUNC-LACROSSE-003 **Title:** Address 0–7 in bits 0–2 of the second nibble; negative temperature sign in bit 3 + **Status:** validated + **Dependencies:** — + **Description:** The second nibble holds the 3-bit sensor address in bits 0–2. Bit 3 is 1 when the frame carries a negative temperature, else 0. ### FUNC-LACROSSE-004 **Title:** Temperature rounded to the tenth, clamped to ±99.9 °C, sent as tenths, units and tens nibbles + **Status:** validated + **Dependencies:** — + **Description:** The temperature is rounded to the nearest tenth (halves away from zero) and clamped to [−99.9, +99.9] °C. Its absolute value is sent as three digit nibbles, each 0–9, in order: tenths, units, tens. 21.97 °C sends 22.0, 21.94 °C sends 21.9, −10.25 °C sends −10.3. The sign is that of the rounded value, sent per [FUNC-LACROSSE-003](#func-lacrosse-003): −0.04 °C sends 0.0 without sign. ### FUNC-LACROSSE-005 **Title:** Humidity rounded to the tenth, clamped to 99.9 %, sent as tenths, units and tens nibbles + **Status:** validated + **Dependencies:** — + **Description:** The humidity is rounded to the nearest tenth (halves up); a result of 100 % or more is sent as 99.9 %. The value is sent as three digit nibbles, each 0–9, in order: tenths, units, tens. 42.47 % sends 42.5, 99.96 % sends 99.9. ### FUNC-LACROSSE-006 **Title:** Pressure rounded to the tenth, clamped to 850–1100 hPa, minus 200, sent as units, tens, hundreds and tenths nibbles + **Status:** validated + **Dependencies:** — + **Description:** The pressure is rounded to the nearest tenth of hPa (halves up), clamped to [850, 1100] hPa, then 200 is subtracted. The result is sent as four digit nibbles, each 0–9, in order: units, tens, hundreds, tenths. 1013.37 hPa sends 813.4 as 3, 1, 8, 4. ### FUNC-LACROSSE-007 **Title:** Luminosity sent as a 3-digit mantissa and a power-of-ten exponent in a type 5 frame + **Status:** validated + **Dependencies:** — + **Description:** A luminosity frame (type 0x5, [FUNC-LACROSSE-002](#func-lacrosse-002)) carries 7 data nibbles in the Lacrosse WS2500-19 layout read by rtl_433 (`src/devices/lacrosse_ws7000.c`, type 5): the units, tens and hundreds digits of a mantissa, an exponent nibble, then three zero nibbles (exposure time, not measured). Lux = mantissa × 10^exponent. The exponent is the smallest one for which the lux value divided by 10^exponent, rounded to the nearest integer (halves up), is at most 999; that rounded value is the mantissa. Mantissa, exponent: 999 lx gives 999, 0; 1000 lx gives 100, 1; 1234 lx gives 123, 1; 1235 lx gives 124, 1; 9995 lx gives 100, 2; 65535 lx gives 655, 2. ### FUNC-LACROSSE-008 **Title:** Frame ends with an XOR check nibble then a sum check nibble starting at 5 + **Status:** validated + **Dependencies:** [FUNC-LACROSSE-001](#func-lacrosse-001), [FUNC-LACROSSE-002](#func-lacrosse-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:** After the data nibbles come two check nibbles. The first is the XOR of every nibble sent before it, on 4 bits. The second is 5 plus every nibble sent before it, the XOR nibble included, on 4 bits. ### FUNC-LACROSSE-009 **Title:** Lacrosse bits are 400/800 µs pulses, nibbles least significant bit first, each followed by a one bit separator + **Status:** validated + **Dependencies:** — + **Description:** A one bit is radio high 400 µs then low 800 µs; a zero bit is high 800 µs then low 400 µs. Every nibble of the frame (type, address, data and check nibbles) is sent as its four bits, least significant first, followed by a one bit. ### FUNC-X10-001 **Title:** RFXmeter frame: address, address check, 24-bit value, packet type and nibble-sum parity + **Status:** validated + **Dependencies:** — + **Description:** An RFXmeter frame is 6 bytes: byte 0 is the address; byte 1 is the address with its high nibble inverted; bytes 2–4 carry the 24-bit value: byte 4 its high byte, byte 2 its middle byte, byte 3 its low byte (the value is 0 when it does not fit in 24 bits); the high nibble of byte 5 is the packet type; the low nibble of byte 5 is the inverted sum of all the nibbles before it. It is sent per [FUNC-X10-005](#func-x10-005). ### FUNC-X10-002 **Title:** RFXsensor frame: address and type, check, value, status and nibble-sum parity + **Status:** validated + **Dependencies:** — + **Description:** An RFXsensor frame is 4 bytes: byte 0 is the address shifted left by 2 with the sensor type in bits 0–1 (temperature 0, voltage 2, A/D 1, message 3); byte 1 is byte 0 with its high nibble inverted; byte 2 is the value; the high nibble of byte 3 is the packet-type status; the low nibble of byte 3 is the inverted sum of all the nibbles before it. It is sent per [FUNC-X10-005](#func-x10-005). ### FUNC-X10-003 **Title:** X10 switch frame: house code, scattered unit code and byte complements + **Status:** deprecated + **Dependencies:** — + **Description:** An X10 switch frame is 4 bytes. House code `a`–`p` (either case) puts in the high nibble of byte 0 the X10 code 6, 7, 4, 5, 8, 9, 10, 11, 14, 15, 12, 13, 0, 1, 2, 3 respectively; another character gives 0. With `u` = unit − 1, bit 3 of `u` goes to bit 2 of byte 0, and bits 2, 1, 0 of `u` go to bits 6, 3, 4 of byte 2. The command (on, off, bright, dim) is the rest of byte 2. Byte 1 is the complement of byte 0 and byte 3 the complement of byte 2. It is sent per [FUNC-X10-005](#func-x10-005). ### FUNC-X10-004 **Title:** X10 security frame with a single parity bit + **Status:** validated + **Dependencies:** — + **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 + **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. ### FUNC-X10-006 **Title:** Battery voltage in mV is sent as BCD in an RFXmeter frame while the battery is not low + **Status:** validated + **Dependencies:** [FUNC-X10-001](#func-x10-001), [FUNC-BATTERY-001](#func-battery-001), [FUNC-BATTERY-002](#func-battery-002) + **Description:** When the build sets a battery meter address ([CONF-BUILD-008](configuration.md#conf-build-008)) and the battery is not low, every cycle sends the battery voltage in mV, one decimal digit per nibble (3960 mV gives 0x3960), in an RFXmeter frame with that address and packet type 0. Nothing is sent while the battery is low. ### FUNC-X10-007 **Title:** Auxiliary analog voltage in mV is sent as BCD in an RFXmeter frame while the battery is not low + **Status:** validated + **Dependencies:** [FUNC-X10-001](#func-x10-001), [FUNC-ANALOG-001](#func-analog-001) + **Description:** When the build sets an analog meter address ([CONF-BUILD-009](configuration.md#conf-build-009)) and the battery is not low, every cycle sends the auxiliary analog voltage in mV ([FUNC-ANALOG-001](#func-analog-001)), one decimal digit per nibble, in an RFXmeter frame with that address and packet type 0. Nothing is sent while the battery is low. ### FUNC-BATTERY-001 **Title:** VCC measured against the internal 1.1 V reference; pin voltages scaled from VCC + **Status:** validated + **Dependencies:** — + **Description:** VCC in mV is the board's calibrated 1.1 V reference value (mV, [CONF-BUILD-005](configuration.md#conf-build-005)) × (1024 / the ADC reading of the internal 1.1 V reference), truncated to an integer. A pin voltage in mV is VCC / 1024 × its 10-bit ADC reading, truncated to an integer; [FUNC-BATTERY-002](#func-battery-002) and [FUNC-ANALOG-001](#func-analog-001) use it. ### FUNC-BATTERY-002 **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. 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 + **Status:** validated + **Dependencies:** [FUNC-BATTERY-002](#func-battery-002), [FUNC-OREGON-011](#func-oregon-011), [FUNC-X10-006](#func-x10-006), [FUNC-X10-007](#func-x10-007), [FUNC-SENSOR-003](#func-sensor-003) + **Description:** The battery is low when its voltage is below the build's threshold ([CONF-BUILD-007](configuration.md#conf-build-007)). Then the battery and analog X10 meter frames and the luminosity frames ([FUNC-SENSOR-003](#func-sensor-003)) are not sent, and Oregon frames carry the battery-low flag ([FUNC-OREGON-011](#func-oregon-011)). The environment frame is still sent; a Lacrosse frame has no battery-low flag, so it is unchanged. ### FUNC-SENSOR-001 **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. ### FUNC-SENSOR-002 **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 **Title:** BH1750 luminosity sent twice as a Lacrosse luminosity frame + **Status:** validated + **Dependencies:** [FUNC-LACROSSE-007](#func-lacrosse-007) + **Description:** On a build with a BH1750 and while the battery is not low, each cycle starts a one-time high-resolution measurement on the sensor at I2C address 0x23, waits 150 ms, reads the lux value and sends it twice in a Lacrosse luminosity frame ([FUNC-LACROSSE-007](#func-lacrosse-007)), for better reception. ### FUNC-ANALOG-001 **Title:** Auxiliary analog input on PA0 measured in millivolts + **Status:** validated + **Dependencies:** [FUNC-BATTERY-001](#func-battery-001) + **Description:** When the build sets an analog meter address ([CONF-BUILD-009](configuration.md#conf-build-009)) and the battery is not low, each cycle reads PA0 with the ADC and converts the reading to mV with the [FUNC-BATTERY-001](#func-battery-001) pin voltage formula. ### FUNC-MAIN-001 **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. --- ### 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-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-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. 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-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. 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; 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. 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`. 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. 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. 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. diff --git a/requirements/platform.md b/requirements/platform.md index 50934cb..994b11b 100644 --- a/requirements/platform.md +++ b/requirements/platform.md @@ -6,117 +6,171 @@ ### PLAT-POWER-001 **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:** [TECH-MAIN-001](technical.md#tech-main-001) + **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. --- ### PLAT-POWER-002 **Title:** Sensor power rail PA2 high from before the first read until after the last transmission + **Status:** validated + **Dependencies:** [FUNC-SENSOR-001](functional.md#func-sensor-001) + **derives_from:** [FUNC-SENSOR-001](functional.md#func-sensor-001) + **Description:** Each cycle drives PA2 (`SENSOR_VCC`) high before any sensor read and low right after the last transmission, before hibernating. No sensor read or transmission happens outside this window. --- ### 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), [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` + **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:** [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. --- ### PLAT-POWER-005 **Title:** Target MCU is the ATtiny84A at 1 MHz; all radio and delay timings are calibrated for that clock + **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. --- ### 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), [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. --- ### PLAT-POWER-007 **Title:** Every sensor board pulls its sensor buses (SCL on PA4, SDA on PA6, 1-Wire on PA3) up with external resistors to the switched sensor rail SENSOR_VCC (PA2) + **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 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). --- ### 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:** [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. --- ### 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:** [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 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 ± 2 % 8N1, line idle high + **Status:** validated + **Dependencies:** [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)). --- ### 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 + **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. --- ### PLAT-DECODE-004 **Title:** Receiver drives the SSD1306 128x32 OLED at I2C 0x3C over hardware TWI at 400 kHz, one character cell at a time, without framebuffer + **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. --- ### PLAT-DECODE-005 **Title:** Receiver writes RFLink lines on the serial port (debug UART TX D1 on the Pro Mini, USB CDC on the Pro Micro) without blocking the pulse capture + **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. \ No newline at end of file diff --git a/requirements/technical.md b/requirements/technical.md index 4dc1f7a..60dea17 100644 --- a/requirements/technical.md +++ b/requirements/technical.md @@ -6,186 +6,267 @@ ### TECH-HAL-001 **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*`. --- ### TECH-HAL-002 **Title:** TestHal_ records each HAL call as a single-character token in the Orders vector + **Status:** deprecated + **Dependencies:** [TECH-HAL-001](#tech-hal-001) + **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:** 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). --- ### 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:** 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). --- ### TECH-HAL-005 **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). --- ### TECH-HAL-006 **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:** 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:** 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:** 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:** deprecated + **Dependencies:** — + **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:** deprecated + **Dependencies:** [TECH-FILTER-001](#tech-filter-001) + **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:** 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). --- ### TECH-CONVERT-002 **Title:** dec32ToHex returns the 32-bit BCD hex representation of a uint32_t with each decimal digit in one nibble + **Status:** deprecated + **Dependencies:** — + **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:** 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). --- ### TECH-SERIAL-002 **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 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. --- ### TECH-X10-001 **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). --- ### TECH-X10-002 **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. --- ### TECH-SENSOR-001 **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:** 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. --- ### TECH-SENSOR-002 **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. --- ### TECH-MAIN-001 **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:** 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:** deprecated + **Dependencies:** [TECH-HAL-002](#tech-hal-002), [TECH-X10-001](#tech-x10-001) + **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 reached only through a compile-time `ReceiverHal` interface given by pointer, with a native test double + **Status:** validated + **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 **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 **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. diff --git a/requirements/ui.md b/requirements/ui.md index e5b9aa0..ef644f2 100644 --- a/requirements/ui.md +++ b/requirements/ui.md @@ -6,18 +6,27 @@ ### 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`. 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. 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. \ No newline at end of file