--[[@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")
--[[@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)
set_config_value(47, 0) -- maps to set_config_value(osd.splash_show, 0)
I like this new patch, great work.But the patch has also consequences:- Not all old scripts with set/get_config_value() will work.- ptpCamGui needs an update. That means it is no more backward compatible.- zeno's Config File Editor probably needs an Update.msl
- general cleanup of old / unused stuff (e.g. ZOOM_OVERRIDE removed)
First impressions:This all looks pretty reasonable. Being able to refer to conf values by name is a big win for scripts. One minor comment on the generated lua files: Mixing "administrative" values like config_id, first_entry, last_entry with actual values is somewhat awkward. It might be good to give them a set prefix (I suggest _ or __), so scripts can easily iterate over the actual conf values. You could put the ids in their own table, but that would make every reference require something like conf.ids.foo which is also awkward.
As far as compatibility goes:It would also be possible to make module that wraps set_config_value with something that maps between the ids. This would be much better than doing the mapping in C code, IMO.
Quote from: philmoz on 03 / August / 2013, 22:09:38- general cleanup of old / unused stuff (e.g. ZOOM_OVERRIDE removed)Doing cleanup separately would make the relevant changes easier to follow, though I understand that you had to deal with some of this splitting up the conf stuff. I would not be averse to the cleanup part being checked in.
Some comments on conf saving. Not directly related to split, but relevant for 1.3set_config_value will cause the conf (or all of them, in the new system) to be saved after every call. This isn't desirable if you are loading an entire config in a lua script.I would suggest adding something like set_config_autosave(bool), so you could update all the conf values and then save once. When I was working on the ISO scripts, I ran into a case where setting the config values to close to shooting would run into the FsIoNotify assert. Note that turning autosave off would not make the changes temporary, since they could be autosaved later by the normal menu etc logic.
At some point it would be nice to get away from having a whole copy of the conf just to detect if it needs to be saved, but that's probably a project for another time.
Really very good. Everything works as described. Also ptpCamGui runs fine with the old set/get_config_value().I think this patch could be a first essential new feature in the CHDK version 1.3.msl
Started by PS « 1 2 » Feature Requests
Started by philmoz General Discussion and Assistance
Started by waterwingz Completed and Working Scripts
Started by hwntw « 1 2 » General Help and Assistance on using CHDK stable releases
Started by reyalp Completed and Working Scripts