Skip to content

Commit d8f4b77

Browse files
authored
Merge pull request #8 from fourstix/master
Explicitly cast numeric literals to type byte to avoid ESP32 and ESP8266 compile errors
2 parents 137254f + e17355d commit d8f4b77

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/SerLCD.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,15 @@ void SerLCD::home()
337337
* column - byte 0 to 19
338338
* row - byte 0 to 3
339339
*
340-
* returns: boolean true if cursor set.
341340
*/
342341
void SerLCD::setCursor(byte col, byte row)
343342
{
344343
int row_offsets[] = {0x00, 0x40, 0x14, 0x54};
345344

346345
//kepp variables in bounds
347-
row = max(0, row); //row cannot be less than 0
348-
row = min(row, MAX_ROWS - 1); //row cannot be greater than max rows
346+
//Explicitly cast numeric literals to type byte to avoid ESP32 and ESP8266 compile errors
347+
row = max((byte) 0, row); //row cannot be less than 0
348+
row = min(row, (byte)(MAX_ROWS - 1)); //row cannot be greater than max rows
349349

350350
//send the command
351351
specialCommand(LCD_SETDDRAMADDR | (col + row_offsets[row]));

0 commit comments

Comments
 (0)