Lua Macros

Nástroje, utility, SW udělátka, Xdgets, doplňky ...
Odpovědět
Uživatelský avatar
masa
Příspěvky: 435
Registrován: 30 pro 2014, 22:31
Bydliště: Praha 5
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od masa » 28 bře 2015, 18:18

Kdyz jsem zakazal veskery vypisy, tak vypadalo, ze se drzel trosku dyl, nakonec jsem ho ale taky zabil. A dole to psalo Running 1 script, 2 queued... A v tomhle stavu kdyz cvaknu cudlem, tak to spolehlive vyhodi tu prilozenou hlasku.
Obrázek

me2d
Site Admin
Příspěvky: 190
Registrován: 29 pro 2014, 21:30
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od me2d » 28 bře 2015, 20:04

Dnes nemam moc cas to zkoumat, pohraju si s tim zitra.
Trochu se ale obavam, ze to zahlceni nebudu moct bez COMu nasimulovat. Aspon to teda projdu a zacistim, at se to chova... deterministicky :-).

Nicmene aspon jsem spichnul verzi s lepsim logovanim a moznosti poslat to do souboru, takze stahni si novej release, hod si pls na zacatek skriptu neco jako:

Kód: Vybrat vše

lmc_log_all();
lmc_log_spool('lmc_spool.log')
A az to nasimulujes, tak mi ten log posli. Bude ve stejnym adresari jako exe (pokud tam nedas cestu). Kdyz nastavis ten spool, jde to jen do filu, ne do okna.
File se zavira po kazdem log-zapisu, takze by to melo byt pouzitelne i kdyz ti to padne.
Obrázek

Uživatelský avatar
masa
Příspěvky: 435
Registrován: 30 pro 2014, 22:31
Bydliště: Praha 5
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od masa » 28 bře 2015, 20:50

Ja na neho asi budu s tim posilanim pres COM moc rychlej ;) Ale to jsem asi schopnej si pak poladit na strane toho HW, abych LUA macros nezahlcoval.

Kód: Vybrat vše

2015-03-28 20:43:53:087 [COM]: Adding COM device: COM at port COM17 with speed 9600, data bits 8, parity N and stop bits 1 
2015-03-28 20:43:53:087 [COM]: Setting separator of port COM to "
"
2015-03-28 20:43:53:087 [LUA]: Added handler 3 for whole device BODNAR
2015-03-28 20:43:53:087 [COM]: Setting port COM active TRUE
2015-03-28 20:43:53:097 [LUA]: Added handler 4 for whole device COM
2015-03-28 20:43:53:097 [LUA]: Lua worker: finished simple code, length 2078, execution time: 50 ms
2015-03-28 20:43:53:097 [LUA]: Lua worker: queue size is 0, suspending thread...
2015-03-28 20:43:53:117 [DX]: Event: BODNAR button 8 DOWN
2015-03-28 20:43:53:117 [LUA]: Calling handler 3 for device BODNAR with params key 8, direction 1
2015-03-28 20:43:53:117 [DX]: Event: BODNAR button 25 DOWN
2015-03-28 20:43:53:117 [LUA]: Calling handler 3 for device BODNAR with params key 25, direction 1
2015-03-28 20:43:53:117 [DX]: Event: BODNAR button 26 DOWN
2015-03-28 20:43:53:117 [LUA]: Calling handler 3 for device BODNAR with params key 26, direction 1
2015-03-28 20:43:53:127 [DX]: Event: BODNAR button 31 DOWN
2015-03-28 20:43:53:127 [LUA]: Calling handler 3 for device BODNAR with params key 31, direction 1
2015-03-28 20:43:54:697 [COM]: Received data from COM port COM17: HDG_0

2015-03-28 20:43:54:697 [COM]: Callback with COM data "HDG_0
" separated by splitter.
2015-03-28 20:43:54:697 [LUA]: Calling handler 4 for device COM with data HDG_0

2015-03-28 20:44:02:532 [COM]: Received data from COM port COM17: HDG_359
HDG_358
HDG_357
HDG_3
2015-03-28 20:44:02:542 [COM]: Callback with COM data "HDG_359
" separated by splitter.
2015-03-28 20:44:02:542 [LUA]: Calling handler 4 for device COM with data HDG_359

2015-03-28 20:44:02:542 [COM]: Callback with COM data "HDG_358
" separated by splitter.
2015-03-28 20:44:02:552 [LUA]: Calling handler 4 for device COM with data HDG_358

2015-03-28 20:44:02:552 [COM]: Callback with COM data "HDG_357
" separated by splitter.
2015-03-28 20:44:02:552 [LUA]: Calling handler 4 for device COM with data HDG_357

2015-03-28 20:44:02:552 [COM]: Received data kept in buffer of COM COM. Buffer content: "HDG_3"
2015-03-28 20:44:02:592 [COM]: Received data from COM port COM17: 56
HDG_355
HDG_354
HDG_353
H
2015-03-28 20:44:02:592 [COM]: Callback with COM data "HDG_356
" separated by splitter.
2015-03-28 20:44:02:602 [LUA]: Calling handler 4 for device COM with data HDG_356

2015-03-28 20:44:02:602 [COM]: Callback with COM data "HDG_355
" separated by splitter.
2015-03-28 20:44:02:602 [LUA]: Calling handler 4 for device COM with data HDG_355

2015-03-28 20:44:02:602 [COM]: Callback with COM data "HDG_354
" separated by splitter.
2015-03-28 20:44:02:602 [LUA]: Calling handler 4 for device COM with data HDG_354

2015-03-28 20:44:02:602 [COM]: Callback with COM data "HDG_353
" separated by splitter.
2015-03-28 20:44:02:612 [LUA]: Calling handler 4 for device COM with data HDG_353

2015-03-28 20:44:02:612 [COM]: Received data kept in buffer of COM COM. Buffer content: "H"
2015-03-28 20:44:02:642 [COM]: Received data from COM port COM17: DG_352
HDG_351
HDG_350
HDG_34
2015-03-28 20:44:02:642 [COM]: Callback with COM data "HDG_352
" separated by splitter.
2015-03-28 20:44:02:652 [LUA]: Calling handler 4 for device COM with data HDG_352

2015-03-28 20:44:02:652 [COM]: Callback with COM data "HDG_351
" separated by splitter.
2015-03-28 20:44:02:652 [LUA]: Calling handler 4 for device COM with data HDG_351

2015-03-28 20:44:02:652 [COM]: Callback with COM data "HDG_350
" separated by splitter.
2015-03-28 20:44:02:652 [LUA]: Calling handler 4 for device COM with data HDG_350

2015-03-28 20:44:02:662 [COM]: Received data kept in buffer of COM COM. Buffer content: "HDG_34"
2015-03-28 20:44:02:712 [COM]: Received data from COM port COM17: 9
HDG_348
HDG_347
HDG_346
HD
2015-03-28 20:44:02:712 [COM]: Callback with COM data "HDG_349
" separated by splitter.
2015-03-28 20:44:02:712 [LUA]: Calling handler 4 for device COM with data HDG_349

2015-03-28 20:44:02:712 [COM]: Callback with COM data "HDG_348
" separated by splitter.
2015-03-28 20:44:02:712 [LUA]: Calling handler 4 for device COM with data HDG_348

2015-03-28 20:44:02:722 [COM]: Callback with COM data "HDG_347
" separated by splitter.
2015-03-28 20:44:02:722 [LUA]: Calling handler 4 for device COM with data HDG_347

2015-03-28 20:44:02:722 [COM]: Callback with COM data "HDG_346
" separated by splitter.
2015-03-28 20:44:02:722 [LUA]: Calling handler 4 for device COM with data HDG_346

2015-03-28 20:44:02:722 [COM]: Received data kept in buffer of COM COM. Buffer content: "HD"
2015-03-28 20:44:02:752 [COM]: Received data from COM port COM17: G_345
HDG_344
HDG_343
HDG_342
2015-03-28 20:44:02:752 [COM]: Callback with COM data "HDG_345
" separated by splitter.
2015-03-28 20:44:02:752 [LUA]: Calling handler 4 for device COM with data HDG_345

2015-03-28 20:44:02:752 [COM]: Callback with COM data "HDG_344
" separated by splitter.
2015-03-28 20:44:02:752 [LUA]: Calling handler 4 for device COM with data HDG_344

2015-03-28 20:44:02:762 [COM]: Callback with COM data "HDG_343
" separated by splitter.
2015-03-28 20:44:02:762 [LUA]: Calling handler 4 for device COM with data HDG_343

2015-03-28 20:44:02:762 [COM]: Received data kept in buffer of COM COM. Buffer content: "HDG_342"
2015-03-28 20:44:02:812 [COM]: Received data from COM port COM17: 
HDG_341
HDG_340
HDG_339

2015-03-28 20:44:02:812 [COM]: Callback with COM data "HDG_342
" separated by splitter.
2015-03-28 20:44:02:812 [LUA]: Calling handler 4 for device COM with data HDG_342

2015-03-28 20:44:02:822 [COM]: Callback with COM data "HDG_341
" separated by splitter.
2015-03-28 20:44:02:822 [LUA]: Calling handler 4 for device COM with data HDG_341

2015-03-28 20:44:02:822 [COM]: Callback with COM data "HDG_340
" separated by splitter.
2015-03-28 20:44:02:822 [LUA]: Calling handler 4 for device COM with data HDG_340

2015-03-28 20:44:02:822 [COM]: Callback with COM data "HDG_339
" separated by splitter.
2015-03-28 20:44:02:832 [LUA]: Calling handler 4 for device COM with data HDG_339

2015-03-28 20:44:02:872 [COM]: Received data from COM port COM17: HDG_338

2015-03-28 20:44:02:872 [COM]: Callback with COM data "HDG_338
" separated by splitter.
2015-03-28 20:44:02:882 [LUA]: Calling handler 4 for device COM with data HDG_338

2015-03-28 20:44:02:942 [COM]: Received data from COM port COM17: HDG_339
HDG_338

2015-03-28 20:44:02:942 [COM]: Callback with COM data "HDG_339
" separated by splitter.
2015-03-28 20:44:02:952 [LUA]: Calling handler 4 for device COM with data HDG_339

2015-03-28 20:44:02:952 [COM]: Callback with COM data "HDG_338
" separated by splitter.
2015-03-28 20:44:02:952 [LUA]: Calling handler 4 for device COM with data HDG_338

2015-03-28 20:44:03:282 [COM]: Received data from COM port COM17: HDG_337
HDG_338
HDG_337
HDG_3
2015-03-28 20:44:03:292 [COM]: Callback with COM data "HDG_337
" separated by splitter.
2015-03-28 20:44:03:292 [LUA]: Calling handler 4 for device COM with data HDG_337

2015-03-28 20:44:03:292 [COM]: Callback with COM data "HDG_338
" separated by splitter.
2015-03-28 20:44:03:292 [LUA]: Calling handler 4 for device COM with data HDG_338

2015-03-28 20:44:03:292 [COM]: Callback with COM data "HDG_337
" separated by splitter.
2015-03-28 20:44:03:302 [LUA]: Calling handler 4 for device COM with data HDG_337

2015-03-28 20:44:12:774 [DX]: Event: BODNAR button 3 DOWN
2015-03-28 20:44:12:774 [LUA]: Calling handler 3 for device BODNAR with params key 3, direction 1
2015-03-28 20:45:18:864 [DX]: Event: BODNAR button 8 UP
2015-03-28 20:45:18:864 [LUA]: Calling handler 3 for device BODNAR with params key 8, direction 0
2015-03-28 20:45:20:674 [DX]: Event: BODNAR button 8 DOWN
2015-03-28 20:45:20:674 [LUA]: Calling handler 3 for device BODNAR with params key 8, direction 1

A na konci tohohle to slitlo uplne, program prestal pracovat...
Obrázek

me2d
Site Admin
Příspěvky: 190
Registrován: 29 pro 2014, 21:30
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od me2d » 28 bře 2015, 21:34

No ale i tak by na to nemel lehnout.
Myslim ze tam stejne vidim problem, tlacis tam do nej eventy, co maj zavolat nejakej LUA code, ale chybi mi v tom logu resume exekucniho threadu, kterej by je zpracoval. Pak se to zahlti raz dva :-).
Zitra na to mrknu, ono to pujde :-)
Obrázek

me2d
Site Admin
Příspěvky: 190
Registrován: 29 pro 2014, 21:30
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od me2d » 29 bře 2015, 23:26

Tak zkus novou verzi pls. Kdyztak mailni log.
Obrázek

Uživatelský avatar
masa
Příspěvky: 435
Registrován: 30 pro 2014, 22:31
Bydliště: Praha 5
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od masa » 30 bře 2015, 16:57

Tak jsem ted chvili kroutil jak o dusu a neslitlo to, fungovalo to porad korektne. Takze podle me dobry, dik :)
Obrázek

Uživatelský avatar
masa
Příspěvky: 435
Registrován: 30 pro 2014, 22:31
Bydliště: Praha 5
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od masa » 01 dub 2015, 17:56

Tak jsem zas pokrocil s vyvojem a narazil na dalsi problem, je ale mozny, ze to mam blbe ja... ;) Snaha je nastavit frekvenci ADF1...

Kód: Vybrat vše

val = string.sub(comVal,5);
print(">>" .. val .. "<<")
lmc_set_xpl_variable('sim/cockpit2/radios/actuators/adf1_frequency_hz', val)
val je frekvence co prijde po seriaku, 424, 425,...

V XPL to ale vzdycky nastavi 0. Stejnym zpusobem nastavuju sim/cockpit2/autopilot/heading_dial_deg_mag_pilot a sim/cockpit2/radios/actuators/hsi_obs_deg_mag_pilot a tam stejny postup funguje spravne. V dataref editoru se ten adf jevi jako cely cislo, kdezto ty dva co mi fungujou jako desetiny. Tipuju ze pes bude zakopany nekde tam.

A takhle aktualne vypada XPL displej :)
2015-04-01 18.52.08.jpg
2015-04-01 18.52.08.jpg (18.58 KiB) Zobrazeno 3375 x
Obrázek

me2d
Site Admin
Příspěvky: 190
Registrován: 29 pro 2014, 21:30
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od me2d » 01 dub 2015, 20:03

Mrknu na to... snad zitra, nebo az o vikendu.
Zkus si to nejak explicitne pretypovat na cislo. Lua to sice dela sama, ale ta moje funkce tak chytra neni, natvrdo tam ctu parametr cislo a necheckuju, jestli to neni string. A nevim, jestli tam Lua v tom pripade udela tu implicitni konverzi.
Teda myslim, ze tam ctu cislo....
Obrázek

me2d
Site Admin
Příspěvky: 190
Registrován: 29 pro 2014, 21:30
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od me2d » 02 dub 2015, 19:10

Hele mne tohle funguje:

Kód: Vybrat vše

val='421'
lmc_set_xpl_variable('sim/cockpit2/radios/actuators/adf1_frequency_hz', val)
Udelej z toho tvyho prikladu co nejjednodussi skript, kterej nepujde a ja to zkusim.
Obrázek

Uživatelský avatar
masa
Příspěvky: 435
Registrován: 30 pro 2014, 22:31
Bydliště: Praha 5
Kontaktovat uživatele:

Re: Lua Macros

Příspěvek od masa » 02 dub 2015, 20:04

Ok, po vikendu zkusim - nemuze to treba byt tim, ze sem neaktualizoval ten xpl plugin? To si ted nevybavuju, jestli jsem totiz udelal...
Obrázek

Odpovědět