Closed psychogenic closed 2 hours ago
Yeah, if we add a way to disable the clock, we can set the minimum frequency to "3", so you are not able to input a too-low value.
An alternative would be to use a micropython timer instead of PWM to generate the slower clock - or - maybe to slow down the system clock even further to allow PWM to go down to 1 Hz?
Quick experimentation shows that slowing the system clock down to 33 MHz (which is needed for 2 Hz PWM frequency) makes the USB connection unreliable. That leaves us with either timers, or disallowing slower (< 3 Hz) frequencies altogether.
Oh, is the lower limit 4Hz? Frankly I think down there we can say: hey yo, press the button.
The lower limit is 2.86 Hz (which we market as 3 Hz). That is 48 MHz clock divided by (2²⁴-1)
Fixed by 71ec63d422ec2aae9b3277594c2e23b51874a09e - we can now set the clock to lower frequencies, such as 1 or 2 Hz.
_get_best_rp2040_freq dies badly at small frequencies
Could hide that, or trap it and display.
More importantly, turning the clock off works fine by setting the frequency to 0 but this isn't overly obvious. A button, or just an "OFF" preset.