From ca4e8b7d2e7062475686181cc01251bffa67dcce Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Mon, 20 Nov 2017 15:33:50 -0800 Subject: [PATCH] cleanup compiler warnings --- OLEDDisplay.cpp | 5 +++-- OLEDDisplay.h | 4 ++-- OLEDDisplayUi.cpp | 6 +++--- SSD1306Wire.h | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OLEDDisplay.cpp b/OLEDDisplay.cpp index f8fc226..3a94990 100644 --- a/OLEDDisplay.cpp +++ b/OLEDDisplay.cpp @@ -353,7 +353,7 @@ void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *xbm) { int16_t widthInXbm = (width + 7) / 8; - uint8_t data; + uint8_t data = 0; for(int16_t y = 0; y < height; y++) { for(int16_t x = 0; x < width; x++ ) { @@ -388,6 +388,8 @@ void OLEDDisplay::drawStringInternal(int16_t xMove, int16_t yMove, char* text, u case TEXT_ALIGN_RIGHT: xMove -= textWidth; break; + case TEXT_ALIGN_LEFT: + break; } // Don't draw anything if it is not on the screen. @@ -719,7 +721,6 @@ void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t widt int16_t xPos = xMove + (i / rasterHeight); int16_t yPos = ((yMove >> 3) + (i % rasterHeight)) * DISPLAY_WIDTH; - int16_t yScreenPos = yMove + yOffset; int16_t dataPos = xPos + yPos; if (dataPos >= 0 && dataPos < DISPLAY_BUFFER_SIZE && diff --git a/OLEDDisplay.h b/OLEDDisplay.h index 81537a2..f072b1a 100644 --- a/OLEDDisplay.h +++ b/OLEDDisplay.h @@ -247,10 +247,10 @@ class OLEDDisplay : public Print { char *logBuffer = NULL; // Send a command to the display (low level function) - virtual void sendCommand(uint8_t com) {}; + virtual void sendCommand(uint8_t com) {(void)com;}; // Connect to the display - virtual bool connect() {}; + virtual bool connect() {return false;}; // Send all the init commands void sendInitCommands(); diff --git a/OLEDDisplayUi.cpp b/OLEDDisplayUi.cpp index 3fb4326..b3fdfdb 100644 --- a/OLEDDisplayUi.cpp +++ b/OLEDDisplayUi.cpp @@ -251,7 +251,7 @@ void OLEDDisplayUi::drawFrame(){ switch (this->state.frameState){ case IN_TRANSITION: { float progress = (float) this->state.ticksSinceLastStateSwitch / (float) this->ticksPerTransition; - int16_t x, y, x1, y1; + int16_t x = 0, y = 0, x1 = 0, y1 = 0; switch(this->frameAnimationDirection){ case SLIDE_LEFT: x = -128 * progress; @@ -331,7 +331,7 @@ void OLEDDisplayUi::drawIndicator() { return; } - uint8_t posOfHighlightFrame; + uint8_t posOfHighlightFrame = 0; float indicatorFadeProgress = 0; // if the indicator needs to be slided in we want to @@ -362,7 +362,7 @@ void OLEDDisplayUi::drawIndicator() { uint16_t frameStartPos = (12 * frameCount / 2); const char *image; - uint16_t x,y; + uint16_t x = 0, y = 0; for (byte i = 0; i < this->frameCount; i++) { switch (this->indicatorPosition){ diff --git a/SSD1306Wire.h b/SSD1306Wire.h index ac12bec..d558da8 100644 --- a/SSD1306Wire.h +++ b/SSD1306Wire.h @@ -80,7 +80,7 @@ class SSD1306Wire : public OLEDDisplay { // If the minBoundY wasn't updated // we can savely assume that buffer_back[pos] == buffer[pos] // holdes true for all values of pos - if (minBoundY == ~0) return; + if (minBoundY == (uint8_t)(~0)) return; sendCommand(COLUMNADDR); sendCommand(minBoundX);