![background image](http://html.mh-extra.com/html/canon/camera/camera_hackers-manual_59969201.webp)
192
C H A P T E R 5
Scripting
i = i+1
end
end
else
print(
"No configs to choose from")
end
Before we switch to the selected configuration, we check to see whether
the current configuration
CHDK/CCHDK.CFG
is different from the configura-
tion remembered in the
INI
file. We do this by using the function
compare_
files()
that we implemented above.
Then we ask the user whether to save the current configuration under
a new name. If yes, we remember this decision in the variable
newconf
. If no
INI
file exists, we save the current configuration by default:
if #config_name > 0 then
local cpath =
configs.."/".. config_name
if compare_files(
current_config, cpath) then
changed = true
print("Save current config?")
print("SET=yes, DISP=no")
while true do
wait_click(5000)
if is_pressed("set") then
newconf = true
break
elseif
is_pressed("display") then
break
end
end
end
else
newconf = true
end
If the folder
CHDK/CONFIGS/
does not exist, we create it. If the current con-
figuration is to be saved under a new name, we increment the configura-
tion counter, construct a new name (
confn.CFG
), and copy the current
configuration to folder
CHDK/CONFIGS/
under the new name. The user may
Содержание Camera
Страница 1: ......
Страница 2: ...The Canon Camera Hackers Manual ...
Страница 3: ......
Страница 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Страница 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Страница 25: ...16 CH APTER 3 ...
Страница 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Страница 213: ...204 CH APTER 6 ...
Страница 253: ...244 AP PENDIX ...