Skip to content
Snippets Groups Projects
Commit e3a5b650 authored by Fabrice Weinberg's avatar Fabrice Weinberg
Browse files

Recalculate ticksPer* if target fps was changed

parent 27cf049e
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,13 @@ void SSD1306Ui::init() {
}
void SSD1306Ui::setTargetFPS(byte fps){
int oldInterval = this->updateInterval;
this->updateInterval = ((float) 1.0 / (float) fps) * 1000;
Serial.println(this->updateInterval);
// Calculate new ticksPerFrame
float changeRatio = oldInterval / this->updateInterval;
this->ticksPerFrame *= changeRatio;
this->ticksPerTransition *= changeRatio;
}
// -/------ Automatic controll ------\-
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment