shooting script using Canon basic ?

  • 42 Replies
  • 19390 Views
Re: shooting script using Canon basic ?
« Reply #30 on: 21 / September / 2018, 04:39:10 »
Advertisements
Since the "propset" (see propset*.h here) of the M6 is not known, finding that out is going to be the next move. Knowing the correct propcase numbers is essential for applying overrides.

...do you use peek to get a propcase?  do you need to offset the value?

as a minimum do you need the following?
Code: [Select]
PROPCASE_AV2,PROPCASE_AV,PROPCASE_MIN_AV,PROPCASE_USER_AV,PROPCASE_TV2,PROPCASE_TV,PROPCASE_USER_TV

*

Offline srsa_4c

  • ******
  • 3728
Re: shooting script using Canon basic ?
« Reply #31 on: 21 / September / 2018, 18:34:10 »
...do you use peek to get a propcase?  do you need to offset the value?
No, not peek. The GetPropertyCase and SetPropertyCase event procedures on your cam. I wrapped them in camspec.m (set_prop, get_prop).
Offset: probably not.
The override routines are mostly in core/shooting.c .
I did not check all overrides, just Tv for now, see set_tv96 in camspec.m (I put the M10 propcases there, you'll need to fix them) .

camspec.m:
Code: [Select]
' camera specific plugin
' m6 100b

public sub check_compat()
    if Peek16(0xe1f20270) = 0x32c5 then
        check_compat = 1
    else
        check_compat = 0
    end if
end sub

public sub get_shf_gen()
    ' camera has the newer ssfs eventprocs
    get_shf_gen=1
end sub

public sub get_cam_keys(set,menu,up,down,halfshoot,hotkey)
    ' these are the Press* event codes from the levent-table
    *set = 0x85a
    *menu = 0x82a
    *up = 0x824
    *down = 0x826
    *halfshoot = 0x9a1
    *hotkey = 0x840 ' DISP aka INFO
end sub

public sub camspec_init()
end sub

public sub get_uiprop(id)
    if id>0xe7 then ' see @E025DC82 in 100b
        ' ID is over limit, letting it through would crash the camera
        get_uiprop = -1
    else
        get_uiprop = PTM_GetCurrentItem(0x8000+id) ' registered by UI.CreatePublic
        if get_uiprop>32767 then
            get_uiprop = get_uiprop - 65536
        end if
    end if
end sub

public sub get_prop(id,buf,len)
    get_prop = GetPropertyCase(id,len) ' registered by System.Create
    *buf = get_prop
end sub

private sub set_prop(id,buf,len)
    set_prop = SetPropertyCase(id,buf,len) ' registered by System.Create
end sub

public sub set_tv96(val)   '
    set_prop(276, &val, 2) ' PROPCASE_TV
    set_prop(275, &val, 2) ' PROPCASE_TV2, see @E00F06C8 in 100b (UIFS_GetCurrentTvString)
end sub

Attached is a propcase research tool. It can either list propcases or alternatively it can show the difference between two propcase "snapshots".
edit:
Updated version attached. It now supports "UI properties" too (list and diff mode).

Basic howto for the script:
When it starts, it shows propcases starting from 0.
The script's menu can be entered by holding the MENU button for longer (1 sec). This may require multiple tries because the script doesn't always get all button events. The MENU button events are always passed on to the Canon interface, so the button will enter and exit the Canon menu.
When the script's menu (ALT mode) is active, most camera buttons will have no effect. For the camera to respond normally to buttons and switches, exit the script's menu by holding MENU or half pressing the shutter.
The script's menu can be navigated with the UP and DOWN buttons. The SET button can be used to execute (or modify) a menu entry.
The first menu entry selects the operating mode (prop list, prop diff, uiprop list, uiprop diff). The second and third entries can be used to navigate in list modes. The fourth entry selects the hotkey's mode, the fifth entry is for taking a snapshot (and initiate comparing) in diff modes.
The hotkey (should be the INFO button on the M6) can be used to navigate, or to make a snapshot when in diff mode. It can also be set to "bypass" in the script menu, in which case it will fullfill its original function.
« Last Edit: 22 / September / 2018, 14:29:40 by srsa_4c »

*

Offline srsa_4c

  • ******
  • 3728
Re: shooting script using Canon basic ?
« Reply #32 on: 22 / September / 2018, 14:39:48 »
I have updated the propcase/uiprop research script.

Exposure related stuff follows.
Explanation of APEX values: http://dougkerr.net/Pumpkin/articles/APEX.pdf
The firmware uses APEX96 values which are APEX values multiplied by 96.
I think I have identified the Tv propcases on M6:
PROPCASE_TV = 276
PROPCASE_TV2 = 275
That's propset10 + 2, should simplify the identification of other propcases.
I found the propcase references in the UIFS_GetCurrentTvString eventproc.

*

Offline srsa_4c

  • ******
  • 3728
Re: shooting script using Canon basic ?
« Reply #33 on: 03 / October / 2018, 18:00:02 »
Here's a (demo) script that does the following:
- A "hot key" is used to enter/exit the script's menu (ALT mode). That button is exclusively used by to the script, the camera won't see it (except for cases where the script fails to catch it).
- The first 3 menu entries have shooting functions defined:
 - Shoot 1 (shoots a single picture using button events)
 - Shoot 3 Tv br (shoots 3 pictures, second and third picture are shot with 2x and 4x exposure time)
 - Shoot 3 Sv br (3 pictures are shot, second with 2x ISO, third with 4x ISO)

Menu entries are activated by pressing SET. Menu can be left using the hot key or half press. Battery voltage is displayed in the last row.

camspec.m for M6
Code: [Select]
' camera specific plugin
' m6 100b

public sub check_compat()
    if Peek16(0xe1f20270) = 0x32c5 then
        check_compat = 1
    else
        check_compat = 0
    end if
end sub

public sub get_shf_gen()
    ' camera has the newer ssfs eventprocs
    get_shf_gen=1
end sub

public sub get_cam_keys(set,menu,up,down,halfshoot,hotkey,nhotkey)
    ' these are the Press* event codes from the levent-table
    *set = 0x85a
    *menu = 0x82a
    *up = 0x824
    *down = 0x826
    *halfshoot = 0x9a1
    *hotkey = 0x840 ' DISP aka INFO
    *nhotkey = "INFO"
end sub

public sub camspec_init()
end sub

public sub get_uiprop(id)
    if id>0xe7 then ' see @E025DC82 in 100b
        ' ID is over limit, letting it through would crash the camera
        get_uiprop = -1
    else
        get_uiprop = PTM_GetCurrentItem(0x8000+id) ' registered by UI.CreatePublic
        if get_uiprop>32767 then
            get_uiprop = get_uiprop - 65536
        end if
    end if
end sub

public sub get_prop(id,buf,len)
    get_prop = GetPropertyCase(id,len) ' registered by System.Create
    *buf = get_prop
end sub

private sub set_prop(id,buf,len)
    set_prop = SetPropertyCase(id,*buf,len) ' registered by System.Create
end sub

dim PROPCASE_TV=276
dim PROPCASE_TV2=275
dim PROPCASE_AV=23
dim PROPCASE_AV2=22
dim PROPCASE_SV_BASE=34
dim PROPCASE_SV=358
dim PROPCASE_ISO_MODE=158
dim PROPCASE_DELTA_SV=87
dim PROPCASE_SV_MARKET=259

public sub set_tv96(val)
    set_prop(PROPCASE_TV, &val, 2)
    set_prop(PROPCASE_TV2, &val, 2)
end sub

public sub set_av96(val)
    set_prop(PROPCASE_AV, &val, 2)
    set_prop(PROPCASE_AV2, &val, 2)
end sub

public sub set_sv96(val)
    ' trying to imitate shooting_set_sv96() of CHDK
    tmp = 0
    set_prop(PROPCASE_ISO_MODE, &tmp, 2)
    get_prop(PROPCASE_SV_BASE, &tmp, 2)
    set_prop(PROPCASE_SV_MARKET, &tmp, 2)
    ' following 0 is SV96_MARKET_OFFSET
    dsv = val + 0 - tmp
    set_prop(PROPCASE_SV, &val, 2)
    set_prop(PROPCASE_DELTA_SV, &dsv, 2)
end sub

public sub get_tv96(buf)
    tmp = 0
    get_prop(PROPCASE_TV, &tmp, 4)
    if tmp>32767 then
        *buf = tmp - 65536
    else
        *buf = tmp
    end if
end sub

public sub get_av96(buf)
    tmp = 0
    get_prop(PROPCASE_AV, &tmp, 4)
    if tmp>32767 then
        *buf = tmp - 65536
    else
        *buf = tmp
    end if
end sub

public sub get_sv96(buf)
    tmp = 0
    get_prop(PROPCASE_SV, &tmp, 4)
    if tmp>32767 then
        *buf = tmp - 65536
    else
        *buf = tmp
    end if
end sub

' identified from disassembly:
' PROPCASE_AV 23
' PROPCASE_USER_AV 29
' PROPCASE_SV_BASE 34 ' see E02FB192 in 100b
' PROPCASE_SHOOTING_MODE 56
' PROPCASE_QUALITY 65
' PROPCASE_DELTA_SV 87
' PROPCASE_DIGITAL_ZOOM_POSITION 104
' PROPCASE_ISO_MODE 158
' PROPCASE_RESOLUTION 230
' PROPCASE_SV_MARKET 259 ' see E02FB160 in 100b
' PROPCASE_TV2 275 ' see E00F06C8 in 100b (UIFS_GetCurrentTvString)
' PROPCASE_TV 276
' PROPCASE_USER_TV 278
' PROPCASE_SV 358 ' see E02FB168 and E02FB218 in 100b
Hot key should be the INFO button. I'm sure there are much better choices (such as the wifi button), but I'm not sure about their button events (hmmm... help?).

This script seemed to mostly work on my M10 (for the time I tried it) and on my a3200. It failed miserably on my sx280 - this cam draws the lcdmsg lines very slowly and crashes with various reasons.
Sv override seemed flakey on the a3200.


Re: shooting script using Canon basic ?
« Reply #34 on: 04 / October / 2018, 17:15:49 »
sorry for the delay (I’ve recently started a new contract), going to try this weekend

Re: shooting script using Canon basic ?
« Reply #35 on: 07 / October / 2018, 05:39:21 »
Basic howto for the script:
When it starts, it shows propcases starting from 0.
The script's menu can be entered by holding the MENU button for longer (1 sec). This may require multiple tries because the script doesn't always get all button events. The MENU button events are always passed on to the Canon interface, so the button will enter and exit the Canon menu.
When the script's menu (ALT mode) is active, most camera buttons will have no effect. For the camera to respond normally to buttons and switches, exit the script's menu by holding MENU or half pressing the shutter.
The script's menu can be navigated with the UP and DOWN buttons. The SET button can be used to execute (or modify) a menu entry.
The first menu entry selects the operating mode (prop list, prop diff, uiprop list, uiprop diff). The second and third entries can be used to navigate in list modes. The fourth entry selects the hotkey's mode, the fifth entry is for taking a snapshot (and initiate comparing) in diff modes.
The hotkey (should be the INFO button on the M6) can be used to navigate, or to make a snapshot when in diff mode. It can also be set to "bypass" in the script menu, in which case it will fullfill its original function.

...the menu works, it's a bit temperamental to get the menu displayed but the navigation and changing the values are working. Please let me know if you need to report a specific value. FYI, the battery voltage is shown correctly.
« Last Edit: 07 / October / 2018, 05:41:39 by cedricb »

Re: shooting script using Canon basic ?
« Reply #36 on: 07 / October / 2018, 06:17:23 »

Here's a (demo) script that does the following:
- A "hot key" is used to enter/exit the script's menu (ALT mode). That button is exclusively used by to the script, the camera won't see it (except for cases where the script fails to catch it).
works great! The only thing when the menu is up then you can't switch off the camera via the toggle switch!
Quote from: srsa_4c
The first 3 menu entries have shooting functions defined:
 - Shoot 1 (shoots a single picture using button events)
2 pictures with the same settings
Quote from: srsa_4c
- Shoot 3 Tv br (shoots 3 pictures, second and third picture are shot with 2x and 4x exposure time)
1st: 1/60 iso 2000
2nd: 1/60 iso 2000
3rd: 1/30 iso 2000
4th: 1/15 iso 2000
Quote from: srsa_4c
- Shoot 3 Sv br (3 pictures are shot, second with 2x ISO, third with 4x ISO)
1st: 1/60 iso 2000
2nd: 1/60 iso 2000
3rd: 1/60 iso 4000
4th: 1/60 iso 8000
Quote from: srsa_4c
Menu entries are activated by pressing SET. Menu can be left using the hot key or half press. Battery voltage is displayed in the last row.

Hot key should be the INFO button. I'm sure there are much better choices (such as the wifi button), but I'm not sure about their button events (hmmm... help?).
Yeas another button will be better because the info button is now overriden with the menu functionality. The "M-fn" button will be perfect, I don't use any shortcut at the moment.
Otherwise well done!!!  :o

*

Offline srsa_4c

  • ******
  • 3728
Re: shooting script using Canon basic ?
« Reply #37 on: 07 / October / 2018, 09:03:39 »
Attached a slightly changed script that attempts to let through the OFF events. I also changed the "hotkey", this time I used one of the "shortcut" events - see get_cam_keys() in camspec.m . There is no event in the logical event list that sounds like "M-Fn".
If you want something different, try the event code script I posted earlier to find codes that are actually used (and share them, if possible).

The new script needs the following camspec.m:
Code: [Select]
' camera specific plugin
' m6 100b

public sub check_compat()
    if Peek16(0xe1f20270) = 0x32c5 then
        check_compat = 1
    else
        check_compat = 0
    end if
end sub

public sub get_shf_gen()
    ' camera has the newer ssfs eventprocs
    get_shf_gen=1
end sub

public sub get_cam_keys(set,menu,up,down,halfshoot,hotkey,nhotkey,pass1,pass2)
    ' these are the Press* event codes from the levent-table
    *set = 0x85a
    *menu = 0x82a
    *up = 0x824
    *down = 0x826
    *halfshoot = 0x9a1

    *nhotkey = "M-Fn"
    *hotkey = 0x0862 ' PressShortcutButton
    ' *hotkey = 0x0866 ' PressShortcut2Button
    ' *hotkey = 0x840 ' DISP aka INFO
    ' *nhotkey = "INFO"

    ' the following codes (and their unpress event) are always passed through
    *pass1 = 0x1013 ' PowerLeverOn
    *pass2 = 0x1008 ' PressPowerButton
end sub

public sub camspec_init()
end sub

public sub get_uiprop(id)
    if id>0xe7 then ' see @E025DC82 in 100b
        ' ID is over limit, letting it through would crash the camera
        get_uiprop = -1
    else
        get_uiprop = PTM_GetCurrentItem(0x8000+id) ' registered by UI.CreatePublic
        if get_uiprop>32767 then
            get_uiprop = get_uiprop - 65536
        end if
    end if
end sub

public sub get_prop(id,buf,len)
    get_prop = GetPropertyCase(id,len) ' registered by System.Create
    *buf = get_prop
end sub

private sub set_prop(id,buf,len)
    set_prop = SetPropertyCase(id,*buf,len) ' registered by System.Create
end sub

dim PROPCASE_TV=276
dim PROPCASE_TV2=275
dim PROPCASE_AV=23
dim PROPCASE_AV2=22
dim PROPCASE_SV_BASE=34
dim PROPCASE_SV=358
dim PROPCASE_ISO_MODE=158
dim PROPCASE_DELTA_SV=87
dim PROPCASE_SV_MARKET=259

public sub set_tv96(val)
    set_prop(PROPCASE_TV, &val, 2)
    set_prop(PROPCASE_TV2, &val, 2)
end sub

public sub set_av96(val)
    set_prop(PROPCASE_AV, &val, 2)
    set_prop(PROPCASE_AV2, &val, 2)
end sub

public sub set_sv96(val)
    ' trying to imitate shooting_set_sv96() of CHDK
    tmp = 0
    set_prop(PROPCASE_ISO_MODE, &tmp, 2)
    get_prop(PROPCASE_SV_BASE, &tmp, 2)
    set_prop(PROPCASE_SV_MARKET, &tmp, 2)
    ' following 0 is SV96_MARKET_OFFSET
    dsv = val + 0 - tmp
    set_prop(PROPCASE_SV, &val, 2)
    set_prop(PROPCASE_DELTA_SV, &dsv, 2)
end sub

public sub get_tv96(buf)
    tmp = 0
    get_prop(PROPCASE_TV, &tmp, 4)
    if tmp>32767 then
        *buf = tmp - 65536
    else
        *buf = tmp
    end if
end sub

public sub get_av96(buf)
    tmp = 0
    get_prop(PROPCASE_AV, &tmp, 4)
    if tmp>32767 then
        *buf = tmp - 65536
    else
        *buf = tmp
    end if
end sub

public sub get_sv96(buf)
    tmp = 0
    get_prop(PROPCASE_SV, &tmp, 4)
    if tmp>32767 then
        *buf = tmp - 65536
    else
        *buf = tmp
    end if
end sub

' identified from disassembly:
' PROPCASE_AV 23
' PROPCASE_USER_AV 29
' PROPCASE_SV_BASE 34 ' see E02FB192 in 100b
' PROPCASE_SHOOTING_MODE 56
' PROPCASE_QUALITY 65
' PROPCASE_DELTA_SV 87
' PROPCASE_DIGITAL_ZOOM_POSITION 104
' PROPCASE_ISO_MODE 158
' PROPCASE_RESOLUTION 230
' PROPCASE_SV_MARKET 259 ' see E02FB160 in 100b
' PROPCASE_TV2 275 ' see E00F06C8 in 100b (UIFS_GetCurrentTvString)
' PROPCASE_TV 276
' PROPCASE_USER_TV 278
' PROPCASE_SV 358 ' see E02FB168 and E02FB218 in 100b
The bigger issue is that you're getting an extra shot, apparently the first one. Try reviewing the camera settings that might be related. For example: is continuous shooting enabled? If so, switch to single shot mode.

You can modify the bracketing behaviour in shoot_beforeexpo(). Right now it's one directional, as you have noticed. The current code alters one of the expo params that were set in the half-press hook ( shoot_pre() ).

edit:
Pressing OFF while the menu is active still doesn't function well on my a3200 - the cam appears to switch off, but it needs a battery pull before it can be started again...
« Last Edit: 07 / October / 2018, 09:14:44 by srsa_4c »


Re: shooting script using Canon basic ?
« Reply #38 on: 19 / November / 2018, 01:51:58 »
Can the parameter data be read from flash memory with canon basic (like get_parameter_data)?
To understand a little more, is there an overview of all camera memory (Flash, RAM) and how they are organized?

*

Offline reyalp

  • ******
  • 11591
Re: shooting script using Canon basic ?
« Reply #39 on: 19 / November / 2018, 14:01:24 »
Can the parameter data be read from flash memory with canon basic (like get_parameter_data)?
If you find get_parameter_data, you could register it as an event proc and call it.
Quote
To understand a little more, is there an overview of all camera memory (Flash, RAM) and how they are organized?
Various parts have been discussed on the forum, but I'm not aware of an overall map. It would be a good topic for a wiki page, though as usual the sheer number of platforms makes it a bit difficult. You can find the params in a firmware dump.
Don't forget what the H stands for.

 

Related Topics