From 67a98c28b899dbb608bd32da291e3e250e1f41ff Mon Sep 17 00:00:00 2001 From: Dale Higgs Date: Fri, 15 Feb 2019 13:34:42 -0600 Subject: [PATCH] Use milliseconds for autocycle --- Arduino/McLighting/definitions.h | 10 +++++----- Arduino/McLighting/request_handlers.h | 7 +++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Arduino/McLighting/definitions.h b/Arduino/McLighting/definitions.h index f616860..8fc0b4c 100644 --- a/Arduino/McLighting/definitions.h +++ b/Arduino/McLighting/definitions.h @@ -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) diff --git a/Arduino/McLighting/request_handlers.h b/Arduino/McLighting/request_handlers.h index 22dd3d4..f7e7678 100644 --- a/Arduino/McLighting/request_handlers.h +++ b/Arduino/McLighting/request_handlers.h @@ -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 -} \ No newline at end of file +}