huertix
-
Posts
13 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by huertix
-
-
Thanks a lot Ian.. :) It works now and with your tip I can expand the app for other models as well.
If you are in Munich once, wir müssen ein mal groß Bier trinken. ;)
-
The Export.lua:
local log_file = nil local HOST_PORT = 14801 -- Choose your desire port where DCS is running local ANDROID_PORT = 14800 -- Choose your desire port for android device local HEAD_MSG = "THRDCS" local count=0 local msgOut ="" local clientIP="" local speed ="" local thr = 30; local engineNow = thr; local prevLuaExportStart = LuaExportStart function LuaExportStart() if prevLuaExportStart then prevLuaExportStart() end log_file = io.open(lfs.writedir().."/Logs/Export.log", "w") package.path = package.path..";"..lfs.currentdir().."/LuaSocket/?.lua" package.cpath = package.cpath..";"..lfs.currentdir().."/LuaSocket/?.dll" socket = require("socket") c = socket.udp() c:setsockname("*", HOST_PORT) c:setoption('broadcast', true) c:settimeout(0) end function LuaExportBeforeNextFrame() data, ip, port = c:receivefrom() if data then --log_file:write("---------------------------------------------------\n") --log_file:write("Received: ", data) --log_file:write("\n") clientIP = ip local dataArray = string.gmatch(data, '([^,]+)') if dataArray(0)==HEAD_MSG then thr = dataArray(1) --log_file:write("thr: ", thr) --log_file:write("\n") gear = dataArray(2) flaps = dataArray(3) brakeOff = dataArray(4) brakeOn = dataArray(5) if brakeOn == "1" then --log_file:write("brakeOn: ") --log_file:write("\n") LoSetCommand(577) end if brakeOff == "1" then --log_file:write("brakeOff: ") --log_file:write("\n") LoSetCommand(578) end if brakeOn == "0" and brakeOff == "0" then LoSetCommand(579) end setGear(gear) setFlaps(flaps) end checkBalance(thr,engineNow) end end function LuaExportAfterNextFrame() local MainPanel = GetDevice(0) local engine_thr_left_now = MainPanel:get_argument_value(8) * 100 local engine_thr_right_now = MainPanel:get_argument_value(9) * 100 engineNow = math.floor((engine_thr_left_now + engine_thr_right_now) / 2) --log_file:write("engines: ", engineNow) --log_file:write("\n") gearNow = math.floor(MainPanel:get_argument_value(716)) --log_file:write("gearNow: ", gearNow) --log_file:write("\n") flapsNow = math.floor(MainPanel:get_argument_value(653)*100) --log_file:write("flapsNow: ", flapsNow) --log_file:write("\n") speed = math.floor(MainPanel:get_argument_value(48)*100) -- Currently not is use --log_file:write("Speed: ", speed) --log_file:write("\n") msgOut = HEAD_MSG..","..engineNow..","..gearNow..","..flapsNow.." \n" c:sendto(msgOut, clientIP, ANDROID_PORT) log_file:write("MSG: ", msgOut) --log_file:write("\n") --log_file:write("IP: ", clientIP..":",ANDROID_PORT) --log_file:write("\n") end function checkBalance(remote,current) remote = tonumber(remote) current = tonumber(current) if math.abs( remote - current) < 2 then LoSetCommand(1034) -- stop return 0 end if remote < current then LoSetCommand(1033) -- decrease thrust elseif remote > current then LoSetCommand(1032) -- increase thrust end end function setGear(GearDown) if GearDown == "1" then LoSetCommand(431) else LoSetCommand(430) end end function setFlaps(flps) if flps == "0" then LoSetCommand(1047) elseif flps == "10" then LoSetCommand(1048) elseif flps == "20" then LoSetCommand(1049) end end function LuaExportStop() if log_file then log_file:write("Closing log file...") log_file:close() log_file = nil end --c:close end function LuaExportActivityNextEvent(t) local tNext = t tNext = tNext + 0.1 return tNext end
-
I have troubles to use the export.lua file in multiplayer mode. This export.lua is to use the Android DCS Throttle Control I made.
http://forums.eagle.ru/showthread.php?t=145074
If I play standalone or if I am host in multiplayer, it works great.
please, Someone can help me??
The error:
00080.721 ERROR Lua::Config: Call error LuaExportAfterNextFrame:[string "C:\Users\huertix\Saved Games\DCS\Scripts\Export.lua"]:91: attempt to index local 'MainPanel' (a number value)
stack traceback:
[C]: ?
[string "C:\Users\huertix\Saved Games\DCS\Scripts\Export.lua"]:91: in function <[string "C:\Users\huertix\Saved Games\DCS\Scripts\Export.lua"]:88>.
-
I have troubles to use the export.lua file in multiplayer.
If I play standalone or if I am host in multiplayer, it works great.
-
how do you install Android Throttle?
copied export lua
android ask for WIFI IP of DCS A10
but when started, says: disconnected
is there a guide somewhere?
Sorry majapahit, I was away for a few days....
The guideline is as follow:
1- Copy de export.lua to your /Users/[...]/Saved Games/DCS/Scripts
2 - You need to know your DCS HOST IP, I mean your PC IP --> open a terminal and ipconfing command.
3 - Open the export.lua file and check the PORTS configurations or modify if dessire.
4 - Open the DCS-THROTTLE App and setting up DCS PC IP and ports. You shoud fill in the 3 fields before you can continue
5 - Run a mission
6 - if mission is running and app says "disconnect", press home and then back to the app... (it is a bug I have to fix). Now it should be work. Try to press flaps, gear or break bottons to make sure nothing is working.
My email is dhuerta23@gmail.com. contact me if you need. ;)
-
Thanks for posting the code! I'm new to Android and have had some issues getting DCS to read my packets (it'll read packets from my c# app). This should prove to be helpful. Thanks again.
My pleasure.. ;) but, just to remark I am not an expert in code.
-
Ian;2431726']This should be easy enough to adapt:
http://forums.eagle.ru/showthread.php?p=2312247#post2312247
EDIT: You should also modify your Export.lua to play nice with others.....
Many thanks Ian
-
that is true f4lO. but first I have to look how export CDU screen through UDP connection..
-
Hola.
Si a alguno os interesa, he desarrollado una app para controlar gases:
http://forums.eagle.ru/showthread.php?t=145074
Saludos.
-
-
Hi.
I've bought just the stick from TH Hotas Warthog and now it is so expensive to buy the throttle control. I've decide to develop an Android App to control:
- Throttle
- Gear
- Flaps
- Air Brake
This version is just for A10C, but I will try to develop for most of the mods.
Here is PlayStore Link and Github Code.
https://play.google.com/store/apps/details?id=com.dev.huertix.throttle_dcs_beta
https://github.com/Huertix/dcs-throttle
Thanks to Leonpo and his Instrument Panel App, which it was an starting point in my code.
It is a first release app, so if bugs are present, please repot it to me.
Thanks and enjoy.
- 1
Android DCS Throttle Control
in PC Hardware and Related Software
Posted
Solved. Thanks to [FSF]Ian