Toz chlapci, postavil jsem si panylek s rotacnimi enkodery a sem tam potakem, tak bylo na case trosku to softwarove dotahnout.
Mame nove LuaMacros, ktere umi navic
- cist osy u game device
- vylepsena podpora u buttonu kvuli rotacnim enkoderum
- cteni POV (hat switchu)
U os je to celkem primocare, proste lze zaregistrovat callback funkci na osu
Ohledne tech enkoderu... Predne je to cele prepsane a nyni to vyuziva events z Direct Inputu, nikoliv cteni aktualniho stavu. Tzn ze neutece zadny stisk buttonu i kdyz je velmi kratky. Potom callbacky od buttonu maji dalsi argument s casovym udajem v ms a tim se da pocitat nejaka akcelerace u rotacnich enkoderu. Tedy tocim rychle - skacu o vic, tocim pomalu, jdu po jedne. Protoze kdo jste zkousel napojit enkoder primo jako button do XPL tak to bych u toho driv zestarnul. Ted jsem si treba zkusil nastrelit heading bug (0/1) a course (6/7) asi takto:
Kód: Vybrat vše
lmc_set_handler('LB2',lb2_common)
function lb2_common(button, direction, ts)
local def = {}
def.cycle = 360
if (button == 0 or button == 1) then
def.button = 0
def.var_name = 'sim/cockpit/autopilot/heading_mag'
return handle_rotary_with_cycle_value(button, direction, ts, def)
elseif (button == 6 or button == 7) then
def.button = 6
def.var_name = 'sim/cockpit/radios/nav1_obs_degm'
return handle_rotary_with_cycle_value(button, direction, ts, def)
end
return false
end
function handle_rotary_with_cycle_value(button, direction, ts, def)
if button == def.button or button == def.button+1 then
if (direction == 1) then
if gTs[def.button] == nil then gTs[def.button] = 0 end
local tsDiff = ts - gTs[def.button]
gTs[def.button] = ts
local step = 1
if (tsDiff > 300) then step = 2
elseif (tsDiff > 200) then step = 3
elseif (tsDiff > 100) then step = 5
else step = 15 end
if (button == def.button) then
lmc_inc_xpl_variable(def.var_name, step, def.cycle, 0)
else
lmc_inc_xpl_variable(def.var_name, -step, 0, def.cycle)
end
end
return true
end
return false
end
Na tech 360 to staci, pokud bych chtel vetsi rozsahy (radia), tak budu jeste resit kolik tech rychlejch stisku prislo - asi nasobenim nejakyho globalniho (per enkoder) koeficientu podle casu posledni odezvy.
Pokud to nekdo chcete vyzkouset, napiste nejakej feedback, taky si jdu nyni upravit svoje skripty.
Detaily:
http://www.hidmacros.eu/forum/viewtopic ... 1158#p1158
Jinak kdyz uz v tom mam ruce az po lokty tak potom asi prijdou na radu nejaky performance problemy s problikavajicim XPL a mozna se konecne podivam, proc mi tento XPL plugin tak krasne shazuje betu 3.