One annoying feature of CHDK, that seems to be fairly common, is the occasional vanishing act done by the menu display.
On the G12 and SX30 I assumed this was due to the camera firmware refreshing the display and CHDK not knowing about it - this seemed to happen most often in record mode.
On the IXUS 310 this problem is even more of an issue because the CHDK buttons are also on screen - if they disappear it makes it a bit hard to control.
So I implemented a simple system to set the top left pixel of the screen bitmap to a known value and then test the value each time gui_redraw is called. If the pixel has changed then I force the touchscreen buttons and menu to redraw.
This worked quite well (so long as there are no CHDK OSD elements in the top left corner); but the darn menu still randomly disappears.
After working through the menu code (ugh! serious overhaul needed here) I think I've figured out this second cause of the menu vanishing.
Basically the menu system is built around two functions 'gui_menu_kbd_process' which handles the button presses and is called in the kbd task, and 'gui_menu_draw' which is called from gui_redraw in the spytask task.
Unfortunately these two aren't cleanly seperated and 'gui_menu_kbd_process' does a lot of screen erasing and redrawing. It attempts to synchronise with 'gui_menu_draw' through the gui_menu_redraw and gui_restore variables; but in some cases this fails and gui_menu_kbd_process ends up erasing the menu after it has been drawn and forgetting to tell gui_menu_draw to redraw it.
I've come up with a workaround to this problem that works on the G12, SX30 and IXUS 310; but I want to make sure it works more widely before submitting a patch.
To see if the problem affects your camera try this:
- enter ALT mode (in playback mode on the camera) and open the menu
- scroll down to the Miscellaneous stuff menu
- repeatedly press Set to enter the misc stuff menu followed by Disp to go back to the top menu
The firmware doesn't seem to refresh the screen very often in playback mode which makes it easier to test for this problem.
If during the above the menu vanishes occasionally then try the fix below and retest. If this helps please report back here.
The following changes are needed.
gui_menu.h - add the following at the end
extern void gui_menu_force_redraw();
gui_menu.c - add the following function
void gui_menu_force_redraw()
{
if (gui_get_mode() == GUI_MODE_MENU)
{
gui_menu_redraw=2;
}
}
gui.c - change the code at the end of gui_redraw to the following (one line added)
gui_in_redraw = 0;
if ((gui_mode_old != gui_mode && (gui_mode_old != GUI_MODE_NONE && gui_mode_old != GUI_MODE_ALT) && (gui_mode != GUI_MODE_MBOX && gui_mode != GUI_MODE_MPOPUP)) || gui_restore) {
if (gui_restore) gui_menu_force_redraw();
gui_restore = 0;
if (gui_mode != GUI_MODE_REVERSI && gui_mode != GUI_MODE_SOKOBAN && gui_mode != GUI_MODE_4WINS && gui_mode != GUI_MODE_MASTERMIND)
draw_restore();
}
What this is doing is, at the end of gui_redraw, if qui_restore is set it means that gui_menu_kbd_process wants to refresh the menu. The call to gui_menu_force_redraw will force the menu to get redrawn next time round.
Phil.