Adding an onNormalMode Callback
I'm using a WS2812 and the Adafruit-NeoPixel library to indicate my program's status. I'm following the the NeoPixel-Callbacks example and getting good results.
In the example, I see the method used to detect the Normal mode is approached in loop() by polling the mode button and setting the pixel as needed. Without this, the pixel will remain as it was set in the last button or state callback.
I am looking for an event-driven approach rather than the polling approach from the example.
This would directly represent the state by explicitly setting it in the code, remove the dependence on the mode button and polling, and keep the related logic out of the loop.
// Somehere in setup()...
IAS.onNormalMode([]() {
Serial.println(F(" Entering normal mode."));
Serial.println(F("*------------------------------------------------------------------*"));
pixels.clear();
pixels.setPixelColor(0, none); // send none
pixels.show();
delay(100);
});
What do you think about adding an onNormalMode callback to the library?
Thanks!