From acbf9a676915fe4c2a30b0ed5f60537838b71852 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Sat, 8 May 2021 07:29:04 +0100 Subject: [PATCH] v1.3.3 - fix compiler warnings --- library.json | 2 +- library.properties | 2 +- src/SFE_MicroOLED.cpp | 8 ++++++-- src/hardware.cpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/library.json b/library.json index 86e43dc..f0fecd4 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "SparkFun Micro OLED Breakout", - "version": "1.3.2", + "version": "1.3.3", "keywords": "display oled", "description": "Library for the SparkFun Micro OLED Breakout", "repository": diff --git a/library.properties b/library.properties index 35682dd..752b961 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=SparkFun Micro OLED Breakout -version=1.3.2 +version=1.3.3 author=SparkFun Electronics maintainer=SparkFun Electronics sentence=Library for the SparkFun Micro OLED Breakout. diff --git a/src/SFE_MicroOLED.cpp b/src/SFE_MicroOLED.cpp index c688070..761b2fd 100644 --- a/src/SFE_MicroOLED.cpp +++ b/src/SFE_MicroOLED.cpp @@ -625,7 +625,7 @@ Draw color pixel in the screen buffer's x,y position with NORM or XOR draw mode. */ void MicroOLED::pixel(uint8_t x, uint8_t y, uint8_t color, uint8_t mode) { - if ((x < 0) || (x >= LCDWIDTH) || (y < 0) || (y >= LCDHEIGHT)) + if ((x >= LCDWIDTH) || (y >= LCDHEIGHT)) return; if (mode == XOR) @@ -1059,7 +1059,9 @@ uint8_t MicroOLED::getFontType(void) */ uint8_t MicroOLED::setFontType(uint8_t type) { - if ((type >= MAXFONTS) || (fontsPointer[type] == NULL)) + if (type >= MAXFONTS) + return false; + if (fontsPointer[type] == NULL) return false; fontType = type; @@ -1313,6 +1315,8 @@ void MicroOLED::drawBitmap(uint8_t *bitArray) //Use http://en.radzio.dxp.pl/bitmap_converter/ to generate output //Make sure the bitmap is n*8 pixels tall (pad white pixels to lower area as needed) //Otherwise the bitmap bitmap_converter will compress some of the bytes together +//TO DO: fix compiler warning re. iconHeight being unused. Maybe use it to check if +// the icon will fit on the screen? void MicroOLED::drawIcon(uint8_t offsetX, uint8_t offsetY, uint8_t iconWidth, uint8_t iconHeight, uint8_t *bitArray, uint8_t arraySizeInBytes, bool overwrite) { uint8_t columnNumber = offsetX; diff --git a/src/hardware.cpp b/src/hardware.cpp index 6fbad6d..47c8cfb 100644 --- a/src/hardware.cpp +++ b/src/hardware.cpp @@ -116,7 +116,7 @@ boolean MicroOLED::i2cWriteMultiple(uint8_t address, uint8_t *dataBytes, size_t while (bytesLeftToWrite > 0) { size_t bytesToWrite; // Limit bytesToWrite to i2cTransactionSize - if (bytesLeftToWrite > (i2cTransactionSize - 1)) + if (bytesLeftToWrite > ((size_t)i2cTransactionSize - 1)) bytesToWrite = i2cTransactionSize - 1; else bytesToWrite = bytesLeftToWrite;