Skip to content
Snippets Groups Projects
Unverified Commit 4ebb6ec7 authored by Dan Church's avatar Dan Church
Browse files

Fix compiler warnings

Fix the following warnings, seen when compiling with GCC 5.4:

    CXX OLEDDisplay.o
    ./OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawStringInternal(int16_t, int16_t, char*, uint16_t, uint16_t)':
    ./OLEDDisplay.cpp:381:10: error: enumeration value 'TEXT_ALIGN_LEFT' not handled in switch [-Werror=switch]
       switch (textAlignment) {
	      ^
    ./OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawInternal(int16_t, int16_t, int16_t, int16_t, const char*, uint16_t, uint16_t)':
    ./OLEDDisplay.cpp:722:13: warning: unused variable 'yScreenPos' [-Wunused-variable]
	 int16_t yScreenPos = yMove + yOffset;
		 ^
    ./OLEDDisplay.cpp: In member function 'void OLEDDisplay::drawXbm(int16_t, int16_t, int16_t, int16_t, const char*)':
    ./OLEDDisplay.cpp:361:19: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
	     data >>= 1; // Move a bit
		       ^
    cc1plus: some warnings being treated as errors
parent 7262836a
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -250,7 +250,7 @@ class OLEDDisplay : public Print {
virtual void sendCommand(uint8_t com) {};
// Connect to the display
virtual bool connect() {};
virtual bool connect() {return true;};
// Send all the init commands
void sendInitCommands();
......
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