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

use a signed int in the getNextFrameNumber function

parent b6857d34
No related branches found
No related tags found
No related merge requests found
...@@ -303,7 +303,7 @@ void SSD1306Ui::drawIndicator() { ...@@ -303,7 +303,7 @@ void SSD1306Ui::drawIndicator() {
posOfHighlightFrame = frameToHighlight; posOfHighlightFrame = frameToHighlight;
break; break;
case RIGHT_LEFT: case RIGHT_LEFT:
posOfHighlightFrame = (this->frameCount - 1) - frameToHighlight; posOfHighlightFrame = this->frameCount - frameToHighlight;
break; break;
} }
...@@ -359,7 +359,7 @@ void SSD1306Ui::drawOverlays() { ...@@ -359,7 +359,7 @@ void SSD1306Ui::drawOverlays() {
} }
uint8_t SSD1306Ui::getNextFrameNumber(){ uint8_t SSD1306Ui::getNextFrameNumber(){
uint8_t nextFrame = (this->state.currentFrame + this->state.frameTransitionDirection) % this->frameCount; int8_t nextFrame = (this->state.currentFrame + this->state.frameTransitionDirection) % this->frameCount;
if (nextFrame < 0){ if (nextFrame < 0){
nextFrame = this->frameCount + nextFrame; nextFrame = this->frameCount + nextFrame;
} }
......
...@@ -29,6 +29,12 @@ ...@@ -29,6 +29,12 @@
#include <Arduino.h> #include <Arduino.h>
#include "SSD1306.h" #include "SSD1306.h"
//#define DEBUG_SSD1306Ui(...) Serial.printf( __VA_ARGS__ )
#ifndef DEBUG_SSD1306Ui
#define DEBUG_SSD1306Ui(...)
#endif
enum AnimationDirection { enum AnimationDirection {
SLIDE_UP, SLIDE_UP,
SLIDE_DOWN, SLIDE_DOWN,
......
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