Skip to content

Commit 1a427e2

Browse files
authored
Merge pull request #60 from squix78/fix-frame-function-bug
Fix broken switchToFrame/transitionToFrame condition
2 parents e28060f + 3ec1383 commit 1a427e2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

OLEDDisplayUi.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,22 @@ void OLEDDisplayUi::previousFrame() {
151151
}
152152

153153
void OLEDDisplayUi::switchToFrame(uint8_t frame) {
154-
if (frame >= this->frameCount || frame != this->state.currentFrame) return;
155-
this->state.lastUpdate = 0;
154+
if (frame >= this->frameCount) return;
156155
this->state.ticksSinceLastStateSwitch = 0;
156+
if (frame == this->state.currentFrame) return;
157157
this->state.frameState = FIXED;
158158
this->state.currentFrame = frame;
159159
this->state.isIndicatorDrawen = true;
160160
}
161161

162162
void OLEDDisplayUi::transitionToFrame(uint8_t frame) {
163-
if (frame >= this->frameCount || frame != this->state.currentFrame) return;
163+
if (frame >= this->frameCount) return;
164+
this->state.ticksSinceLastStateSwitch = 0;
165+
if (frame == this->state.currentFrame) return;
164166
this->nextFrameNumber = frame;
165167
this->lastTransitionDirection = this->state.frameTransitionDirection;
166168
this->state.manuelControll = true;
167169
this->state.frameState = IN_TRANSITION;
168-
this->state.ticksSinceLastStateSwitch = 0;
169170
this->state.frameTransitionDirection = frame < this->state.currentFrame ? -1 : 1;
170171
}
171172

0 commit comments

Comments
 (0)