| 254 | |
| 255 | |
| 256 | void OLEDDisplayUi::tick() { |
| 257 | this->state.ticksSinceLastStateSwitch++; |
| 258 | |
| 259 | switch (this->state.frameState) { |
| 260 | case IN_TRANSITION: |
| 261 | if (this->state.ticksSinceLastStateSwitch >= this->ticksPerTransition){ |
| 262 | this->state.frameState = FIXED; |
| 263 | this->state.currentFrame = getNextFrameNumber(); |
| 264 | this->state.ticksSinceLastStateSwitch = 0; |
| 265 | this->nextFrameNumber = -1; |
| 266 | } |
| 267 | break; |
| 268 | case FIXED: |
| 269 | // Revert manualControl |
| 270 | if (this->state.manualControl) { |
| 271 | this->state.frameTransitionDirection = this->lastTransitionDirection; |
| 272 | this->state.manualControl = false; |
| 273 | } |
| 274 | if (this->state.ticksSinceLastStateSwitch >= this->ticksPerFrame){ |
| 275 | if (this->autoTransition){ |
| 276 | this->state.frameState = IN_TRANSITION; |
| 277 | } |
| 278 | this->state.ticksSinceLastStateSwitch = 0; |
| 279 | } |
| 280 | break; |
| 281 | } |
| 282 | |
| 283 | this->display->clear(); |
| 284 | this->drawFrame(); |
| 285 | if (shouldDrawIndicators) { |
| 286 | this->drawIndicator(); |
| 287 | } |
| 288 | this->drawOverlays(); |
| 289 | this->display->display(); |
| 290 | } |
| 291 | |
| 292 | void OLEDDisplayUi::resetState() { |
| 293 | this->state.lastUpdate = 0; |
no test coverage detected