Config setting - General Help and Assistance on using CHDK stable releases - CHDK Forum supplierdeeply

Config setting

  • 4 Replies
  • 1243 Views
Config setting
« on: 18 / March / 2023, 12:47:09 »
Advertisements
@anyone

I don't like postings like this, ie showing my ignorance, but I'm getting frustrated.

All I'm trying to do is, after a button push, toggle the histogram on and off, and ensure it is positioned correctly.

Here is the code I'm using:
Code: [Select]
            set_config_value(20,0,120)
            sleep(100)
            if get_config_value(1060) == 0 then set_config_value(1060,1) else set_config_value(1060,0) end

The toggle works OK, but I can't get the histogram positioning working.

Can someone put me out of my misery.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Config setting
« Reply #1 on: 18 / March / 2023, 16:43:36 »
Code: [Select]
            set_config_value(20,0,120)


There is no config item with index 20 anymore.
Config ID's less than 1000 were from CHDK 1.2 and the mapping to convert to the new ID numbers was removed a while ago.


You should load the cnf_xxx.lua files (LUALIB/GEN) and then use named config IDs.


Anyway the histo position is id 2020.

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: Config setting
« Reply #2 on: 18 / March / 2023, 17:06:14 »
Code: [Select]
            set_config_value(20,0,120)


There is no config item with index 20 anymore.
Config ID's less than 1000 were from CHDK 1.2 and the mapping to convert to the new ID numbers was removed a while ago.


You should load the cnf_xxx.lua files (LUALIB/GEN) and then use named config IDs.


Anyway the histo position is id 2020.

Many thanks

*

Offline Caefix

  • *****
  • 946
  • Sorry, busy deleting test shots...
Re: Config setting
« Reply #3 on: 18 / March / 2023, 17:30:46 »
 :xmas
Code: [Select]
--[[
@title HisToggle
@param    x X*10
 @default x 10
 @range   x 0 30
@param    y Y*10
 @default y 0
 @range   y 0 20

@param    l Layout
 @default l 0
 @values  l _A _Y A_Y R_G_B A_yrgb Y_argb BLEND BLEND_Y
@param    g Ev-grid
 @default g 0
 @range   g 0 1
@param    a Auto-adjust
 @default a 0
 @range   a 0 1
@subtitle :...,....1....,....2....,....3....,....4..


    // The default X & Y position values below are based on 360x240 size screen display.
    // The CONF_INFOP macro scales these, at build time, based on the actual camera screen size (CAM_SCREEN_WIDTH & CAM_SCREEN_HEIGHT).
    CONF_INFOP( 20, conf.histo_pos,                             CONF_OSD_POS,   45,150),

    CONF_INFOC( 50, conf.histo_color,                           CONF_DEF_VALUE, IDX_COLOR_GREY_DK,IDX_COLOR_WHITE,1,1),
    CONF_INFOC( 51, conf.histo_color2,                          CONF_DEF_VALUE, IDX_COLOR_RED,IDX_COLOR_WHITE,1,1),

    CONF_INFO( 60, conf.show_histo,                             CONF_DEF_VALUE, i:0),
    CONF_INFO( 61, conf.show_overexp,                           CONF_DEF_VALUE, i:1),
    CONF_INFO( 62, conf.histo_mode,                             CONF_DEF_VALUE, i:0),
    CONF_INFO( 63, conf.histo_auto_ajust,                       CONF_DEF_VALUE, i:1),
    CONF_INFO( 64, conf.histo_ignore_boundary,                  CONF_DEF_VALUE, i:4),
    CONF_INFO( 65, conf.histo_layout,                           CONF_DEF_VALUE, i:0),
    CONF_INFO( 66, conf.histo_show_ev_grid,                     CONF_DEF_VALUE, i:0),

// Display modes - must match gui_histo_view_modes in gui.c
define OSD_HISTO_LAYOUT_A          0       // A - RGB
define OSD_HISTO_LAYOUT_Y          1
define OSD_HISTO_LAYOUT_A_Y        2
define OSD_HISTO_LAYOUT_R_G_B      3
define OSD_HISTO_LAYOUT_A_yrgb     4
define OSD_HISTO_LAYOUT_Y_argb     5
define OSD_HISTO_LAYOUT_BLEND      6
define OSD_HISTO_LAYOUT_BLEND_Y    7
]]--

    set_config_value(1060,1-get_config_value(1060,0))
    set_config_value(1063,a)
    set_config_value(1065,l)
    set_config_value(1066,g)

    set_config_value(2020,x*10,y*10)
    sleep(100)
All lifetime is a loan from eternity.


Re: Config setting
« Reply #4 on: 18 / March / 2023, 17:54:18 »
:xmas
Code: [Select]
--[[
@title HisToggle
@param    x X*10
 @default x 10
 @range   x 0 30
@param    y Y*10
 @default y 0
 @range   y 0 20

@param    l Layout
 @default l 0
 @values  l _A _Y A_Y R_G_B A_yrgb Y_argb BLEND BLEND_Y
@param    g Ev-grid
 @default g 0
 @range   g 0 1
@param    a Auto-adjust
 @default a 0
 @range   a 0 1
@subtitle :...,....1....,....2....,....3....,....4..


    // The default X & Y position values below are based on 360x240 size screen display.
    // The CONF_INFOP macro scales these, at build time, based on the actual camera screen size (CAM_SCREEN_WIDTH & CAM_SCREEN_HEIGHT).
    CONF_INFOP( 20, conf.histo_pos,                             CONF_OSD_POS,   45,150),

    CONF_INFOC( 50, conf.histo_color,                           CONF_DEF_VALUE, IDX_COLOR_GREY_DK,IDX_COLOR_WHITE,1,1),
    CONF_INFOC( 51, conf.histo_color2,                          CONF_DEF_VALUE, IDX_COLOR_RED,IDX_COLOR_WHITE,1,1),

    CONF_INFO( 60, conf.show_histo,                             CONF_DEF_VALUE, i:0),
    CONF_INFO( 61, conf.show_overexp,                           CONF_DEF_VALUE, i:1),
    CONF_INFO( 62, conf.histo_mode,                             CONF_DEF_VALUE, i:0),
    CONF_INFO( 63, conf.histo_auto_ajust,                       CONF_DEF_VALUE, i:1),
    CONF_INFO( 64, conf.histo_ignore_boundary,                  CONF_DEF_VALUE, i:4),
    CONF_INFO( 65, conf.histo_layout,                           CONF_DEF_VALUE, i:0),
    CONF_INFO( 66, conf.histo_show_ev_grid,                     CONF_DEF_VALUE, i:0),

// Display modes - must match gui_histo_view_modes in gui.c
define OSD_HISTO_LAYOUT_A          0       // A - RGB
define OSD_HISTO_LAYOUT_Y          1
define OSD_HISTO_LAYOUT_A_Y        2
define OSD_HISTO_LAYOUT_R_G_B      3
define OSD_HISTO_LAYOUT_A_yrgb     4
define OSD_HISTO_LAYOUT_Y_argb     5
define OSD_HISTO_LAYOUT_BLEND      6
define OSD_HISTO_LAYOUT_BLEND_Y    7
]]--

    set_config_value(1060,1-get_config_value(1060,0))
    set_config_value(1063,a)
    set_config_value(1065,l)
    set_config_value(1066,g)

    set_config_value(2020,x*10,y*10)
    sleep(100)

Yes, all is right with the world again :-)

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal