CHDK script - inconsistencies with ALT mode - General Discussion and Assistance - CHDK Forum

CHDK script - inconsistencies with ALT mode

  • 31 Replies
  • 7108 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
CHDK script - inconsistencies with ALT mode
« on: 08 / May / 2021, 05:28:55 »
Advertisements
Noticed the behaviour below while working on the screen refresh for Lua scripts.

Running scripts in and out of ALT mode has the following states:

1. Script is run from ALT mode via shutter press, script does not call exit_alt and user does not press ALT button
   - gui_handler = script handler
   - shutter button = ends script
   - ALT button = exit alt mode, script continues running
   - Other buttons = can be handled in script, not handled by CHDK or firmware

2. Script is started in ALT mode as per 1, script calls exit_alt() or user presses ALT button (script continues running)
   - gui_handler = default handler
   - ALT button = re-enters ALT mode
   - Other buttons = can be handled in script, also handled by firmware

3. Script is running in ‘default’ mode as per 2, script calls enter_alt()
   - returns to state 1

4. Script is running in ‘default’ mode as per 2, user presses ALT button
   - gui_handler = ALT mode handler
   - shutter button = kills running script then starts selected script immediately
   - ALT button = exit alt mode, script continues running
   - Other buttons = can be handled in script; but also handled by CHDK UI (e.g. Menu button can be processed in script and will also open CHDK menu)

I think state 4 should behave the same as state 3 and set the gui_handler to the script handler; but there might be a reason for the above behaviour that I am not aware of.

Any thoughts?


CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: CHDK script - inconsistencies with ALT mode
« Reply #1 on: 08 / May / 2021, 05:56:02 »
Phil

As you will see in my M3 feedback, I've noticed some strangeness going in and out of ALT mode, eg the script says started again.

My script, and others that I've played with, need to seamlessly move between ALT and non-ALT states with the script running.

In the non-ALT state the script needs to allow the camera to function as normal, ie take normal images etc.

FWIW my view is that the script should only be stopped/killed in ALT mode. If a script is running in non-ALT mode then you should not be able to kill a script running, unless it's a script decision, eg timeout.

The switch between ALT mode and non-ALT mode should be contiguous and seamless, albeit in ALT mode you can't take images via the full shutter press, ie this kills the script, and in non-ALT mode the camera functions as normal, ie full shutter press etc.

Cheers

Garry
« Last Edit: 08 / May / 2021, 06:35:41 by pigeonhill »

Re: CHDK script - inconsistencies with ALT mode
« Reply #2 on: 08 / May / 2021, 10:34:46 »
I think state 4 should behave the same as state 3 and set the gui_handler to the script handler; but there might be a reason for the above behaviour that I am not aware of.  Any thoughts?
I believe @reyalp 's usual advice is that many scripted actions when the camera is not in <ALT> mode are indeterminate? Still, you can do some fun things doing just that. But I can't recall seeing many published scripts that do much outside of <ALT> mode.

So I agree with your suggestion.  Making camera actions consistent and reproducible is important.  Having the <ALT> button work differently from enter_alt( ) and exit_alt( ) is not consistent.  I can't think of anything that would break if this was cleaned up and it might make debugging of scripting outside of <ALT> mode easier

« Last Edit: 08 / May / 2021, 11:04:02 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Caefix

  • *****
  • 948
  • Sorry, busy deleting test shots...
Re: CHDK script - inconsistencies with ALT mode
« Reply #3 on: 08 / May / 2021, 11:03:45 »
Using <alt> key is different from exit_alt().  :P
My approach for scripts prepared for swapping is: exitalt()...
https://chdk.setepontos.com/index.php?topic=14309.msg145652#msg145652
All lifetime is a loan from eternity.

Re: CHDK script - inconsistencies with ALT mode
« Reply #4 on: 08 / May / 2021, 11:22:17 »
@waterwingz

You said

Quote
But I can't recall seeing many published scripts that do much outside of <ALT> mode.

I may be misinterpreting what you are say, however, doing stuff outside of ALT mode is at the centre of my M3 bracketing script, eg getting DoF feedback, telling you when you have arrived at the next focus position, keeping track of exposure changes etc

Cheers

Garry

Re: CHDK script - inconsistencies with ALT mode
« Reply #5 on: 08 / May / 2021, 11:42:58 »
I may be misinterpreting what you are say, however, doing stuff outside of ALT mode is at the centre of my M3 bracketing script, eg getting DoF feedback, telling you when you have arrived at the next focus position, keeping track of exposure changes etc
@philmoz 's original question is essentially about breaking existing scripts if he changes the <ALT> key behaviour when a script is running.  I was just commenting that not many  (none?) published scripts use that "feature".  I should have added "except @pigeonhill" but as you were already participating in this discussion I didn't.   ;)
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK script - inconsistencies with ALT mode
« Reply #6 on: 08 / May / 2021, 11:50:05 »
 :D

Shock/horror, am I really the only one using the ALT/non-ALT functionality?

BTW IMHO the M3 is CHDK’s equivalent of ML’s 5D3. That is the camera with the highest IQ and an APS-C sensor etc. I’m so pleased that the CHDK gurus, like you, @philmoz and @reyalp have put so much effort into this ‘flagship’ camera. As I say, IMHO  ;)

With the latest display experiments, it’s a real pleasure to use the M3, with its real-time DoF and focus bracketing feedback, and all flicker free, well nearly  ;)

Cheers

Garry

Re: CHDK script - inconsistencies with ALT mode
« Reply #7 on: 08 / May / 2021, 12:09:36 »
The broader question might be whether anyone has done anything dependent on the behaviour of enter_alt(  ) being diffferent than pressing the <ALT> key when a script is running outside of <ALT> mode?  I don't think so FWIW.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: CHDK script - inconsistencies with ALT mode
« Reply #8 on: 08 / May / 2021, 12:20:02 »
@waterwingz

I think this conversation says more about my CHDK ignorance.

In ML scripts always run outside of ALT mode, ie there is no ALT mode, other than by hijacking one button to access ML’s menu.

For whatever reason, and this is my ignorance, in CHDK we must start a script in ALT mode, where access to camera functionality is limited.

So I guess the question, to address my ignorance, is, does CHDK require to start a script in ALT mode, or is it a legacy matter, ie CHDK scripts could be allowed to start outside of ALT mode, ie running in the background.

Cheers

Garry
« Last Edit: 08 / May / 2021, 12:28:47 by pigeonhill »

Re: CHDK script - inconsistencies with ALT mode
« Reply #9 on: 08 / May / 2021, 13:23:53 »
@waterwingz
For whatever reason, and this is my ignorance, in CHDK we must start a script in ALT mode, where access to camera functionality is limited.

So I guess the question, to address my ignorance, is, does CHDK require to start a script in ALT mode, or is it a legacy matter, ie CHDK scripts could be allowed to start outside of ALT mode, ie running in the background.
I suspect @reyalp can provide a better answer here but it's my understanding that CHDK runs scripts in ALT mode to provide a controlled environment.  The various key functions are disconnected from the camera's firmware and thus fully available to the script.  This also stops the camera firmware from shooting - which is normally what you want when running a script.

I'm not sure I understand what camera functionality you find to be limited when you run a script in <ALT> mode?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal