Attached is a patch that implements the following:
- split config values into four files, core, OSD, user menu & GPS
- re-organise and group entries in the ConfInfo structures, all ID values redone (with gaps to allow new entries)
- add new tool to generate Lua libraries for each config file / ConfInfo structure (LUALIB/GEN/cnf_XXX.lua)
- add 'save_config_file' and 'load_config_file' calls to Lua
- general cleanup of old / unused stuff (e.g. ZOOM_OVERRIDE removed)
Note: the config files are all new, no attempt is made to convert previous config.
The Lua libraries can be used as per the following example, this turns off a bunch of OSD settings and saves a backup copy of the OSD config (the default OSD config file will get saved automatically):
--[[
@title Set OSD config
--]]
local osd=require("gen/cnf_osd")
set_config_autosave(0)
set_config_value(osd.splash_show, 0)
set_config_value(osd.space_icon_show, 0)
set_config_value(osd.space_perc_show, 0)
set_config_value(osd.space_mb_show, 0)
set_config_value(osd.space_bar_show, 0)
set_config_value(osd.show_temp, 0)
set_config_value(osd.show_clock, 0)
set_config_value(osd.batt_perc_show, 0)
set_config_value(osd.batt_volts_show, 0)
set_config_value(osd.batt_icon_show, 0)
set_config_value(osd.show_alt_helper, 0)
save_config_file(osd._config_id, "A/CHDK/OSD_BKUP.CFG")
Another example that loads the backup OSD config and forces saving to the default file:
--[[
@title Load OSD config
--]]
local osd=require("gen/cnf_osd")
load_config_file(osd._config_id, "A/CHDK/OSD_BKUP.CFG")
save_config_file(osd._config_id)
If the filename parameter to save_config_file / load_config_file is not supplied the default filename is used.
The first parameter defines which ConfInfo structure is to be saved/loaded.
In the latest patch (posted below) the old config ID values from 1.2 can be used in set_config_value and get_config_value:
set_config_value(47, 0) -- maps to set_config_value(osd.splash_show, 0)
Things to look at / discuss:
- is there a better way to do the Lua libraries & code
- there is an opportunity here to rename config variables, some of the names are not entirely clear
- the split between core & OSD config may not be correct, there are some items that could be in either, I've made a choice for these; but open to suggestions for moving them
Phil.