From 15d29efad506bfd4351b6060d09fe09663074fe2 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 19 Mar 2015 13:40:36 -0700 Subject: [PATCH] Pass sel to lcd_implementation_mark_as_selected - Pass selected state directly to lcd_implementation_mark_as_selected - Rename sel function parameter - Include a minor fix for SdBaseFile.h --- Marlin/SdBaseFile.h | 4 ++-- Marlin/dogm_lcd_implementation.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/SdBaseFile.h b/Marlin/SdBaseFile.h index b0e77ecb48..dea299a646 100644 --- a/Marlin/SdBaseFile.h +++ b/Marlin/SdBaseFile.h @@ -171,9 +171,9 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) { return 2*(fatTime & 0X1F); } /** Default date for file timestamps is 1 Jan 2000 */ -uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | BIT(5) | 1; +uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1; /** Default time for file timestamp is 1 am */ -uint16_t const FAT_DEFAULT_TIME = BIT(11); +uint16_t const FAT_DEFAULT_TIME = (1 << 11); //------------------------------------------------------------------------------ /** * \class SdBaseFile diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h index 83c3b3f2b0..ff63fe126a 100644 --- a/Marlin/dogm_lcd_implementation.h +++ b/Marlin/dogm_lcd_implementation.h @@ -282,8 +282,8 @@ static void lcd_implementation_status_screen() { #endif } -static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { - if (pr_char != ' ') { +static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) { + if (isSelected) { u8g.setColorIndex(1); // black on white u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); u8g.setColorIndex(0); // following text must be white on black @@ -294,11 +294,11 @@ static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT); } -static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) { +static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) { char c; uint8_t n = LCD_WIDTH - 2; - lcd_implementation_mark_as_selected(row, sel ? pre_char : ' '); + lcd_implementation_mark_as_selected(row, isSelected); while ((c = pgm_read_byte(pstr))) { u8g.print(c); @@ -310,11 +310,11 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha u8g.print(' '); } -static void _drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, const char* data, bool pgm) { +static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) { char c; uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data))); - lcd_implementation_mark_as_selected(row, sel ? '>' : ' '); + lcd_implementation_mark_as_selected(row, isSelected); while ((c = pgm_read_byte(pstr))) { u8g.print(c); @@ -379,7 +379,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) { u8g.print(value); } -static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) { +static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) { char c; uint8_t n = LCD_WIDTH - 1; @@ -388,7 +388,7 @@ static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* fi longFilename[n] = '\0'; } - lcd_implementation_mark_as_selected(row, sel ? '>' : ' '); + lcd_implementation_mark_as_selected(row, isSelected); if (isDir) u8g.print(LCD_STR_FOLDER[0]); while ((c = *filename)) {