@@ -48,8 +48,6 @@ OLEDDisplayUi::OLEDDisplayUi(OLEDDisplay *display) {
4848 inactiveSymbol = ANIMATION_inactiveSymbol;
4949 frameAnimationDirection = SLIDE_RIGHT;
5050 lastTransitionDirection = 1 ;
51- ticksPerFrame = 151 ; // ~ 5000ms at 30 FPS
52- ticksPerTransition = 15 ; // ~ 500ms at 30 FPS
5351 frameCount = 0 ;
5452 nextFrameNumber = -1 ;
5553 overlayCount = 0 ;
@@ -66,20 +64,19 @@ OLEDDisplayUi::OLEDDisplayUi(OLEDDisplay *display) {
6664 state.userData = NULL ;
6765 shouldDrawIndicators = true ;
6866 autoTransition = true ;
67+ setTimePerFrame (5000 );
68+ setTimePerTransition (500 );
6969}
7070
7171void OLEDDisplayUi::init () {
7272 this ->display ->init ();
7373}
7474
7575void OLEDDisplayUi::setTargetFPS (uint8_t fps){
76- float oldInterval = this ->updateInterval ;
7776 this ->updateInterval = ((float ) 1.0 / (float ) fps) * 1000 ;
7877
79- // Calculate new ticksPerFrame
80- float changeRatio = oldInterval / (float ) this ->updateInterval ;
81- this ->ticksPerFrame *= changeRatio;
82- this ->ticksPerTransition *= changeRatio;
78+ this ->ticksPerFrame = timePerFrame / updateInterval;
79+ this ->ticksPerTransition = timePerTransition / updateInterval;
8380}
8481
8582// -/------ Automatic controll ------\-
@@ -99,10 +96,12 @@ void OLEDDisplayUi::setAutoTransitionBackwards(){
9996 this ->lastTransitionDirection = -1 ;
10097}
10198void OLEDDisplayUi::setTimePerFrame (uint16_t time){
102- this ->ticksPerFrame = (uint16_t ) ( (float ) time / (float ) updateInterval);
99+ this ->timePerFrame = time;
100+ this ->ticksPerFrame = timePerFrame / updateInterval;
103101}
104102void OLEDDisplayUi::setTimePerTransition (uint16_t time){
105- this ->ticksPerTransition = (uint16_t ) ( (float ) time / (float ) updateInterval);
103+ this ->timePerTransition = time;
104+ this ->ticksPerTransition = timePerTransition / updateInterval;
106105}
107106
108107// -/------ Customize indicator position and style -------\-
0 commit comments