sparkfun / SparkFun_SerLCD_Arduino_Library

A library to seamlessly control the SparkFun SerLCD over I2C, SPI, and Serial.
MIT License
23 stars 10 forks source link

Explicitly cast numeric literals to type byte to avoid ESP32 and ESP8266 compile errors #8

Closed fourstix closed 4 years ago

fourstix commented 4 years ago

This is the correct pull request to merge. It only changes one file with the fixed lines. An incorrect comment line is also moved.

This is a fix for issue #6. The ESP32 and ESP8266 code uses templates to define the min/max function. This causes a compile error because the numerical literals are of implicit type (int) being compared to a byte parameter.

Even though the types are compatible, this type mismatch causes a compile error in the template used to define the min/max function in the ESP32 and ESP8266 code.

This fix explicitly casts the numeric literals in min() and max() to type (byte) and eliminate the compile error. The incorrect comment is removed.

fourstix commented 4 years ago

This pull request contains the fix, and removes the comment with the incorrect return type.

nseidle commented 4 years ago

Thanks for this! Makes sense.