diff --git a/SSD1306Ui.cpp b/SSD1306Ui.cpp index 8754d786847a397d4eaf9e61efd1bb749d864f6b..44cc87f8792f6bc9287ed3b552490bb7ec65d839 100644 --- a/SSD1306Ui.cpp +++ b/SSD1306Ui.cpp @@ -303,7 +303,7 @@ void SSD1306Ui::drawIndicator() { posOfHighlightFrame = frameToHighlight; break; case RIGHT_LEFT: - posOfHighlightFrame = (this->frameCount - 1) - frameToHighlight; + posOfHighlightFrame = this->frameCount - frameToHighlight; break; } @@ -359,7 +359,7 @@ void SSD1306Ui::drawOverlays() { } 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){ nextFrame = this->frameCount + nextFrame; } diff --git a/SSD1306Ui.h b/SSD1306Ui.h index b95a5eddb03b8419358e8052085de08c2af80f84..bdf218fd4e9c2e79dfcc68b9431d85c03ec6547c 100644 --- a/SSD1306Ui.h +++ b/SSD1306Ui.h @@ -29,6 +29,12 @@ #include <Arduino.h> #include "SSD1306.h" +//#define DEBUG_SSD1306Ui(...) Serial.printf( __VA_ARGS__ ) + +#ifndef DEBUG_SSD1306Ui +#define DEBUG_SSD1306Ui(...) +#endif + enum AnimationDirection { SLIDE_UP, SLIDE_DOWN,