Merge pull request #561 from Brendan-csel/Marlin_v1

Fix for Viki LCD issues printing from SD card
This commit is contained in:
ErikZalm 2013-07-29 10:38:17 -07:00
commit bdc2621119

View file

@ -96,6 +96,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
if (encoderPosition > 0x8000) encoderPosition = 0; \ if (encoderPosition > 0x8000) encoderPosition = 0; \
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\ if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \ uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
bool wasClicked = LCD_CLICKED;\
for(uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \ for(uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
_menuItemNr = 0; _menuItemNr = 0;
#define MENU_ITEM(type, label, args...) do { \ #define MENU_ITEM(type, label, args...) do { \
@ -108,7 +109,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \ lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
}\ }\
}\ }\
if (LCD_CLICKED && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) {\ if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) {\
lcd_quick_feedback(); \ lcd_quick_feedback(); \
menu_action_ ## type ( args ); \ menu_action_ ## type ( args ); \
return;\ return;\
@ -694,6 +695,8 @@ static void lcd_sd_updir()
void lcd_sdcard_menu() void lcd_sdcard_menu()
{ {
if (lcdDrawUpdate == 0 && LCD_CLICKED == 0)
return; // nothing to do (so don't thrash the SD card)
uint16_t fileCnt = card.getnrfilenames(); uint16_t fileCnt = card.getnrfilenames();
START_MENU(); START_MENU();
MENU_ITEM(back, MSG_MAIN, lcd_main_menu); MENU_ITEM(back, MSG_MAIN, lcd_main_menu);