From 480a27cd34a0ae22d118cb079a92f603d6319ab5 Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Thu, 23 Mar 2023 11:39:03 +0300 Subject: [PATCH] Fix a very long standing bug with cursor decoding. --- include/lcd.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/include/lcd.h b/include/lcd.h index 70583a4..72e24e8 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -221,12 +221,11 @@ int lcdWrite(lcdDriver_t *driver, uint8_t data); */ #define LCD_DECODE_CURSOR(driver)\ ((driver)->cursor.x + /* Base position */\ - ((driver)->dimensions.height > 2) * /* If the display has more than 2 lines. */\ - ( \ - 64 * ((driver)->cursor.y % 2) + /* Add 64 if the row is even */\ - (driver)->dimensions.width * ((driver)->cursor.y >= 2) /* Add width if the row is the last two. */\ - ) \ - ) + ( \ + 64 * ((driver)->cursor.y % 2) + /* Add 64 if the row is even */\ + (driver)->dimensions.width * ((driver)->cursor.y >= 2) /* Add width if the row is the last two. */\ + ) \ + ) // #include // inline static uint8_t _LCD_DECODE_CURSOR(lcdDriver_t* driver) { // uint8_t value = LCD_DECODE_CURSOR(driver);