CHDK Configuration Setup Script - Completed and Working Scripts - CHDK Forum supplierdeeply

CHDK Configuration Setup Script

  • 6 Replies
  • 8227 Views
CHDK Configuration Setup Script
« on: 09 / June / 2013, 17:31:02 »
Advertisements
I don't know why its taken me so long to write this script.  I have several CHDK equipped camera that I use to do a little development work and a little scripting.

Reloading versions of CHDK usually requires me to use the "Reset Options to Default..."  in the CHDK Settings menu, or even requires me to delete the CCHDK2.CFG or CCHDK3.CFG files from the SD card.

And once that's done, my preferred setup is gone and all the little things that bug me - like OSD setup and that intrusive popup Help window - come back. 

So I wrote this little Lua script and made it generic enough that the same script goes on all of my cameras.  Now I simply run the script after a CHDK reload / reset and am back in business quickly.

Code: [Select]
--[[ CHDK Setup
@title CHDK Setup
  Note : config values are from chdk/core/conf.c
--]]

function printf(...)
    print(string.format(...))
end

set_console_layout(2, 5, 44, 12)
printf("Default Setup Running")
bi=get_buildinfo()
printf("%s %s %s %s %s", bi.version, bi.build_number, bi.platform, bi.platsub, bi.build_date)
camera = bi.platform

-- common stuff for all camera

    set_config_value( 1,   1 )   -- show OSD
    set_config_value( 174, 0 )   -- hide OSD dont/playback/disp/both
    set_config_value( 12,  1 )   -- batt volts show
    set_config_value( 13,  1 )   -- batt icon show
    set_config_value( 14 , 0 )   -- show state
    set_config_value( 41,  2 )   -- show clock
    set_config_value( 155, 1 )   -- clock format
    set_config_value( 57,  0 )   -- user menu as root
    set_config_value( 121, 0 )   -- remote enable
    set_config_value( 132, 1 )   -- space icon enable
    set_config_value( 135, 1 )   -- space MB show
    set_config_value( 145, 0 )   -- space bar show
    set_config_value( 203, 0 )   -- show temp
    set_config_value( 246, 1 )   -- USB icon enable
    set_config_value( 291, 0 )   -- alt helper
    set_config_value( 295, 0 )   -- disable shortcuts

-- camera specific stuff

    printf("setting defaults for %s", camera)
    if ( camera == "g10" ) then
        set_config_value( 42, 300, 225 )   -- clock pos
        set_config_value( 23, 0,   140 )   -- batt icon position
        set_config_value( 24, 38,  140 )   -- batt text position
        set_config_value( 133, 0,  160 )   -- space icon position
        set_config_value( 136, 38, 162 )   -- space text position
        set_config_value( 247, 0,  60  )   -- USB icon position
    elseif ( camera == "ixus120_sd940" ) then
        set_config_value( 63, 33       )   -- config ALT mode button ( KEY_PLAYBACK = 33 )
        set_config_value( 42, 300, 225 )   -- clock pos
        set_config_value( 23, 0,   170 )   -- batt icon position
        set_config_value( 24, 38,  170 )   -- batt text position
        set_config_value( 133, 0,  190 )   -- space icon position
        set_config_value( 136, 38, 192 )   -- space text position
        set_config_value( 247, 0,  60  )   -- USB icon position
    elseif (camera == "a1200" ) then
        set_config_value( 42, 300, 225 )   -- clock pos
        set_config_value( 23, 0,   170 )   -- batt icon position
        set_config_value( 24, 38,  170 )   -- batt text position
        set_config_value( 133, 0,  190 )   -- space icon position
        set_config_value( 136, 38, 192 )   -- space text position
        set_config_value( 247, 0,  60  )   -- USB icon position
    elseif ( camera == "sx50hs" ) then
        set_config_value( 42, 300, 225 )   -- clock pos
        set_config_value( 23, 0,   170 )   -- batt icon position
        set_config_value( 24, 38,  170 )   -- batt text position
        set_config_value( 133, 0,  190 )   -- space icon position
        set_config_value( 136, 38, 192 )   -- space text position
        set_config_value( 247, 0,  60  )   -- USB icon position
    else printf("Warning : no custom settings")
    end

print("...done")

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Pier

  • ***
  • 128
Re: CHDK Configuration Setup Script
« Reply #1 on: 18 / June / 2013, 02:02:58 »
In the example given above I've made changes to my needs and sx130is.In config.c I do not find anything about miscelanous position feature.When I use OSD Layout editor, I can positioning miscelanous.All with show space in MB, temp, temp text, bat icon, bat text e.t.c  is OK.Misc is permited when "shoot", subj. dist is permited in misc.Same strange things with State Display and zoom EFL-can't position it with the script. Any help pls.
« Last Edit: 18 / June / 2013, 02:11:46 by Pier »

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: CHDK Configuration Setup Script
« Reply #2 on: 18 / June / 2013, 08:12:26 »
Nice script!

Also usefull: http://trac.assembla.com/chdkde/browser/scripts/conf_rw/conf_rw.lua

This script save and rewrite all configuration data from config.c. You can save 10 different configurations.

msl
CHDK-DE:  CHDK-DE links

Re: CHDK Configuration Setup Script
« Reply #3 on: 18 / June / 2013, 09:33:29 »
This script save and rewrite all configuration data from config.c. You can save 10 different configurations.
I've looked at that script in the past and tried it out.  If what you want to do is swap configurations its really handy - especially if you put it into the User Menu and have that loaded when you press the ALT key!  Nice.

It doesn't quite work for my situation though for three reasons.  The first is trivial - I only really need one default setup and I don't really want to have to backup & restore a whole bunch of config files plus the script itself.  If I was willing to do that, I could just backup the CCHDKx.CFG file.   The second is a little harder - I have four cameras and only want to maintain the one common file.  Finding and storing and restoring a single config file has never worked well for me - mostly because of my final reason.   My final reason is that I move a lot between versions ( 1.0.0,  1.1.0,  1.2.0 ) as I'm helping people or testing things out. The simple approach my script takes is version independent - I can  reset CHDK settings at will,  and then let the script reset the few settings that bug me - as well as OSD screen positions. So far,  every setting I've cared about exists in all version of the CFG file at the same index number.

But that's the best part about CHDK scripting - if you don't like how it works or need an additional feature - change it!  I think reyalp deserves a lot of credit for holding the line on limiting "built-in" functionality.  We don't have a lot of application code that can't be changed by the end users (especially as we have a real programming language in Lua rather than just a script language in uBASIC).

Ported :   A1200    SD940   G10    Powershot N    G16


Re: CHDK Configuration Setup Script
« Reply #4 on: 18 / June / 2013, 09:46:20 »
In config.c I do not find anything about miscelanous position feature.
Code: [Select]
set_config_value( 26, 1, 1 )   -- miscellaneous values position
Quote
Same strange things with State Display and zoom EFL-can't position it with the script. Any help pls.
Code: [Select]
set_config_value( 25, 1, 1 )   -- state display position
Don't have time to test it now but these should be right - just change the 2nd & 3rd parameter.
« Last Edit: 18 / June / 2013, 09:54:14 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Pier

  • ***
  • 128
Re: CHDK Configuration Setup Script
« Reply #5 on: 18 / June / 2013, 11:28:31 »
Many Thanks waterwingz.
Now the script works fine.I saw my mistake playing with ID numbers.
Best Regards.

Re: CHDK Configuration Setup Script
« Reply #6 on: 19 / October / 2017, 15:55:40 »
Reloading versions of CHDK usually requires me to use the "Reset Options to Default..."  in the CHDK Settings menu, or even requires me to delete the CCHDK2.CFG or CCHDK3.CFG files from the SD card.

Is Reset Options to Default functionally equivalent to deleting all CCHDK?.CFG/OSD?.CFG files

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal