Flash lights when settings changed
This commit is contained in:
parent
0e1e7a4d12
commit
48bb13b965
3 changed files with 40 additions and 0 deletions
|
@ -399,6 +399,43 @@ void setLights(int r, int g, int b)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flashTemporaryLights(int r, int g, int b)
|
||||||
|
{
|
||||||
|
#ifdef WITH_RGB_LED
|
||||||
|
|
||||||
|
uint32_t oldLights[NEOPIXEL_COUNT];
|
||||||
|
|
||||||
|
// get current state
|
||||||
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
|
oldLights[i] = pixels.getPixelColor(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// flash three times in given color
|
||||||
|
for (int t = 0; t < 3; t++) {
|
||||||
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
|
pixels.setPixelColor(i, pixels.Color(r, g, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
pixels.show();
|
||||||
|
delay(200);
|
||||||
|
|
||||||
|
pixels.clear();
|
||||||
|
pixels.show();
|
||||||
|
delay(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// revert to previous state
|
||||||
|
for (int i = 0; i < NEOPIXEL_COUNT; i++)
|
||||||
|
{
|
||||||
|
pixels.setPixelColor(i, oldLights[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
pixels.show();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void setupI2C()
|
void setupI2C()
|
||||||
{
|
{
|
||||||
bool slaveMode = preferences.getBool("I2CSlaveMode", false);
|
bool slaveMode = preferences.getBool("I2CSlaveMode", false);
|
||||||
|
|
|
@ -17,6 +17,7 @@ void setupWifi();
|
||||||
void synchronizeTime();
|
void synchronizeTime();
|
||||||
void setupPreferences();
|
void setupPreferences();
|
||||||
void setLights(int r, int g, int b);
|
void setLights(int r, int g, int b);
|
||||||
|
void flashTemporaryLights(int r, int g, int b);
|
||||||
void setupI2C();
|
void setupI2C();
|
||||||
void onI2CReceive(int len);
|
void onI2CReceive(int len);
|
||||||
void onI2CRequest();
|
void onI2CRequest();
|
||||||
|
|
|
@ -287,6 +287,8 @@ void onApiSettingsPost(AsyncWebServerRequest *request)
|
||||||
request->send(200);
|
request->send(200);
|
||||||
if (settingsChanged)
|
if (settingsChanged)
|
||||||
{
|
{
|
||||||
|
flashTemporaryLights(0,255,0);
|
||||||
|
|
||||||
Serial.println("Settings changed");
|
Serial.println("Settings changed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue