Merge pull request #21 from gedankenexperimenter/bug/sync-timer

Fixed syncTimer overflow condition
pull/365/head
Jesse Vincent 7 years ago committed by GitHub
commit 6836de6899
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,7 @@ namespace kaleidoscope {
LEDMode *LEDControl::modes[LED_MAX_MODES];
uint8_t LEDControl::mode;
uint16_t LEDControl::syncDelay = 16;
uint32_t LEDControl::syncTimer;
uint16_t LEDControl::syncTimer;
bool LEDControl::paused = false;
void LEDMode::activate(void) {
@ -145,9 +145,10 @@ void LEDControl::loopHook(bool postClear) {
if (postClear || paused)
return;
if (millis() > syncTimer) {
uint16_t current_time = millis();
if ((current_time - syncTimer) > syncDelay) {
syncLeds();
syncTimer = millis() + syncDelay;
syncTimer += syncDelay;
}
update();
}

@ -131,7 +131,7 @@ class LEDControl : public KaleidoscopePlugin {
static bool focusHook(const char *command);
private:
static uint32_t syncTimer;
static uint16_t syncTimer;
static LEDMode *modes[LED_MAX_MODES];
static uint8_t mode;

Loading…
Cancel
Save