@@ -95,22 +95,20 @@ void OLEDDisplayUi::setFrameAnimation(AnimationDirection dir) {
9595 this ->frameAnimationDirection = dir;
9696}
9797void OLEDDisplayUi::setFrames (FrameCallback* frameFunctions, uint8_t frameCount) {
98- this ->frameCount = frameCount;
9998 this ->frameFunctions = frameFunctions;
99+ this ->frameCount = frameCount;
100+ this ->resetState ();
100101}
101102
102103// -/----- Overlays ------\-
103104void OLEDDisplayUi::setOverlays (OverlayCallback* overlayFunctions, uint8_t overlayCount){
104- this ->overlayCount = overlayCount;
105105 this ->overlayFunctions = overlayFunctions;
106+ this ->overlayCount = overlayCount;
106107}
107108
108109// -/----- Loading Process -----\-
109110
110111void OLEDDisplayUi::runLoadingProcess (LoadingStage* stages, uint8_t stagesCount) {
111- display->setTextAlignment (TEXT_ALIGN_CENTER);
112- display->setFont (ArialMT_Plain_10);
113-
114112 uint8_t progress = 0 ;
115113 uint8_t increment = 100 / stagesCount;
116114
@@ -206,6 +204,14 @@ void OLEDDisplayUi::tick() {
206204 this ->display ->display ();
207205}
208206
207+ void OLEDDisplayUi::resetState () {
208+ this ->state .lastUpdate = 0 ;
209+ this ->state .ticksSinceLastStateSwitch = 0 ;
210+ this ->state .frameState = FIXED;
211+ this ->state .currentFrame = 0 ;
212+ this ->state .isIndicatorDrawen = true ;
213+ }
214+
209215void OLEDDisplayUi::drawFrame (){
210216 switch (this ->state .frameState ){
211217 case IN_TRANSITION: {
0 commit comments