gui_osd lines 891,896 shooting_set_focus(shooting_get_subject_distance_override_value(),SET_NOW);shooting.c lines 1010++//-------------------------------------------------------------------// Get override valuesint shooting_get_subject_distance_override_value(){ if (conf.subj_dist_override_koef != SD_OVERRIDE_INFINITY) return (conf.subj_dist_override_value < shooting_get_lens_to_focal_plane_width()?0:(conf.subj_dist_override_value - shooting_get_lens_to_focal_plane_width())); else return INFINITY_DIST;}
/*static int luaCB_get_lens_to_focal_plane_width( lua_State* L ){ lua_pushnumber( L, shooting_get_lens_to_focal_plane_width() ); return 1;}// FUNC(get_lens_to_focal_plane_width)*/In file .o/lua.elf:elf2flt unknown symbol: 'shooting_get_lens_to_focal_plane_width'gmake[1]: *** [.o/lua.flt] Error 5gmake: *** [all-recursive] Error 1
The issue, when I look at shooting.c, is trying to work out where shooting_get_lens_to_focal_plane_width comes from, ie is it extracted from the Canon side and thus represents the front principal plane relative to the sensor plan: which it infers it does.
int shooting_get_lens_to_focal_plane_width(){ return (int)(lens_get_focus_pos()-lens_get_focus_pos_from_lens());
The question I have is, when I use set focus in a Lua, what is its reference? The sensor plane or some other plane?
If the option is off, you could get the with from the difference.
Btw. No easy way from 'shooting.c' to Lua... (Modification of Luascript.c failed here)Code: [Select]In file .o/lua.elf:elf2flt unknown symbol: 'shooting_get_lens_to_focal_plane_width'gmake[1]: *** [.o/lua.flt] Error 5gmake: *** [all-recursive] Error 1
In file .o/lua.elf:elf2flt unknown symbol: 'shooting_get_lens_to_focal_plane_width'gmake[1]: *** [.o/lua.flt] Error 5gmake: *** [all-recursive] Error 1
That said, it might be better to include this in dofinfo rather than adding a new function.
--[[--@title jogdial.Lua@chdk_version 1.4@param J Use Jogdial@default J 1@range J 0 1--]]--repeatprint(-is_wheel_left(),is_wheel_right())sleep( 111)print("", is_wheel_right(),-is_wheel_left())sleep( 222)until is_key "set"c=0; j=0repeatif J==1 then j=get_wheel(); c=c+j; if j==-1 then print( j, "wheel_left",c) end if j==1 then print( j, "wheel_right",c) end sleep(111) enduntil 1>2--[[-- FUNC(get_wheel) FUNC(is_wheel_left) FUNC(is_wheel_right)static int luaCB_get_wheel( lua_State * L ){ short r=get_jogdial_direction(); jogdial=0; if (r==0) { lua_pushnumber( L, 0 ); return 1; } r=r==JOGDIAL_LEFT ? -1:1; // left=-1 | right=1 lua_pushnumber( L, r ); return 1;}static int luaCB_is_wheel_right( lua_State* L ){ if (jogdial==1) {jogdial=0; lua_pushnumber( L, 1 ); return 1;} if (jogdial==-1) { lua_pushnumber( L, 0 ); return 1;} short r=get_jogdial_direction(); jogdial=r==JOGDIAL_LEFT ? -1:0; // if (r==0) { lua_pushnumber( L, 0 ); return 1;} r=r==JOGDIAL_RIGHT ? 1:0; lua_pushnumber( L, r ); return 1;}static int luaCB_is_wheel_left( lua_State* L ){ if (jogdial==-1) {jogdial=0; lua_pushnumber( L, 1 ); return 1;} if (jogdial== 1) { lua_pushnumber( L, 0 ); return 1;} short r=get_jogdial_direction(); jogdial=r==JOGDIAL_RIGHT ? 1:0; // if (r==0) { lua_pushnumber( L, 0 ); return 1;} r=r==JOGDIAL_LEFT ? 1:0; lua_pushnumber( L, r ); return 1;}--]]--
The retriangulation of the wheel was successfull
Started by Jim Script Writing
Started by P373 Script Writing
Started by dvip Script Writing
Started by bugbear « 1 2 » Script Writing
Started by Konos Kosmas « 1 2 3 » General Help and Assistance on using CHDK stable releases