Use milliseconds for autocycle

This commit is contained in:
Dale Higgs 2019-02-15 13:34:42 -06:00
parent 1b3414cf52
commit 67a98c28b8
2 changed files with 8 additions and 9 deletions

View file

@ -54,11 +54,11 @@ const char HOSTNAME[] = "McLighting01"; // Friedly hostname
#endif
// parameters for automatically cycling favorite patterns
uint32_t autoParams[][4] = { // color, speed, mode, duration (seconds)
{0xff0000, 200, 1, 5.0}, // blink red for 5 seconds
{0x00ff00, 200, 3, 10.0}, // wipe green for 10 seconds
{0x0000ff, 200, 11, 5.0}, // dual scan blue for 5 seconds
{0x0000ff, 200, 42, 15.0} // fireworks for 15 seconds
uint32_t autoParams[][4] = { // color, speed, mode, duration (milliseconds)
{0xff0000, 200, 1, 5000}, // blink red for 5 seconds
{0x00ff00, 200, 3, 10000}, // wipe green for 10 seconds
{0x0000ff, 200, 14, 5000}, // dual scan blue for 5 seconds
{0x0000ff, 200, 45, 15000} // fireworks for 15 seconds
};
#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)

View file

@ -428,9 +428,8 @@ void autoTick() {
strip->setColor(autoParams[autoCount][0]);
strip->setSpeed(convertSpeed((uint8_t)autoParams[autoCount][1]));
strip->setMode((uint8_t)autoParams[autoCount][2]);
autoTicker.once((float)autoParams[autoCount][3], autoTick);
DBG_OUTPUT_PORT.print("autoTick ");
DBG_OUTPUT_PORT.println(autoCount);
autoTicker.once_ms((uint32_t)autoParams[autoCount][3], autoTick);
DBG_OUTPUT_PORT.printf("autoTick[%d]: {0x%06x, %d, %d, %d}\n", autoCount, autoParams[autoCount][0], (uint8_t)autoParams[autoCount][1], (uint8_t)autoParams[autoCount][2], (uint32_t)autoParams[autoCount][3]);
autoCount++;
if (autoCount >= (sizeof(autoParams) / sizeof(autoParams[0]))) autoCount = 0;
@ -1521,4 +1520,4 @@ void writeStripConfigFS(void){
configFile.close();
updateFS = false;
//end save
}
}