Closed ghost closed 7 years ago
I can confirm this. Exactly the same here with recent RCBugfix.
Try this. Add to the function menu_action_sddirectory
:
lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
screen_changed = true;
I missed this as one of the instances where the screen changes, but the screen handler does not.
At least this:
@@ -2011,10 +2011,12 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(function, LCD_STR_REFRESH MSG_REFRESH, lcd_sd_refresh);
#endif
}
else {
MENU_ITEM(function, LCD_STR_FOLDER "..", lcd_sd_updir);
+ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
+ screen_changed = true;
}
for (uint16_t i = 0; i < fileCnt; i++) {
if (_menuLineNr == _thisItemNr) {
card.getfilename(
@@ -2462,10 +2464,12 @@ void kill_screen(const char* lcd_msg) {
void menu_action_sddirectory(const char* filename, char* longFilename) {
UNUSED(longFilename);
card.chdir(filename);
encoderPosition = 0;
+ lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT;
+ screen_changed = true;
}
#endif //SDSUPPORT
is needed.
But likely we have a misconception here. It's not the one or the other screen what changes to an other what should cause a screen update. Likely 'consuming' an input event is the true reason. Where input event is a encoder change, any button click or the timeout.
Now that I think about it, graphical displays continuously re-draw, so I'm not sure how we ever end up with only a partial update.
Nevermind — I see this is the character display.
@Blue-Marlin and @thinkyhead
Thanks for the preparing the solutions.
I've tested and confirmed just now that displaying looks normal with both REPRAP_DISCOUNT_SMART_CONTROLLER
and REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
.
https://github.com/esenapaj/Marlin/commit/ea1086f1352444809b6a9a6b58d21f2102273654
graphical displays continuously re-draw,
No. They don't! It's only the status screen what is refreshed once per second. The menus and everything else is drawn only once or twice or not enough. :-) - regardless if graphical or char displays.
static int8_t lcd_status_update_delay = 1; // first update one loop delayed
if (STATUS_UPDATE_CONDITION &&
#if ENABLED(ULTIPANEL)
currentScreen == lcd_status_screen && // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#endif
!lcd_status_update_delay--
) {
lcd_status_update_delay = 9;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; // !
}
And producing an input event is currently causing a redraw.
This is needed because the consuments are called during the first screen draw. To make the changes visible it needs the second one.
To not react twice on an event, it has to be actively consumed. What we do with encoderPosition = 0;
for example is active consumption and could be source for the second redraw.
Another problem occurs to me, @esenapaj.
The lcd_clicked
flag is currently cleared after drawing the whole screen on character displays, but on graphical displays it's cleared after drawing the first segment of the graphical screen. So my guess is that when you click on items in the lower half of the graphical screen, nothing will happen.
EDIT: Never mind. We handle events, only skip drawing.
Therefore we should clear lcd_clicked
here:
#define _MENU_ITEM_PART_1(TYPE, LABEL, ...) \
if (_menuLineNr == _thisItemNr) { \
if (lcdDrawUpdate) \
lcd_implementation_drawmenu_ ## TYPE(encoderLine == _thisItemNr, _lcdLineNr, PSTR(LABEL), ## __VA_ARGS__); \
if (lcd_clicked && encoderLine == _thisItemNr) { \
+ lcd_clicked = false;
And…
- #define CURRENTSCREEN() (*currentScreen)(), lcd_clicked = false
+ #define CURRENTSCREEN() (*currentScreen)()
It's not the one or the other screen what changes to an other what should cause a screen update.
True. The only thing the screen_changed
flag does is to cause the remainder of the menu to skip being drawn (saving only a few cycles in the case of the character display). And screen_changed
itself is reset at the start of each screen.
No. They don't!
Ach. You beat me to the correction.
my guess is that when you click on items in the lower half of the graphical screen, nothing will happen.
On a second look, it appears that we're only filtering drawing and not event handling. So I'm wrong here. All items will be handled in the first display stripe, but only items in the current stripe will be drawn.
An other nice trick to omit the execution of the second (3,4) stripe could be to fire a u8g.firstPage();
when we know the screen content has changed. Still experimenting.
fire a
u8g.firstPage();
when we know the screen content has changed
True. That would obviate the need for the redraw flag.
For the character display, I guess it's important to use LCDVIEW_CLEAR_CALL_REDRAW
when changing screens, so that shorter menus won't leave the previous menu items on the screen.
Thanks for the fixing, probably this issue can be closed.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
With latest RCBugFix, I realized that displaying of SD Card section looks like broken.
folder tree:
result:
REPRAP_DISCOUNT_SMART_CONTROLLER
test
folderConfiguration.h
```cpp /** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, seeConfiguration_adv.h
```cpp /** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, seeREPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
test
folderConfiguration.h
```cpp /** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, seeConfiguration_adv.h
```cpp /** * Marlin 3D Printer Firmware * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see