My booting show-off flash in #38 is doing what I'd intended: at boot time, reassure me that I've configured and wired my LEDs correctly. Reckon I might port just the flash to aiko.led for that reason. But, it's sloooow. Writing 243 updates to 7 pixels each time and then calling aiko.led.np.write again is taking 7800ms with a delay of 1ms, 7900ms with the time.sleep_ms code removed—I'm not sure why—and 1990ms even if I do nothing except call aiko.led.np.write() 243 times with 235 pixels. I'll track my work trying to speed it up here until I raise the PR.
At the moment, removing the requirement for the led module in main.py breaks the network loader. Given situations where you haven't got a neopixel on board to display the status then this causes a break if you remove it. It's also not configurable to use other types of visual display such as a normal LED or an OLED display.
Suggest the following changes:
have a global network state variable that can be updated by the aiko.net module as it polls, connects etc.
Move the current functionality that controls the LED behaviour into a loader_display module that can be instantiated as an application using configuration/main.py
This can then create a timer which polls the current state of the network global and reflects that to the appropriate display type.
This can be extended to have different sub modules for normal LED, neopixel and oled each of which can be created and then passed into the loader_display module on startup.
At the moment to enable certain behaviour such as an OLED, you need to initialise it in main.py to make it available on and then bring it into your application code to use it.
Suggest moving the creation and initialisation step to the application level instead where it can then have more control. This will also allow for a generic interface such as nodebots to be able to create objects on the fly and not have to pre-determine what types of modules you want to use up front and then flash the firmware for it (for what amounts only to a config change).
Suggest moving the current LED module to being a specific ws2812 module and then breaking this up to have the basic functions (turning LEDs on and off etc) as part of this and then add a high order "drawing" module on top of it which can use it (or any other displayable method - eg an OLED, LED matrix or other device that can display pixel data).