Remap button - Script Writing - CHDK Forum

Remap button

  • 1 Replies
  • 1792 Views
*

Offline jkk

  • *
  • 1
Remap button
« on: 15 / May / 2014, 07:27:50 »
Advertisements
To facilitate lens calibration I tried to prepare script which remap some buttons and make control more reproducible.
In chdk mode it was working quite well but when I switched to standard mode without interrupting script remapped
buttons retain their original functionality and get also new function from script. To be more clear for ex..
right button in std mode control flash, in second mode (script running and mode switched from chdk to std manually)
right button control flash and in the same time also increase AV value. Is there any way to get away original button function.
I really very hate original stupid behavior when I try to use "wheel_right" and system sometimes evaluates it as right button and eject flash :-(

Code: [Select]
@title steps

s=0

while 1
wait_click 1
if is_key "up" then gosub "zoomplus"
if is_key "down" then gosub "zoomminus"
if is_key "right" then gosub "avplus"
if is_key "left" then gosub "avminus"
rem if is_key "remote" then gosub "remoteshoot"
wend

:zoomminus
a=0
if a=0 and s=10 then
a=1
s=0
endif
if a=0 and s=25 then
a=1
s=10
endif
if a=0 and s=45 then
a=1
s=25
endif
if a=0 and s=70 then
a=1
s=45
endif
if a=0 and s=93 then
a=1
s=70
endif
if a=0 and s=100 then
a=1
s=93
endif

rem print s, "x"
gosub "zoomvalue"
if a=1 then
set_zoom s
sleep 800
endif
return

:zoomplus
a=0
if a=0 and s=0 then
a=1
s=10
endif
if a=0 and s=10 then
a=1
s=25
endif
if a=0 and s=25 then
a=1
s=45
endif
if a=0 and s=45 then
a=1
s=70
endif
if a=0 and s=70 then
a=1
s=93
endif
if a=0 and s=93 then
a=1
s=100
endif

rem print s, "x"
gosub "zoomvalue"
if a=1 then
set_zoom s
sleep 800
endif
return

:avminus
set_av_rel 0-1
sleep 600
gosub "avvalue"
return

:avplus
set_av_rel 1
sleep 600
gosub "avvalue"
return

:zoomvalue
if s=0 then print "zoom: ", s, "x, ", "4.5mm"
if s=10 then print "zoom: ", s, "x, ", "6.5mm"
if s=25 then print "zoom: ", s, "x, ", "10.9mm"
if s=45 then print "zoom: ", s, "x, ", "18.7mm"
if s=70 then print "zoom: ", s, "x, ", "33.6mm"
if s=93 then print "zoom: ", s, "x, ", "65.6mm"
if s=100 then print "zoom: ", s, "x, ", "90.0mm"
return

:avvalue
a=get_user_av96
if a=288 then print "av:", "2.8"
if a=320 then print "av:", "3.2"
if a=352 then print "av:", "3.5"
if a=384 then print "av:", "4.0"
if a=416 then print "av:", "4.5"
if a=448 then print "av:", "5.0"
if a=480 then print "av:", "5.6"
if a=512 then print "av:", "6.3"
if a=544 then print "av:", "7.1"
if a=576 then print "av:", "8.0"
return

chdk1.2/sx260hs

Re: Remap button
« Reply #1 on: 15 / May / 2014, 08:58:25 »
There is a thread somewhere on this forum about expanding the button handling code to allow the sort of button remapping you are looking for.  So far it's only a concept but there have been ongoing requests for this sort of thing so it's probably worth looking at again.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal