We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 137254f + e17355d commit d8f4b77Copy full SHA for d8f4b77
src/SerLCD.cpp
@@ -337,15 +337,15 @@ void SerLCD::home()
337
* column - byte 0 to 19
338
* row - byte 0 to 3
339
*
340
- * returns: boolean true if cursor set.
341
*/
342
void SerLCD::setCursor(byte col, byte row)
343
{
344
int row_offsets[] = {0x00, 0x40, 0x14, 0x54};
345
346
//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
+ //Explicitly cast numeric literals to type byte to avoid ESP32 and ESP8266 compile errors
+ row = max((byte) 0, row); //row cannot be less than 0
+ row = min(row, (byte)(MAX_ROWS - 1)); //row cannot be greater than max rows
349
350
//send the command
351
specialCommand(LCD_SETDDRAMADDR | (col + row_offsets[row]));
0 commit comments