ThingPulse / esp8266-oled-ssd1306

Driver for the SSD1306 and SH1106 based 128x64, 128x32, 64x48 pixel OLED display running on ESP8266/ESP32
https://thingpulse.com
Other
2.03k stars 643 forks source link

Library compilation errors #140

Closed G6EJD closed 6 years ago

G6EJD commented 7 years ago

I get: esp8266-oled-ssd1306-master/OLEDDisplay.h:253:29: error: no return statement in function returning non-void [-Werror=return-type] virtual bool connect() {};

Needs a return statement adding to close off the compiler error

SH1106Wire.h:90:23: warning: comparison is always false due to limited range of data type [-Wtype-limits] if (minBoundY == ~0) return;

The second is probably a typo and should be '!=' as I can find no reference to the '~=' operator.

vshymanskyy commented 6 years ago

Confirm. This is reproducible only if Arduino IDE config "Compiler Warnings" is set to More or All

dsptech commented 6 years ago

Same issue here. minBoundY is a uint8_t uint8_t minBoundY = ~0, meanwhile "~0" is assumed as int instead. The right way to perform the check is: if (minBoundY == (uint8_t) ~0) return;

lorol commented 6 years ago

Maybe it is good to replace all 18 hits in library' *.h files from "= ~0" to "= (uint8_t) ~0" since they always refer the 8bit unsigned minBoundY or minBoundX

dsptech commented 6 years ago

A such typecast is already done in every assignment so there is no need to apply changes here, but every check minBoundY == ~0 (6 hits ?) will fail in it's purpose (even if only a warning is generated) due the integral promotion. The typecast in every check is needed. I think that a more polite way is to change every occurrence of "~0" with UCHAR_MAX (or similar define), so, every integral promotion issue will be avoided.