Repository navigation
Fix led init - #113
Fix led init#113
Conversation
libDaisy's Led::Init() never initialises the software-PWM phase (pwm_) and Led's constructor does nothing, so an Led created on the stack starts with leftover stack contents. Depending on the compiler and optimiser that can be huge or NaN, which keeps the LED permanently off (or on); the update does `pwm_ += rate; if (pwm_ > 1) pwm_ -= 1`, so a large value never comes back into range. InitLeds now zeroes the object before calling Init(). Verified on hardware with arm-none-eabi-gcc 13.3, where the LEDs did not work before. This is an upstream libDaisy bug; libDaisy is a submodule so the workaround lives in the project. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| GCC_VERSION := $(shell $(GCC_CHECK) -dumpversion) | ||
| GCC_VERSION_MAJOR := $(word 1, $(subst ., ,$(GCC_VERSION))) | ||
| GCC_VERSION_MAJOR_REQUIRED := 10 | ||
| # GCC_VERSION := $(shell $(GCC_CHECK) -dumpversion) |
There was a problem hiding this comment.
Please delete this entire compiler version check instead of commenting it out
|
I went back and re-read the relevant posts about the compiler issues and yep, it was only the LED: https://community.daisy.audio/t/my-daisy-guitar-pedal-designs-on-github/3641/225?u=xconverge |
|
Thanks for this! Simplifies things a bit! |
|
There were more lines with the compiler test I hadn't noticed to I removed it all now. Not to countermand my assertion with more recent compilers. I had noticed before that there were new linker warnings but forgot (the firmware does work). |
Workaround for a bug in Led::init in wait for the upstreamed fix being released.
As far as I could find this was the only hurdle stopping use of a more recent compiler so I commented out that test.
I'm using the current gcc 15.3.1 at the moment.