Hiho!
Da ich wohl zu den "Einmalpostern" oder "Seltenpostern" gehöre, will ich den Thread wenigstens sauber abschließen! Deswegen will ich hier mal kurz meine Scripte zeigen, die ich beim KAP mit der A570 verwende:
- Code: Alles auswählen
--[[
rem RC mit HYP
rem Hyperfocal-Code geklaut von
rem HDR-Hyper.bas by gehtnix 13.06.2010
rem
rem For Canon A570 only
@title L:RC with HYP
@param a Shoot
@default a 5
@param b Zoom In
@default b 20
@param c Zoom Out
@default c 40
@param f Belichtung x1/3
@default -1
@param o Time Offset
@default o 10
@param p Check aperture 0/1
@default p 0
@param s do/until Sleep x10
@default s 0
@param x Zoom Sleep x10
@default x 100
@param d Debug Mode (0 ... 5)
@default d 0
@param e Sound (0..6, -1)
@default e 3
]]
-- better human readable parameter names
checkMode = p
loopWait = s*10
zoomWait = x*10
debugMode = d
sound = e
ev = f
kap = require('kap-utils')
function thirds(x)
-- converts int to fracture with base 3
fract = ""
if x%3 == 0 then
fract = math.abs(x/3)
else
if x/3 ~= 0 then
fract = math.abs(x/3).." "
end
fract = fract..math.abs(x%3).."/3"
end
if x < 0 then
fract = "-"..fract
end
return fract
end
print("disable flash")
kap.set_flash_mode(2)
print("changing to MF and HYP")
kap.setMF(zoomWait)
kap.hyperfocal(checkMode, loopWait, zoomWait)
set_ev(ev*32)
print("set Ev = "..thirds(get_ev()/32))
print("ready for KAP! :-)")
kap.playSound(sound)
repeat
repeat
power = get_usb_power()
until power > 0
kap.debugMsg(1, "usbpower: "..power)
if kap.checkRange(power, a, o) then
shoot()
kap.debugMsg(2, "shoot")
elseif kap.checkRange(power, b, o) then
kap.debugMsg(2, "zoom out")
click("zoom_out")
sleep(zoomWait)
kap.hyperfocal(checkMode, loopWait, zoomWait)
elseif kap.checkRange(power, c, o) then
kap.debugMsg(2, "zoom in")
click("zoom_in")
sleep(zoomWait)
kap.hyperfocal(checkMode, loopWait, zoomWait)
end
until is_key("set") == true
Funktionen, von denen ich meine, ich brauche sie vielleicht noch öfter, habe ich in eine Bibliothek ausgelagert:
- Code: Alles auswählen
--[[
kap-utils.lua
Utility functions regular used inside my kap scripts.
Usage:
require("kap-utils")
Compatibility:
A570
]]
local kap = {}
function kap.debugMsg(level, message)
-- prints message, if level is smaller or
-- equal to global debugMode
-- if global not set, do nothing!
if debugMode == nil then debugMode = 0 end
if level <= debugMode then
print(message)
end
end
function kap.hyperfocal(checkMode, loopWait, zoomWait)
-- sets hyperfocal focus
-- if checkmode <> 0 recheck aperture, takes some
-- time - but may be useful in changing light situations.
if checkMode == 0 then
distance = get_hyp_dist()
kap.debugMsg(4, "distance: "..distance)
set_focus(distance)
else
press("shoot_half")
repeat
sleep(loopWait)
until get_shooting() == true
distance = get_hyp_dist()
release("shoot_half")
repeat
sleep(loopWait)
until get_shooting() ~= true
kap.debugMsg(4, "distance: "..distance)
set_focus(distance)
end
kap.debugMsg(3, "focus: "..(distance/1000).."m")
kap.debugMsg(4, "near: "..(get_near_limit()/1000).."m")
sleep(zoomWait)
end
function kap.checkRange(test, value, diff)
-- check if test is in range (value-diff...value+diff)
return (test >= value-diff) and (test <= value+diff)
end
function kap.setMF(zoomWait)
-- sets focus mode to MF
-- works only on A570
repeat
click("down")
sleep(zoomWait)
focusMode = get_prop(6)
kap.debugMsg(4, "focus mode: "..focusMode)
until focusMode == 4
end
function kap.set_flash_mode(mode)
-- stolen from
-- http://forum.chdk-treff.de/viewtopic.php?f=7&t=800
-- modes:
-- 0 - auto
-- 1 - on
-- 2 - off
if get_propset() == 1 then
set_prop(16, mode)
else
set_prop(143, mode)
end
end
function kap.playSound(sound)
-- Play sound 0 to 6, avoid annyoing sound #7
-- Stay mute if sound number < 0
if sound > 6 then
sound = 3 -- default
kap.debugMsg(2, "illegal sound")
end
if sound >= 0 then
play_sound(sound)
end
end
kap.debugMsg(5, "loaded successfully: kap-utils")
return kap
Viel Code ist von anderen Quellen geklaut. So funktioniert das Script bei mir gut!
Tschüss
Marcus (aka Tiggr)