From f373f1108a9be18eb375525c9cf16c536391ec32 Mon Sep 17 00:00:00 2001 From: Fabrice Weinberg <Fabrice@weinberg.me> Date: Wed, 6 Jul 2016 14:03:05 +0200 Subject: [PATCH] Fixes #58 --- OLEDDisplayUi.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OLEDDisplayUi.cpp b/OLEDDisplayUi.cpp index f827c32..eaa353b 100644 --- a/OLEDDisplayUi.cpp +++ b/OLEDDisplayUi.cpp @@ -151,21 +151,22 @@ void OLEDDisplayUi::previousFrame() { } void OLEDDisplayUi::switchToFrame(uint8_t frame) { - if (frame >= this->frameCount || frame != this->state.currentFrame) return; - this->state.lastUpdate = 0; + if (frame >= this->frameCount) return this->state.ticksSinceLastStateSwitch = 0; + if (frame == this->state.currentFrame) return; this->state.frameState = FIXED; this->state.currentFrame = frame; this->state.isIndicatorDrawen = true; } void OLEDDisplayUi::transitionToFrame(uint8_t frame) { - if (frame >= this->frameCount || frame != this->state.currentFrame) return; + if (frame >= this->frameCount) return + this->state.ticksSinceLastStateSwitch = 0; + if (frame == this->state.currentFrame) return; this->nextFrameNumber = frame; this->lastTransitionDirection = this->state.frameTransitionDirection; this->state.manuelControll = true; this->state.frameState = IN_TRANSITION; - this->state.ticksSinceLastStateSwitch = 0; this->state.frameTransitionDirection = frame < this->state.currentFrame ? -1 : 1; } -- GitLab