Repository navigation
Conversation
|
Thanks! A quick question, in your commit, you have an ATTiny_85 in your if block - however your pin numbering/ordering is different from the other ATTiny_85's i've worked with (trinket/gemma), namely that the exported pins are on port B, not port A. Was that a mis-paste? (Also - i will likely pull this code in by hand into the 2.1 branch that i'm working on - and i'm re-working some of the pin definition stuff over there, so if you don't see the pull accepted, that's what's happening, it's not being ignored!) Thank you, again for the code |
|
And, of course, I just checked this in (sans the extra ATTiny85 line) into the master branch. One of those days. I'm going to close this as merged by hand, thank you, again! |
|
Oh crap! Yes, a mispaste, my apologies. Sorry about that. It should only be ATtiny84/44/24. |
…#3022) (#3038) * feat(json): integer-only string->IEEE 754 codec — parser (#3022 phase 2) Adds `fl::ieee754_parse_decimal` (and stubs the serializer side) plus a 84-entry pow10 lookup table generated by `ci/tools/gen_pow10_table.py`. The parser: * Reads decimal digits into a u64 mantissa with a decimal-exponent accumulator (handles fractional + scientific notation). * Normalizes the mantissa so its top bit is set. * Multiplies against a precomputed (mantissa, binary_exp) pair for 10**k using a portable 4-way 32x32->64 widening multiply (`mul_hi_u64`) — no `__aeabi_d*` / `__aeabi_f*` helpers ever reached. * Packs into IEEE 754 single-precision bits with round-half-to-even. Caller bit-casts the returned u32 to `float` via `fl::bit_cast<float>` (which is `memcpy` — no FP arithmetic). Out-of-range exponents clamp to ±0 / ±inf bit patterns. Embedded-grade precision target: ~6 significant decimal digits with at most ±1 ULP drift from `strtof`. Sufficient for the JSON-RPC use case that motivates the no-soft-FP mandate (FastLED #3022 / #3029). `tests/fl/stl/ieee754_string.cpp` exercises well-known constants, ±1 ULP tolerance against the host strtof, scientific notation, over/underflow clamping, and the `consumed` bookkeeping path. Passes under both quick mode and debug mode (ASAN/LSAN/UBSAN). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(json): integer-only IEEE 754 -> string serializer (#3022 phase 2) Adds fl::ieee754_format_decimal. Reuses the same pow10 lookup table already in the TU for the parser, plus a small kPow10IntExact[] table (10^0..10^9 as exact u32 values) for the integer/fractional split. * Unpacks sign / biased exponent / mantissa from the IEEE 754 bit pattern via shifts and masks. * Lifts the 24-bit mantissa to u64 with the top bit set, multiplies by the normalized 10^precision via mul_hi_u64 (shared with the parser), and rounds-half-to-even at the bit-shift step. * Splits the resulting integer by 10^precision and formats via the existing fl::utoa64 helper — no FP arithmetic anywhere. * Inf / NaN / zero / underflow / overflow all return the appropriate literal (inf / -inf / nan / 0.000000 / clamp). tests/fl/stl/ieee754_string.cpp extends to cover the serializer: known constants (0, 1, 0.5, 10, 100), special values, parser round-trip on exact powers of two and within 1 ULP on pi / e, and precision clamping. Verified by building the test DLL directly and invoking the runner: 10/10 doctest cases pass. The bash test wrapper hits an unrelated meson_native.txt lifecycle bug on this build dir, tracked separately. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(json): route parser/serializer through bit-twiddling codec (#3022 phase 2) Replaces the four direct callers of libgcc soft-FP-anchored helpers in src/fl/stl/json.cpp.hpp with the integer-only fl::ieee754_string codec: * JsonTokenizer::scan_array_lookahead — fl::parseFloat + fl::abs check -> fl::ieee754_parse_decimal + biased-exp comparison. * JsonBuilder::parse_float_array (template) — same swap; the static_cast on the outbound value type is left to the caller, matching the "user opts into float math, library does not" mandate. * JsonBuilder::on_token NUMBER arm — fl::parseFloat -> bit-twiddling parse + fl::bit_cast<float> at the variant boundary (memcpy, free). * SerializerVisitor::accept(const float&) and accept(const fl::vector <float>&) — fl::string::append(f, prec) -> fl::ieee754_format_decimal (bit_cast<u32>(f), prec). Output precision contract preserved (3 digits scalar / 6 digits vector). * classify_array float branch — fl::abs(f) > 16777216.0f -> integer biased-exp comparison via the shared float_bits_magnitude_exceeds_2_24 helper. * Removed the unused-since-#3027 canBeRepresentedAsFloat(double) dead helper (it pulled __aeabi_d* via fl::abs(double) for callers that no longer exist). Verified: * tests/fl/stl/ieee754_string.cpp — 10/10 pass. * tests/fl/stl/json.cpp — 27/27 pass (ScreenMap round-trip confirms the new fl::vector<float> serializer reproduces 0.000-style output the previous fl::string::append(f, 3) emitted). Next phase will verify the LPC845 ELF link is free of __aeabi_d* / __aeabi_f* symbols even with FL_JSON_HAS_FLOAT=1 (task #5). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(lint): rename local + IWYU pragma + alphabetize drivers/_build Three follow-up linter fixes spotted by `bash lint --cpp`: * `src/fl/stl/ieee754_string.cpp.hpp`: rename local `m_full` -> `mantissa_full` so MemberStyleChecker (which treats `m_*` as a member-variable prefix) stays quiet. The variable is a function-local in `ieee754_format_decimal`; the rename is purely cosmetic. * `src/fl/stl/json.cpp.hpp`: wrap the newly-added `#include "fl/stl/bit_cast.h"` in an `// IWYU pragma: begin_keep` / `end_keep` block so IwyuPragmaBlockChecker keeps it pinned (the include is reachable transitively but we want explicit intent for the `fl::bit_cast<float|u32>` calls). * `src/platforms/shared/mock/arm/teensy4/drivers/_build.cpp.hpp`: alphabetize the LPUART / ObjectFLED / FlexIO _build.cpp.hpp includes (UnityBuildChecker). Pre-existing master-side ordering bug from PR #3032 — fixing here per the project's "all encountered lint errors get addressed" policy. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix: address CodeRabbit review feedback on #3038 - Reject decimals with no digits (".", "-.") via explicit seen_digit guard; the existing i == mantissa_start check skipped past a consumed decimal point. - Extend pow10 table down to K_MIN=-64 so the parser's raw 19-digit mantissa reaches IEEE 754 single-precision underflow without prematurely flushing to zero (e.g. 1234567890123456789e-46 ~= 1.23e-28 now decodes correctly). - Fix float_bits_magnitude_exceeds_2_24 to include the (2**24, 2**25) decade (biased_exp == 151 with non-zero mantissa) and inf/NaN; the prior strict > 151 check leaked literals like 16777217.0 onto the optimized vector<float> path past the exact-integer boundary. - Strip non-ASCII punctuation (em-dash, plus-minus, arrows) from generator output and from the new ieee754_string / json comments + test banners to satisfy the 7-bit-ASCII repo guideline. - Drop F541 f-string prefix in gen_pow10_table.py print(). Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…chdog (closes #3219) (#3341) * fix(teensy): restore FlexPWM RX byte capture Refs #3219 * fix(teensy4/flexpwm-rx): wait() honest + skip leading phantom edge pair (#3219) Two related fixes uncovered on a live Teensy 4.0 bench session after PR #3222's dual-circuit capture refactor exposed the wrapper-skip cheating. Both were masking real RX-decode failures as success. 1) `wait()` always returned `RxWaitResult::SUCCESS` even on timeout with zero captures. Caller (`capture()` in AutoResearchTest.cpp:428) trusts SUCCESS to mean "RX got data" and proceeds to decode the buffer -- which on a no-data timeout is stale or zero. Result was indistinguishable from real decode errors. Track CITER's initial value and return TIMEOUT when DMA never moved. 2) `buildEdgeTimesFromCaptures()` pushed the first HIGH edge unconditionally, then skipped only the subsequent gap LOW when `low_ns > 5000`. On Teensy 4.0 the IOMUXC pad-mux switch + DMA arm sometimes latches a phantom rising+falling pair whose HIGH duration looks like a real T0H (~226 ns) but is followed by a multi-us idle before the real frame starts. That leftover HIGH then shifted every downstream bit by one. Add a leading-phantom-skip pass that drops any pair whose trailing LOW is a reset/idle gap. Bench result (100-LED OBJECT_FLED frame, MSB_LSB_A pattern A): - Before: First decode error at LED[0], 86/100 LEDs corrupt Edge sequence starts: H226 H580 L640 H586 (double-HIGH at start) - After: First decode error at LED[35], 65/100 LEDs corrupt Edge sequence starts: H580 L640 H586 L640 (clean alternation) LED[0]..LED[34] now decode correctly. Remaining mid-strip failures have a different signature (LSB-only errors, occasional 1-byte shifts) and are tracked separately under #3219 Phase 4 follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(ci): blocker_alert + debug_object_fled_capture helpers (#3219 bench tooling) Two small helpers used during the #3219 FlexPWM-RX bring-up session: - `ci/util/blocker_alert.py` — bold-red ANSI banner + distinctive 3-tone falling-rising chirp via `winsound.Beep` so the user notices when automation is blocked on a physical action (cable swap, power cycle). Falls back to POSIX terminal bell on non-Windows. Tones picked outside the Windows system-sound band (1175/440 Hz x2) so it doesn't get confused with Outlook/Slack notifications. - `ci/autoresearch/debug_object_fled_capture.py` — direct pyserial monitor that bypasses the autoresearch wrapper's `RESULT:`-only serial filter. Sends `runSingleTest` to a flashed Teensy and dumps every line the device emits (FL_WARN, REMOTE:, RESULT:) for a configurable window. Used to inspect FlexPWM RAW captures and edge-time dumps that the wrapper otherwise swallows. Both files include KBI001-compliant KeyboardInterrupt handlers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(teensy4/flexpwm-rx): midpoint bit classification eliminates cascading byte shifts (#3219) Bench evidence on a live Teensy 4.0 (5-LED Pattern B): - BEFORE: one bit lands at high=580ns -- in neither T0H_max nor T1H_min range, so decodeBit() returns -1, decoder `continue`s past it without pushing to current_byte, every subsequent bit shifts forward by one position. Result: 1 decoder error -> 5 of 5 LEDs corrupt with R: 0x55 -> 0xAB (left-shift-by-one signature) propagated through the whole strip. - AFTER: classify by midpoint between t0h_max and t1h_min. Marginal bits still get classified (might be wrong by one bit), but byte alignment is preserved and the error is contained to that bit's byte instead of poisoning the rest of the frame. 100-LED OBJECT_FLED frame, 4 patterns (MSB_LSB_A/B/C/D): - BEFORE phantom-skip (the original wrapper-skip cheat removed): 86/100, 87/100, 80/100, 64/100 LEDs corrupt. - AFTER phantom-skip only (commit e3026d9): 65/100, 79/100, 87/100, 79/100 LEDs corrupt -- LED 0..34 clean. - AFTER midpoint classifier (this commit): 1-8/100 LEDs corrupt across 4 patterns, decoder errors = 0. 3 consecutive runs show non-deterministic per-LED errors, confirming the remaining failures are TX/RX clock-jitter at WS2812 timing tolerances -- not a software algorithm bug. The LOW-time check in the original decoder added no robustness for this protocol (both T0L and T1L overlap heavily at the FlexPWM-RX sample resolution); HIGH-only classification is more skew-tolerant. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * fix(autoresearch): wrapper RPC response-miss race + post-ACK budget honesty (#3219) Two wrapper-side cheat #5 fixes that together prevent the wrapper from silently dropping the device's REMOTE response line and waiting 720 s for a response that arrived in milliseconds. ci/rpc_client.py::_wait_for_response: - Don't recurse into a fresh `_wait_for_response` on ACK -- that spawned a 2nd `read_lines()` producer behind the 1st in the single-worker `FbuildSerialAdapter._executor`. The 1st producer kept reading the serial port (including the final REMOTE response line) into a queue whose async consumer had already returned, and the 2nd producer never saw the line. Keep the SAME `async for` open and extend `current_deadline` on ACK instead. - Stop inflating `producer_budget = max(timeout, 600)`. The caller's `timeout` is the wall; the watchdog enforces the hard ceiling. ci/util/serial_interface.py::FbuildSerialAdapter.read_lines: - Signal the producer thread to exit promptly when the async generator consumer breaks/returns. Without this, the producer kept running for its full `timeout` window after the consumer was done, leaving zombie producers in the single-worker executor that blocked the NEXT call's producer. Together these eliminate the original 20-minute-wrapper-hang on a ~30 ms device-side test. Validated end-to-end against a Teensy 4.0 running OBJECT_FLED autoresearch: wrapper now reports the real PASS/FAIL within seconds and the previously-invisible per-pattern REMOTE messages flow through cleanly. Closes the wrapper half of #3219. The daemon-side throughput cap is fixed upstream in FastLED/fbuild#750. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(autoresearch): deadline-epoch --timeout + daemon-thread watchdog (#3219) Two coupled changes turning `--timeout N` into an honest hard wall: ci/autoresearch/context.py: - Add `deadline_epoch` (set by `start_timeout_epoch()` right after deploy succeeds) and `remaining_seconds()` helper. Every downstream RPC call computes its per-call budget as `ctx.remaining_seconds(minimum=1.0)` so the user's `--timeout` is a TOTAL wall-clock budget, not a silently-multiplied per-call value. Pre-fix `--timeout 60` ran ~15 min wall-clock because `client.send(..., timeout=120.0)` was hardcoded at the call site and the wrapper's post-ACK extension added another 600 s on top. ci/autoresearch/phases.py: - Stamp `ctx.deadline_epoch` post-flash, pre-connect. Replace the hardcoded `timeout=120.0` at the runSingleTest call site with `ctx.remaining_seconds(minimum=1.0)`. Print a one-line advisory so the user sees the deadline armed. - Spawn a daemon `threading.Thread` watchdog at deadline+20s (NOT an asyncio task -- a wedged event loop or starved single-worker executor cannot starve a real OS thread). On expiry: emit a red `blocker_alert` banner, dump stack traces across every live thread (top 4 frames each via `sys._current_frames()`), best-effort close the serial port from a side-thread with a 2 s join cap, then `os._exit(2)` to bypass any stuck asyncio teardown. - `extend_autoresearch_watchdog_deadline(ctx, N)` grants extra runway to known-slow cleanup phases without disarming the bomb. Used in the run finally-block (10 s extension covering `await client.close()`); the safety net stays armed in case cleanup itself wedges. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(teensy4/flexpwm-rx): remove per-frame FL_WARN debug dumps (#3219) PR #3216 enabled `[FlexPWM CFG] / DMA / RAW / EDGE / E / DECODE` FL_WARN_F sites by default in this file to surface the bimodal-edge symptom during the #3066 Phase 4 investigation. The dual-circuit capture refactor + midpoint classifier fix in this PR series eliminated the bug those dumps were diagnosing. Now those 18 dump lines per frame are pure UART output volume: - on a 100-LED OBJECT_FLED autoresearch test they accounted for ~24 % of the device's per-pattern serial output; - the device's UART TX FIFO blocks once it fills, stalling the test between patterns; - even with the wrapper-side fix removing serial-bandwidth as the bottleneck, the device-side FL_WARN-induced TX backpressure remained measurable on bursty tests. Removed: - `#ifndef FL_RX_FLEXPWM_QUIET` opt-in block at file top (+ matching trailing `#undef FL_DEBUG`). - All 6 `#ifdef FL_DEBUG` blocks inside `decodeEdges`, `configureFlexPwm`, `configureDma`, and `buildEdgeTimesFromCaptures` (8 dump-line WARN sites total). If diagnostic dumps are needed again, gate them behind a new `-DFL_RX_FLEXPWM_VERBOSE=1` compile flag rather than hardcoded `#define FL_DEBUG 1` in this header (the latter caused header-pollution problems for downstream files that also test `#ifdef FL_DEBUG`). The two legitimate "Pin not supported on Teensy 4.x" FL_WARN_F sites in `factory_create_flexpwm_rx_channel` are preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * feat(ci): tiny pyserial bench helpers for autoresearch RPC debugging (#3219) Two narrow scripts used during the #3219 bring-up session. Both bypass the autoresearch wrapper's serial filter so you can see every line the device emits in real time -- useful for diff'ing direct serial behavior against the wrapper's stream. - `ci/autoresearch/debug_find_pins.py` -- sends `ping` + `findConnectedPins` via direct pyserial and times the round-trip. Used to confirm device-side firmware was healthy when the wrapper was hanging. - `ci/autoresearch/debug_object_fled_small.py` -- sends `runSingleTest` with a configurable lane size. Used to isolate buffer-position- dependent decode failures (5-LED passes proved the bug was in the shared-register FIFO race, not a per-bit timing issue). Both keep their own KBI-001-compliant interrupt handlers and dump raw bytes for forensic analysis. Companion to the earlier `debug_object_fled_capture.py` helper. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * chore(deps): bump fbuild 2.2.28 -> 2.3.0 for daemon serial WS batching (#3219) Pulls in FastLED/fbuild#750 (closes FastLED/fbuild#749) -- the daemon- side fix for the serial WebSocket bridge that silently dropped lines under sustained TX bursts. Pre-#750 the daemon sent one WS frame per serial line, the broadcast channel lagged on ~320-line bursts (e.g. 4-pattern OBJECT_FLED autoresearch), and lines vanished via RecvError::Lagged. This is the upstream half of the FastLED #3219 fix. The wrapper-side half landed in the prior commits on this branch (rpc_client.py, serial_interface.py, autoresearch/{context,phases}.py). Verified: `uv run fbuild --version` -> `fbuild 2.3.0`, lint stays green, `bash autoresearch teensy40 --object-fled --strip-sizes 5` completes end-to-end with 4/4 patterns through the wrapper. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Hi,
A quick pindefs addition to fastpin for WS2812/11 support. Thanks for FastLED.
pindefs from mellis : https://github.com/damellis/attiny/blob/ide-1.5.x/attiny/avr/variants/tiny14/pins_arduino.h