Repository navigation
fix(avr): allow Servo to own Timer1 vector - #4884
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Follow-up runtime validation is now complete using the native fbuild fix in FastLED/fbuild#1697 (2.5.43). Linked the official Arduino Servo library at The Uno firmware linked and ran in native AVR8JS, reporting: This verifies the Timer1 ownership guard and register preservation for this configuration. It does not establish concurrent FastLED timer-ISR operation with Servo: Servo owns the vector and FastLED's timer attachment is rejected as intended. The temporary fixture/library were kept outside the tracked source and removed from the staged project after validation. |
|
Full CI for #4895 found a regression in this merged weak alias: AVR GCC 7.3 LTO crashes while linking AnalogOutput. Moving the alias to assembly links but lets the CRT weak default win, so that approach is also invalid for standalone timers. Correction pushed in 8e6df0e (#4895): strong Timer1 compare-B ISR at the same CTC TOP, plus a pre-write compare-A ownership check. Local AVR8JS probes now verify both standalone callbacks (101 ticks over 100 ms at 1 kHz) and real Servo rejection (-16, invalid handle, all six Timer1 snapshots preserved). AnalogOutput links with LTO enabled. The correction is awaiting full CI in #4895. |
Fixes #4836
On classic ATmega targets, FastLED now exposes its Timer1 Compare A ISR through a weak vector alias. Servo's strong vector can link and take ownership. The FastLED timer API detects an overridden vector and returns the existing timer-in-use error before changing Timer1 registers.
Verification:
bash compile uno --examples Blinkpassed.TIMER1_COMPA_vectto Blink; the Uno build linked successfully, then the sketch was restored.Servo::attach(9)to force Servo's Timer1 ISR into the final Uno image; linking succeeded. The temporary sketch change and test library were removed.bash lint --cpppassed.The initial AVR8JS run was blocked by the legacy Docker fallback. After fixing native fbuild shutdown in FastLED/fbuild#1697, a real-Servo Uno runtime probe passed: FastLED returned
-16, left the output handle invalid, and preserved TCCR1A, TCCR1B, TIMSK1, OCR1A, OCR1B, and ICR1. Runtime evidence.Summary by CodeRabbit