From 82254b2c0e7215589ef0d91b6a95cfa1e2bcc396 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sat, 28 Nov 2026 22:24:50 +0100 Subject: [PATCH 1/8] req(CONF-BUILD-016): TEMPERATURE_OFFSET corrects the measured temperature per board Co-Authored-By: Claude Opus 5.5 --- requirements/configuration.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/requirements/configuration.md b/requirements/configuration.md index 5f6270e..128db0d 100644 --- a/requirements/configuration.md +++ b/requirements/configuration.md @@ -149,6 +149,17 @@ **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-BUILD-016 +**Title:** TEMPERATURE_OFFSET corrects the measured temperature per board + +**Status:** validated + +**Dependencies:** [CONF-BUILD-002](#conf-build-002), [FUNC-SENSOR-001](functional.md#func-sensor-001), [FUNC-SENSOR-002](functional.md#func-sensor-002), [FUNC-OREGON-005](functional.md#func-oregon-005), [FUNC-LACROSSE-004](functional.md#func-lacrosse-004) + +**Description:** `TEMPERATURE_OFFSET` is a per-board correction in °C, decimal and possibly negative, added to the measured temperature before the environment frame rounds and clamps it. Like `INTERNAL_1v1`, it calibrates a sensor whose error is constant from one reading to the next. It applies to whichever sensor gives the temperature ([CONF-BUILD-002](#conf-build-002)), with Oregon and Lacrosse alike. When it is not set, it is 0. A failed temperature read stays unsent: the offset never creates a temperature. Humidity, pressure, luminosity and the X10 meters are not corrected. + +**Examples:** with `TEMPERATURE_OFFSET=1.3`, a BME280 reading of 20.96 °C sends 22.3 °C; a DS18B20 reading of 21 °C sends 22.3 °C; −1.0 °C sends 0.3 °C; 99.0 °C sends 99.9 °C; a failed DS18B20 read sends no environment frame. With `TEMPERATURE_OFFSET=-0.5`, 21.0 °C sends 20.5 °C. + ### CONF-DECODE-002 **Title:** CI and pre-commit cover tinyDecoders: lint, native tests and the promini and promicro builds From 3f400f99be1ca6d9855b008761287806874c25fd Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sat, 28 Nov 2026 22:24:51 +0100 Subject: [PATCH 2/8] req(CONF-BUILD-014): mushroom sets TEMPERATURE_OFFSET=1.3 Co-Authored-By: Claude Opus 5.5 --- requirements/configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/configuration.md b/requirements/configuration.md index 128db0d..8492c5a 100644 --- a/requirements/configuration.md +++ b/requirements/configuration.md @@ -132,11 +132,11 @@ **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) +**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), [CONF-BUILD-016](#conf-build-016) **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. +**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 temperature is corrected by +1.3 °C (`TEMPERATURE_OFFSET=1.3`): the BME280 read about 1.3 °C below four reference thermometers placed next to it (2026-11-25 to 2026-11-28), which is within its tolerance. 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 From 89458f81aced46c47d2e69fad9c43b3227ccae42 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sat, 28 Nov 2026 22:25:18 +0100 Subject: [PATCH 3/8] arch(CONF-BUILD-016): TEMPERATURE_OFFSET added to a present temperature in ReadEnvironment, mushroom row shows 1.3 Co-Authored-By: Claude Opus 5.5 --- docs/architecture.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 08f9955..d4556af 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,6 +1,6 @@ # Architecture -_Last updated: 2026-11-19 — [CONF-BUILD-015](../requirements/configuration.md#conf-build-015) (emitter CI coverage)_ +_Last updated: 2026-11-28 — [CONF-BUILD-016](../requirements/configuration.md#conf-build-016) (per-board temperature offset)_ Emitter firmware paths (`src/`, `include/`, `test/`, `platformio.ini`) are relative to `emitter/`; `lib/` is at the repository root, shared with `tinyDecoders/`. @@ -75,7 +75,7 @@ Protocol encoders and sensor wrappers that use the HAL receive `Hal*` at constru `src/main.cpp` only orchestrates; protocol and sensor details live in the encoders and wrappers. One cycle is `void runCycle(Hal* hal)` ([TECH-MAIN-001](../requirements/technical.md#tech-main-001), declared in `include/main.h`); `runCycle` starts with `hal->Init()` ([TECH-HAL-006](../requirements/technical.md#tech-hal-006)), `main()` only loops on `runCycle(&hal)`, and is compiled out under `UNIT_TEST` so native test binaries can link `src/`. 1. `hal->PowerOnSensors()`. -2. `ReadEnvironment()` fills a `Measurements` from the fitted sensors (`BMx280`, `Ds18b20`). A field is flagged present only if its sensor is fitted and read correctly (DS18B20: `0` means read error). +2. `ReadEnvironment()` fills a `Measurements` from the fitted sensors (`BMx280`, `Ds18b20`). A field is flagged present only if its sensor is fitted and read correctly (DS18B20: `0` means read error). A present temperature then gets `TEMPERATURE_OFFSET` added (default 0, [CONF-BUILD-016](../requirements/configuration.md#conf-build-016)), so both encoders round and clamp the corrected value; an absent one stays absent. 3. Battery and analog X10 meters (`BATTERY_VOLTAGE_X10_ID`, `ANALOG1_X10_ID`), suppressed when the battery is low. VCC is computed once when either is enabled. 4. Luminosity (`USE_BH1750`, battery not low): `LightSensor::Read()`, then a dedicated Lacrosse encoder sends a type-5 frame `LIGHT_FRAME_REPEAT` (2) times. 5. Environment frame (`USE_OREGON` / `USE_LACROSSE`): `ApplyMeasurements()` loads the present fields into the encoder and returns whether to send (only when a temperature is present). Oregon also gets the battery-low flag. The frame is sent twice, with the radio low between the two copies for at least one frame length: 246 ms for Oregon, 98 ms for Lacrosse ([FUNC-MAIN-001](../requirements/functional.md#func-main-001)). @@ -249,7 +249,8 @@ Every physical board is a separate PlatformIO environment with its own `build_fl | [CONF-BUILD-011](../requirements/configuration.md#conf-build-011) | `platformio.ini` | USE_CHARGE_PUMP is an informational flag only; no firmware branch depends on it | | [CONF-BUILD-012](../requirements/configuration.md#conf-build-012) | `main.cpp` / `include/config.h` / `platformio.ini` | BATTERY_DIVIDER (default 1) scales the PA1 reading; ignored with BATTERY_IS_VCC | | [CONF-BUILD-013](../requirements/configuration.md#conf-build-013) | `main.cpp` / `EnvironmentEncoder.h` / `platformio.ini` | OREGON_NO_PRESSURE: ReadEnvironment stores no pressure, OregonV3 sends THGR228N; without USE_OREGON → #error | -| [CONF-BUILD-014](../requirements/configuration.md#conf-build-014) | `platformio.ini` / `docs/environments.md` | `[env:mushroom]` in default_envs: Oregon ch 3 / 0x3C, BME280 without pressure, BATTERY_DIVIDER=2, X10 meter 7, 3000 mV, 300 s | +| [CONF-BUILD-014](../requirements/configuration.md#conf-build-014) | `platformio.ini` / `docs/environments.md` | `[env:mushroom]` in default_envs: Oregon ch 3 / 0x3C, BME280 without pressure, BATTERY_DIVIDER=2, TEMPERATURE_OFFSET=1.3, X10 meter 7, 3000 mV, 300 s | +| [CONF-BUILD-016](../requirements/configuration.md#conf-build-016) | `main.cpp` / `include/config.h` / `platformio.ini` | TEMPERATURE_OFFSET (°C, default 0) added in ReadEnvironment to a present temperature (BMx280 or DS18B20), before ApplyMeasurements; humidity, pressure, luminosity, X10 untouched | | [PLAT-POWER-001](../requirements/platform.md#plat-power-001) | `Attiny84aHal` | Hibernate loops SLEEP_MODE_PWR_DOWN for s / 8 WDT periods, rounded down; minimum 1 period; brownout detection off during each period | | [PLAT-POWER-002](../requirements/platform.md#plat-power-002) | `Attiny84aHal` / `main.cpp` | PA2 (SENSOR_VCC) driven high before first sensor read; driven low after last transmission | | [PLAT-POWER-003](../requirements/platform.md#plat-power-003) | `Attiny84aHal` | PRR bits for USI/Timer0/Timer1/ADC set in sleep(); PA2 and PB0 outputs held low, PA3–PA6 and PA0/PA1 inputs without pull-up, PB3 pulled up, PB2 pulled up unless `USE_SWITCHED_5V`, PA7/PB1 keep their last level; all restored on wake | From e796f421dcfd407822797718c2cee3f19e5f2405 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sat, 28 Nov 2026 22:25:27 +0100 Subject: [PATCH 4/8] docs: TEMPERATURE_OFFSET in the CLAUDE.md build flags table and the mushroom environment entry Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 1 + docs/environments.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0f4fd74..98bfede 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -106,6 +106,7 @@ find emitter/src emitter/include emitter/test lib tinyDecoders -path '*/.pio' -p | `INTERNAL_1v1` | Calibrated 1.1 V internal reference in mV (chip-specific) | | `BATTERY_IS_VCC` | Battery voltage = VCC (no external divider) | | `BATTERY_DIVIDER` | Battery / PA1 voltage ratio of the divider (default 1; 2 on v2.2 rework and v3.0, CONF-BUILD-012) | +| `TEMPERATURE_OFFSET` | Per-board temperature correction in °C added before encoding (default 0, CONF-BUILD-016) | | `OREGON_NO_PRESSURE` | BME280 Oregon board sends THGR228N temperature + humidity, no pressure (requires `USE_OREGON`, CONF-BUILD-013) | | `USE_CHARGE_PUMP` | Board uses a charge pump for sensor power | | `USE_SWITCHED_5V` | PB2 (J8) drives a PNP that powers an off-board 5 V module during measurements (LM35 variant, `hardware/tinysensor/VARIANTE_LM35.md`, PLAT-POWER-006) | diff --git a/docs/environments.md b/docs/environments.md index 7b35226..4e0673d 100644 --- a/docs/environments.md +++ b/docs/environments.md @@ -1,6 +1,6 @@ # PlatformIO environments -Each physical prototype board has `S_XX` written on its PCB. That label is the PlatformIO environment name. Every board gets its own environment because the ATtiny84a's internal 1.1 V reference (`INTERNAL_1v1`) varies chip-to-chip and must be calibrated individually — this is the only reason two otherwise identical boards need separate environments. +Each physical prototype board has `S_XX` written on its PCB. That label is the PlatformIO environment name. Every board gets its own environment because the ATtiny84a's internal 1.1 V reference (`INTERNAL_1v1`) varies chip-to-chip and must be calibrated individually — this is the main reason two otherwise identical boards need separate environments. A board whose temperature sensor reads with a constant error also gets its own `TEMPERATURE_OFFSET` in °C (default 0). ## How to calibrate `INTERNAL_1v1` for a new board @@ -18,7 +18,7 @@ Each physical prototype board has `S_XX` written on its PCB. That label is the P | `S_03` | Lacrosse WS7000, address THREE | BME280 (temp + humidity + pressure) | 2× AA via charge pump | Prototype rev 3 | | `S_04` | Oregon, channel 3, rolling code `0x04` | BME280 (temp + humidity + pressure) | 2× AA | Prototype rev 4 | | `S_05` | none: X10 battery meter only | BME280 (read, not transmitted) | 18650 Li-ion | Prototype rev 5 — older HW design, higher `INTERNAL_1v1=1343` reflects this chip | -| `mushroom` | Oregon, channel 3, rolling code `0x3C` | BME280 (temp + humidity, no pressure: THGR228N frame) | 18650 Li-ion via TP4056, 3.3 V buck-boost, PA1 divider /2 | Cut-down v2.2 in the mushroom enclosure; X10 battery meter 7; `INTERNAL_1v1=1104` calibrated on the battery reading | +| `mushroom` | Oregon, channel 3, rolling code `0x3C` | BME280 (temp + humidity, no pressure: THGR228N frame) | 18650 Li-ion via TP4056, 3.3 V buck-boost, PA1 divider /2 | Cut-down v2.2 in the mushroom enclosure; X10 battery meter 7; `INTERNAL_1v1=1104` calibrated on the battery reading; `TEMPERATURE_OFFSET=1.3` (BME280 read 1.3 °C low against reference thermometers) | ## Special environments From 2c90749921dbe6f66e6805ca2d85c8c290d83ba4 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sat, 28 Nov 2026 22:29:14 +0100 Subject: [PATCH 5/8] test(CONF-BUILD-016): cycle frames carry TEMPERATURE_OFFSET (+1.3 Oregon, -0.5 Lacrosse), no frame on failed DS18B20 read Co-Authored-By: Claude Opus 5.5 --- emitter/platformio.ini | 14 ++++++++++++++ emitter/test/test_main_cycle/mainCycleTest.cpp | 12 +++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/emitter/platformio.ini b/emitter/platformio.ini index 7618378..b43fa94 100644 --- a/emitter/platformio.ini +++ b/emitter/platformio.ini @@ -99,6 +99,7 @@ build_flags = -DUSE_BME280=1 -DOREGON_NO_PRESSURE -DBATTERY_DIVIDER=2 + -DTEMPERATURE_OFFSET=1.3 ; Lacrosse (S_03 family) [env:native_cycle_lacrosse] @@ -108,6 +109,19 @@ build_flags = -DUSE_LACROSSE -DLACROSSE_ID=LacrosseWS7000::Address::THREE -DUSE_BMP280=1 + -DTEMPERATURE_OFFSET=-0.5 + +; Oregon, DS18B20: the native stub reads 0 (read error), so no environment +; frame even with TEMPERATURE_OFFSET (CONF-BUILD-016) +[env:native_cycle_ds18b20] +extends = native_cycle +build_flags = + ${native_cycle.cycle_flags} + -DUSE_OREGON + -DOREGON_RCODE=0x20 + -DOREGON_CHANNEL=1 + -DUSE_DS18B20=1 + -DTEMPERATURE_OFFSET=1.3 ; No environment protocol, X10 meters only (S_05 / devmodule family) [env:native_cycle_x10] diff --git a/emitter/test/test_main_cycle/mainCycleTest.cpp b/emitter/test/test_main_cycle/mainCycleTest.cpp index 33e37c6..9b9f68e 100644 --- a/emitter/test/test_main_cycle/mainCycleTest.cpp +++ b/emitter/test/test_main_cycle/mainCycleTest.cpp @@ -60,6 +60,12 @@ #define LIGHT_FRAMES 2 // luminosity frame is sent twice #endif +// CONF-BUILD-016: production config.h must default TEMPERATURE_OFFSET to 0; +// this fallback only keeps the reference buildable before it does. +#if !defined(TEMPERATURE_OFFSET) +#define TEMPERATURE_OFFSET 0 +#endif + // Recorded by TestHal_::Init() (TECH-HAL-006). static const unsigned char INIT = 'I'; @@ -154,7 +160,8 @@ static std::vector EnvironmentFrameOrders( bool lowBattery = false) { CycleSpyHal ref; Measurements m; - m.SetTemperature(0); // native BMx280 stub values + // native BMx280 stub values; CONF-BUILD-016: offset on the temperature only + m.SetTemperature(0 + TEMPERATURE_OFFSET); #if defined(USE_BME280) m.SetHumidity(0); #if !defined(OREGON_NO_PRESSURE) @@ -320,6 +327,7 @@ void Expect_cycle_on_TestHal_records_orders_on_TestHal() { // @req TECH-MAIN-001 // @req CONF-BUILD-001 (native_cycle_x10: no protocol, no environment frame) // @req CONF-BUILD-002 (no temperature sensor: no environment frame) +// @req CONF-BUILD-016 (native_cycle_ds18b20: failed read + offset, no frame) // @req FUNC-MAIN-001 (environment frame sent twice) void Expect_cycle_sends_one_frame_per_enabled_output_of_the_variant() { // Given @@ -338,6 +346,8 @@ void Expect_cycle_sends_one_frame_per_enabled_output_of_the_variant() { // @req FUNC-BATTERY-002 (battery meter = PA1 voltage x divider ratio) // @req CONF-BUILD-012 (native_cycle_oregon_divider: BATTERY_DIVIDER=2) // @req CONF-BUILD-013 (OREGON_NO_PRESSURE: THGR228N temperature+humidity) +// @req CONF-BUILD-016 (TEMPERATURE_OFFSET: +1.3 Oregon divider, -0.5 +// Lacrosse, 0 elsewhere; humidity not corrected) // @req FUNC-MAIN-001 (environment frame sent twice) // @req FUNC-X10-006 (battery meter: BCD mV at BATTERY_VOLTAGE_X10_ID) // @req FUNC-X10-007 (analog meter: BCD mV at ANALOG1_X10_ID) From 52f61a60125106a564ba603c9ef3145a28004d8a Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sat, 28 Nov 2026 22:31:58 +0100 Subject: [PATCH 6/8] conf(CONF-BUILD-016): TEMPERATURE_OFFSET added to a read temperature, mushroom sets 1.3 Default 0 in config.h; applied to the BMx280 reading and to a successful DS18B20 read only, so a failed read still sends no frame. CI runs native_cycle_ds18b20. Requirements: CONF-BUILD-016, CONF-BUILD-014 Checks: lint (clang-format 18.1.8), build mushroom, full native suite (125 passed) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/main.yml | 2 +- emitter/include/config.h | 5 +++++ emitter/platformio.ini | 1 + emitter/src/main.cpp | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 213b9cd..2cd98ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,7 +42,7 @@ jobs: - name: Install PlatformIO Core run: pip install --upgrade platformio - name: Run native tests - run: pio test -d emitter -e native_debug -e native_cycle_oregon -e native_cycle_oregon_vcc -e native_cycle_oregon_divider -e native_cycle_lacrosse -e native_cycle_x10 + run: pio test -d emitter -e native_debug -e native_cycle_oregon -e native_cycle_oregon_vcc -e native_cycle_oregon_divider -e native_cycle_lacrosse -e native_cycle_x10 -e native_cycle_ds18b20 - name: Run tinyDecoders native tests run: pio test -d tinyDecoders -e native - name: Compile-fail checks diff --git a/emitter/include/config.h b/emitter/include/config.h index 2318160..dfaadbd 100644 --- a/emitter/include/config.h +++ b/emitter/include/config.h @@ -32,6 +32,11 @@ #define BATTERY_DIVIDER 1 #endif +// CONF-BUILD-016: per-board temperature correction in degrees C +#if !defined(TEMPERATURE_OFFSET) +#define TEMPERATURE_OFFSET 0 +#endif + #if defined(OREGON_NO_PRESSURE) && !defined(USE_OREGON) #error "CONF-BUILD-013: OREGON_NO_PRESSURE requires USE_OREGON" #endif diff --git a/emitter/platformio.ini b/emitter/platformio.ini index b43fa94..ddbd2e6 100644 --- a/emitter/platformio.ini +++ b/emitter/platformio.ini @@ -194,6 +194,7 @@ build_flags = -DLOW_BATTERY_VOLTAGE=3000 -DBATTERY_VOLTAGE_X10_ID=7 -DBATTERY_DIVIDER=2 + -DTEMPERATURE_OFFSET=1.3 ; old HW design — 18650 powered [env:S_05] diff --git a/emitter/src/main.cpp b/emitter/src/main.cpp index 1303d06..1209618 100644 --- a/emitter/src/main.cpp +++ b/emitter/src/main.cpp @@ -84,7 +84,7 @@ static Measurements ReadEnvironment(Hal *hal) { #if defined(USE_BME280) || defined(USE_BMP280) bmx280.Begin(); hal->Delay30ms(); - m.SetTemperature(bmx280.GetTemperature()); + m.SetTemperature(bmx280.GetTemperature() + TEMPERATURE_OFFSET); #if defined(USE_BME280) m.SetHumidity(bmx280.GetHumidity()); #if !defined(OREGON_NO_PRESSURE) // CONF-BUILD-013: THGR228N frame @@ -99,7 +99,7 @@ static Measurements ReadEnvironment(Hal *hal) { ds18b20sensor.Convert(); int16_t temp = ds18b20sensor.Read(); if (temp != 0) { // 0 = read error - m.SetTemperature((float)temp); + m.SetTemperature((float)temp + TEMPERATURE_OFFSET); } #endif (void)hal; // unused when no environment sensor is fitted From 90d886d5e02e2e26d11abdac69bed8a6f8e2a126 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sun, 29 Nov 2026 00:53:28 +0100 Subject: [PATCH 7/8] docs: native_cycle_ds18b20 in the CLAUDE.md native test command 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 98bfede..7accfee 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,7 +9,7 @@ PlatformIO is the build system. The emitter firmware is the PlatformIO project i ```bash # Run all native tests (fast — runs on host, no hardware needed). # native_debug ignores test_main_cycle, which runs in the native_cycle_* environments. -pio test -d emitter -e native_debug -e native_cycle_oregon -e native_cycle_oregon_vcc -e native_cycle_oregon_divider -e native_cycle_lacrosse -e native_cycle_x10 +pio test -d emitter -e native_debug -e native_cycle_oregon -e native_cycle_oregon_vcc -e native_cycle_oregon_divider -e native_cycle_lacrosse -e native_cycle_x10 -e native_cycle_ds18b20 # Run a single test suite pio test -d emitter -e native_debug -f test_oregon From 232fc93720b809d59c2035ab8af6c2a7917a6e02 Mon Sep 17 00:00:00 2001 From: Aurelien Labrosse Date: Sun, 29 Nov 2026 14:07:39 +0100 Subject: [PATCH 8/8] docs: RSP_NO_TARGET_POWER pitfall, ISP ribbon reversed on the Dragon side Co-Authored-By: Claude Opus 5.5 --- docs/debugging.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/debugging.md b/docs/debugging.md index 9fb5d0a..1592914 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -22,6 +22,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 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. +- **`RSP_NO_TARGET_POWER` in both ISP and debugWIRE** (sometimes `RSP_FAILED` first): the Dragon sees no voltage on VTG (ISP pin 2). Before suspecting the board, check the ISP ribbon is not reversed **on the Dragon's 6-pin ISP header** (validated 2026-11-29, mushroom board). - **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).