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 10 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
   return 2*(fatTime & 0X1F);
171
   return 2*(fatTime & 0X1F);
172
 }
172
 }
173
 /** Default date for file timestamps is 1 Jan 2000 */
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
 /** Default time for file timestamp is 1 am */
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
  * \class SdBaseFile
179
  * \class SdBaseFile

+ 8
- 8
Marlin/dogm_lcd_implementation.h View File

282
   #endif
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
     u8g.setColorIndex(1);  // black on white
287
     u8g.setColorIndex(1);  // black on white
288
     u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
288
     u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
289
     u8g.setColorIndex(0);  // following text must be white on black
289
     u8g.setColorIndex(0);  // following text must be white on black
294
   u8g.setPrintPos(START_ROW * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
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
   char c;
298
   char c;
299
   uint8_t n = LCD_WIDTH - 2;
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
   while ((c = pgm_read_byte(pstr))) {
303
   while ((c = pgm_read_byte(pstr))) {
304
     u8g.print(c);
304
     u8g.print(c);
310
   u8g.print(' ');
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
   char c;
314
   char c;
315
   uint8_t n = LCD_WIDTH - 2 - (pgm ? lcd_strlen_P(data) : (lcd_strlen((char*)data)));
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
   while ((c = pgm_read_byte(pstr))) {
319
   while ((c = pgm_read_byte(pstr))) {
320
     u8g.print(c);
320
     u8g.print(c);
379
   u8g.print(value);
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
   char c;
383
   char c;
384
   uint8_t n = LCD_WIDTH - 1;
384
   uint8_t n = LCD_WIDTH - 1;
385
 
385
 
388
     longFilename[n] = '\0';
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
   if (isDir) u8g.print(LCD_STR_FOLDER[0]);
393
   if (isDir) u8g.print(LCD_STR_FOLDER[0]);
394
   while ((c = *filename)) {
394
   while ((c = *filename)) {

Loading…
Cancel
Save