Browse Source

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
Scott Lahteine 9 years ago
parent
commit
15d29efad5
2 changed files with 10 additions and 10 deletions
  1. 2
    2
      Marlin/SdBaseFile.h
  2. 8
    8
      Marlin/dogm_lcd_implementation.h

+ 2
- 2
Marlin/SdBaseFile.h View File

@@ -171,9 +171,9 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) {
171 171
   return 2*(fatTime & 0X1F);
172 172
 }
173 173
 /** Default date for file timestamps is 1 Jan 2000 */
174
-uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | BIT(5) | 1;
174
+uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
175 175
 /** Default time for file timestamp is 1 am */
176
-uint16_t const FAT_DEFAULT_TIME = BIT(11);
176
+uint16_t const FAT_DEFAULT_TIME = (1 << 11);
177 177
 //------------------------------------------------------------------------------
178 178
 /**
179 179
  * \class SdBaseFile

+ 8
- 8
Marlin/dogm_lcd_implementation.h View File

@@ -282,8 +282,8 @@ static void lcd_implementation_status_screen() {
282 282
   #endif
283 283
 }
284 284
 
285
-static void lcd_implementation_mark_as_selected(uint8_t row, char pr_char) {
286
-  if (pr_char != ' ') {
285
+static void lcd_implementation_mark_as_selected(uint8_t row, bool isSelected) {
286
+  if (isSelected) {
287 287
     u8g.setColorIndex(1);  // black on white
288 288
     u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
289 289
     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) {
294 294
   u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
295 295
 }
296 296
 
297
-static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
297
+static void lcd_implementation_drawmenu_generic(bool isSelected, uint8_t row, const char* pstr, char pre_char, char post_char) {
298 298
   char c;
299 299
   uint8_t n = LCD_WIDTH - 2;
300 300
 
301
-  lcd_implementation_mark_as_selected(row, sel ? pre_char : ' ');
301
+  lcd_implementation_mark_as_selected(row, isSelected);
302 302
 
303 303
   while ((c = pgm_read_byte(pstr))) {
304 304
     u8g.print(c);
@@ -310,11 +310,11 @@ static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const cha
310 310
   u8g.print(' ');
311 311
 }
312 312
 
313
-static void _drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, const char* data, bool pgm) {
313
+static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const char* pstr, const char* data, bool pgm) {
314 314
   char c;
315 315
   uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
316 316
 
317
-  lcd_implementation_mark_as_selected(row, sel ? '>' : ' ');
317
+  lcd_implementation_mark_as_selected(row, isSelected);
318 318
 
319 319
   while ((c = pgm_read_byte(pstr))) {
320 320
     u8g.print(c);
@@ -379,7 +379,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
379 379
   u8g.print(value);
380 380
 }
381 381
 
382
-static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) {
382
+static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) {
383 383
   char c;
384 384
   uint8_t n = LCD_WIDTH - 1;
385 385
 
@@ -388,7 +388,7 @@ static void _drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* fi
388 388
     longFilename[n] = '\0';
389 389
   }
390 390
 
391
-  lcd_implementation_mark_as_selected(row, sel ? '>' : ' ');
391
+  lcd_implementation_mark_as_selected(row, isSelected);
392 392
 
393 393
   if (isDir) u8g.print(LCD_STR_FOLDER[0]);
394 394
   while ((c = *filename)) {

Loading…
Cancel
Save