GodMode9 icon indicating copy to clipboard operation
GodMode9 copied to clipboard

[BUG] Info LED code making the LED pulse 32 times faster than intended

Open TuxSH opened this issue 3 years ago • 2 comments
trafficstars

3dbrew and by extension GodMode9 are wrong about the notification LED data format and units

The color data is u8[32] per color component, each index representing a "frame". The MCU runs the periodic task of updating that LED at a 512Hz rate.

  • delay is the delay/period in "task" (512Hz) ticks between two array elements, not counting the current task tick. Which means it's clamp((512 * delayMs / 1000) - 1, 1, 255). 0 will cause an underflow. This limits the period to 500ms exactly.
  • smoothing is the fade-out time. Same unit and range as delay (1..255). You usually put the same value as delay (smooth transition), or 1 (blink).
  • loop_time is the amount of time to wait before restarting the pattern, not counting the current tick. It can be 0 (restart immediately), or 255 ("don't restart")

See here: https://github.com/SciresM/boot9strap/blob/master/stage2/arm9/source/utils.c#L89

Hope this helps.

TuxSH avatar Apr 13 '22 20:04 TuxSH

Thanks @TuxSH, great find! @Wolfvak - since you did all the hardware stuff, do you know which places we will need to fix?

d0k3 avatar May 08 '22 14:05 d0k3

All that needs changing is this code https://github.com/d0k3/GodMode9/blob/master/arm11/source/hw/mcu.c#L117-L151

Wolfvak avatar May 08 '22 14:05 Wolfvak