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
master
Scott Lahteine 10 years ago
parent a547dc2148
commit 15d29efad5

@ -171,9 +171,9 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) {
return 2*(fatTime & 0X1F); return 2*(fatTime & 0X1F);
} }
/** Default date for file timestamps is 1 Jan 2000 */ /** 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 */ /** 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 * \class SdBaseFile

@ -282,8 +282,8 @@ static void lcd_implementation_status_screen() {
#endif #endif
} }
static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) { static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
if (pr_char != ' ') { if (isSelected) {
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT); u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
u8g.setColorIndex(0); // following text must be white on black 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); 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; char c;
uint8_t n = LCD_WIDTH - 2; 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))) { while ((c = pgm_read_byte(pstr))) {
u8g.print(c); u8g.print(c);
@ -310,11 +310,11 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha
u8g.print(' '); 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; char c;
uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data))); 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))) { while ((c = pgm_read_byte(pstr))) {
u8g.print(c); u8g.print(c);
@ -379,7 +379,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
u8g.print(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; char c;
uint8_t n = LCD_WIDTH - 1; 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'; 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]); if (isDir) u8g.print(LCD_STR_FOLDER[0]);
while ((c = *filename)) { while ((c = *filename)) {

Loading…
Cancel
Save