[WIP - camera.gui] GUI state triaging

Started by garry23, May 19, 2017, 04:56:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

garry23

@A1ex/@dmilligan

I've hit a final challenge in my focus bar script.

I wish to switch off the focus bar (eg switch of the display) if the ML menu is showing or the Canon Menu. I seem to be able to do this with the following snippet:

if (menu.visible or camera.state ~= 0) or (not showing) then -- don't show bar'
        if not hidden then
            display.clear()
        end
            hidden = true -- now hidden so don't need to keep hiding'
    else
            hidden = false -- show the focus bar


The variable 'showing' is a one of the focus bar inputs, ie to turn on or off the focus bar.

So far, so good.

What I can't seem to do is work out how to detect various other GUI state, eg I would like to switch the focus bar off if the user is using one (or all) the info screens, ie not just the Menu screens (Canon and ML).

I've looked into the source code but can't seem to see the info I'm after, eg the GUI state codes.

Would the above be possible...and, of course, how ;-)

Cheers

Garry


dmilligan

From the Lua docs:
QuoteGet the current Canon GUI state of the camera (PLAY, QR etc; see gui-common.h)
gui_common.h (starts at line 180)

a1ex

That would only give info about "major" GUI changes on Canon's side (and the constants are model-dependent, though pretty much compatible across DIGIC 4 and 5 models). Small dialogs (such as ISO) are not covered here.

For the latter, I use display_idle(). In Lua, this is exposed as display.idle(), although these should be probably all grouped into some sort of GUI routines (along with SetGUIRequestMode, for example) and abstract some model-specific differences. That's where the GUI emulation in QEMU is going to be useful.

garry23

@A1ex/@dmilligan

Thanks for the info.

I had already convinced myself, by looking at the common.h, that GUI state was not sufficient.

I'll look into the other stuff.

Cheers

Garry

garry23

@A1ex

My knowledge has let me down, ie how to use display.idle()

I get an error regarding calling a Boolean.

My test snippet of code looks like this:

if display.idle() then
    display.print("AAA", 100, 100, FONT.MEDIUM ,COLOR.WHITE,COLOR.BLACK)
else
    display.print("BBB", 100, 100, FONT.MEDIUM ,COLOR.WHITE,COLOR.BLACK)
end


Any insight would be appreciated, ie why do I get an error?

dmilligan


garry23

 :o

@dmilligan thanks  :-[

Unfortunately it doesn't help me.

All display.idle dose is detect the MENU change state, not the INFO.

Oh well, I just have to live with the focus bar being on when INFO used.

Cheers and thanks for your help.

Garry

a1ex

Quote from: a1ex on May 19, 2017, 08:27:15 PM
... these should be probably all grouped into some sort of GUI routines (along with SetGUIRequestMode, for example) and abstract some model-specific differences.

Proof of concept is ready; further suggestions welcome.

Jip-Hop

garry23 were you eventually able to distinguish the Canon INFO screen from the Canon MENU?

I want to do some stuff when not in the PLAY screen and not in the Canon MENU. But gui.menu == true also in the INFO screen and lv.enabled == false is also the case when on the INFO screen...

I want my function to also be active on the INFO screen, but not in MENU or PLAY.

a1ex

Quote from: Jip-Hop on July 09, 2019, 07:05:42 PM
But gui.menu == true also in the INFO screen and lv.enabled == false is also the case when on the INFO screen...

Really? How does this INFO screen look like?

If it's the photo mode interface (i.e. this), that's outside LiveView (lv.enabled == false) and "idle", i.e. outside menus (camera.gui.idle == true). On EOS M, you will need a build with changeset 085b79c included (e.g. latest lua_fix).

If it's the screen that shows free space and a bunch of other settings (i.e. this), that's codenamed GUISTATE_MENUDISP, and I don't remember exposing it to Lua, but it definitely shouldn't be misinterpreted as "menu".

For troubleshooting, a minimal working example is best.

Jip-Hop

Thanks again for the advice!

It's the photo mode interface but my EOS M is set to video mode.

I think I found the culprit.

-- INFO key menu
-- Use INFO button to toggle RAW video preferences

event.keypress = function(k)
    if lv.enabled == false and camera.gui.idle == true then
        display.notify_box("INFO screen");
    else
        display.notify_box("Other screen");
    end
    return true;
end


It still wouldn't work with this simple example.
But it would briefly flash INFO screen and then Other screen.
I had to disable "Feature guide" in the Canon menu, because it would pop-up an explanation of the selected setting at the INFO screen.
So it wouldn't pass the test in the script.
Now with that setting disabled I think I can reliably test for that screen.

I'm trying to open a custom ML menu in between each time the screen switches when pressing the INFO button. But it's giving me all sorts of trouble.

Is there instead a direct way to activate from Lua this INFO screen, the Canon Live View screen and the LV screen with ML overlays?

If I set camera.gui.mode to 21 then I get into the INFO screen. But didn't find modes for the other LV screens, and also no way to get back to the LV with ML overlays because they're all identified with camera.gui.mode == 0.

a1ex

Quote from: Jip-Hop on July 09, 2019, 08:01:55 PM
Is there instead a direct way to activate from Lua this INFO screen, the Canon Live View screen and the LV screen with ML overlays?

That should be lv.stop() and lv.start(). On DSLRs, these will go out of LiveView (i.e. in photo mode) and back. On EOS M, for consistency, these will go to the info screen (i.e. GUI mode 21, which is outside LiveView) and back to LiveView.

Edit: I think I see the issue - there's no guarantee lv.start() will go back to the same screen...

QuoteBut didn't find modes for the other LV screens

You could try 93 and 99 - these two are used behind ML menu, i.e. GUIMODE_ML_MENU. Other LiveView screens are nearby. However, these refer to "modal" dialog boxes on top of LiveView, such as the dialog for changing picture style. They don't refer to the screens cycled by the INFO key.

Quoteand also no way to get back to the LV with ML overlays because they're all identified with camera.gui.mode == 0.

This one is covered by lv.overlays (it returns 2 when ML overlays are enabled). In my test, I've just "pressed" INFO to cycle the screen until reaching the one I wanted. I'm not aware of other methods to force a particular screen from the "info" cycle...

Reference code for these functions: api_test.lua (test_camera_gui, test_lv and test_ml_overlays).