Conversation
When an admin changes their password the first_login flag was never
cleared, so the UI would keep prompting for a password change on
every subsequent login.
Write KEY_ADMIN_FIRST_LOGIN = b"0" inside the same write transaction
before the password key to satisfy ekv's lexicographic ordering
requirement ("admin/first_login" < "u/…/pw").
Co-authored-by: Claude <noreply@anthropic.com>
This updates the pins according to the carrier PCB layout Signed-off-by: Marvin Drees <marvin.drees@9elements.com>
The HLW8012 outputs two 50% duty-cycle square waves whose frequencies are proportional to active power (CF) and current/voltage RMS (CF1). Two RP2040 PIO state machines measure the HIGH half-period of each signal by counting down a 32-bit register at 2 clock cycles per loop iteration, then pushing the result to the RX FIFO asynchronously. The driver (Hlw8012Driver<'d>) ties to PIO0 SM0 (CF) and SM1 (CF1). Calibration multipliers are pre-computed from the datasheet §3.2 formulas using the µs/unit convention of the Arduino reference library: value = multiplier / T_half_µs / 2. Circuit defaults (config.rs): GPIO 8 = CF (active power) GPIO 9 = CF1 (current/voltage RMS) GPIO 10 = SEL (LOW = current mode, HIGH = voltage mode) R_sense = 1 mΩ, V_ratio = 1881 (4×470 kΩ + 1 kΩ divider) A minimum-frequency guard (0.1 Hz) clamps spurious no-load pulses to zero, matching behaviour observed in the Arduino reference implementation. Absolute accuracy is ±15% without calibration due to the chip's internal oscillator tolerance. Co-authored-by: Claude <noreply@anthropic.com>
Replace the stub voltage/current fields in SensorData with real
measurements from the HLW8012 driver:
- SensorData: remove current_a:[f32;8] stub; add voltage_v, current_total_a,
power_w (all driven by the HLW8012).
- sensor_task: add Hlw8012Driver<'static> parameter; measure power,
current, and voltage each cycle (voltage read toggles SEL and waits
2 s for stabilisation).
- main.rs: bind PIO0_IRQ_0, initialise Hlw8012Driver on GPIO 8/9/10,
pass it to sensor_task.
- GET /api/sensors: replace current_a array with current_total_a and
power_w fields.
- index.html: add Current and Power tiles to the sensor bar; remove
per-relay current stubs (HLW8012 measures total input only).
Co-authored-by: Claude <noreply@anthropic.com>
Five errors were reported by cargo deny: 1. 0BSD not in license allow-list: managed + smoltcp (both transitive deps of embassy-net) use this OSI-approved permissive license. Added "0BSD" to [licenses].allow. 2. CDLA-Permissive-2.0 not in allow-list: webpki-roots is pulled in only by ureq inside the host-only xtask crate. Added xtask to [graph].exclude so its host-only transitive deps are not audited against the embedded firmware license policy. 3. xtask unlicensed: added license = "Apache-2.0" to xtask/Cargo.toml. 4. RUSTSEC-2024-0436 (paste unmaintained): paste is a transitive build-time dep via pio-core -> pio -> embassy-rp. No safe upgrade path exists until pio-core migrates upstream. Added an [[advisories.ignore]] entry with a documented rationale. 5. keccak 0.1.5 yanked: bumped to 0.1.6 via cargo update -p keccak. This is a build-time dep (lalrpop -> sha3 -> keccak). Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.