fourstix / QwiicSerLCD

Version of Arduino LiquidCrystal Library for Sparkfun Serial Enabled LCD with a Qwiic Adapter
MIT License
1 stars 14 forks source link

ESP won't compile calls to min/max because of type mis-match #22

Closed fourstix closed 3 years ago

fourstix commented 4 years ago

This issue was opened in Sparkfun's code. Sparkfun issue #6

ESP32/ ESP8266 code won't compile with this library because the min/max functions are described in templates that require explicit type matching.

The fix is to case any numerals in the min/max function calls to byte to match the passed in parameter.

fourstix commented 4 years ago

Duplicated the error by compiling original code for Sparkfun Thing ESP8266 board. Here is error message:

SerLCD.cpp:349:30: note: deduced conflicting types for parameter 'const _Tp' ('unsigned char' and 'int') row = min(row, MAX_ROWS - 1); //row cannot be greater than max rows ^ Type byte is unsigned char and MAX_ROWS-1 is a numeric literal with implied type int. I will replace the code with: row = min(row, (byte) (MAX_ROWS - 1)); //row cannot be greater than max rows

fourstix commented 4 years ago

Fix has been tested locally. Promoting fix to library.

fourstix commented 3 years ago

Closing fixed issue.