Skip to content

Commit

Permalink
added possibility to send Status Text Messages to Taranis
Browse files Browse the repository at this point in the history
  • Loading branch information
Clooney82 committed Sep 26, 2015
1 parent 86e9698 commit 41e6a5a
Show file tree
Hide file tree
Showing 9 changed files with 491 additions and 121 deletions.
29 changes: 25 additions & 4 deletions Lua_Telemetry/DisplayApmPosition/SCRIPTS/MIXES/Nconfig.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
--
-- config lua
--
-- Copyright (C) 2014 Michael Wolkstein
--
-- https://github.com/Clooney82/MavLink_FrSkySPort
--
-- (2015) Improved by:
-- Jochen Kielkopf
-- https://github.com/Clooney82/MavLink_FrSkySPort
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY, without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--

local inputs = {
{"play sounds", VALUE, 0, 1, 1},
Expand Down Expand Up @@ -49,23 +70,23 @@ local function run_func(playsound, voltwarnlevel, voltcritcal, horn, repeattimes
model.setGlobalVariable(0, used_flightmode, playsound)
old_playsound = playsound
end

-- Script Part
repeattime = repeattimeseconds*100
drop = celldropmvolts/10
if horn > 0 then
hornfile="/SOUNDS/en/ALARM"..horn.."K.wav"
end

newtime=getTime()
if newtime-lasttimeplaysound>=repeattime then
cellmin=getValue("Cmin") + 0.0001 --- 214 = cell-min
lasttimeplaysound = newtime

firstitem = math.floor(cellmin)
miditem = math.floor((cellmin-firstitem) * 10)
lastitem = round((((cellmin-firstitem) * 10)-math.floor(((cellmin-firstitem) * 10))) *10)

if cellmin<=2.0 then --silent
elseif cellmin<=voltcritcal/100 then --critical
if horn>0 then
Expand Down
10 changes: 6 additions & 4 deletions Lua_Telemetry/DisplayApmPosition/SCRIPTS/MIXES/Noffset.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Offset lua
--
-- Copyright (C) 2014 Michael Wolkstein
--
--
-- https://github.com/Clooney82/MavLink_FrSkySPort
--
-- (2015) Improved by:
Expand Down Expand Up @@ -41,9 +41,11 @@ local function run_func(offsetmah, offsetwatth, batcapwh, batcapmah)
if oldoffsetmah ~= offsetmah or oldoffsetwatth ~= offsetwatth or oldbatcapwh ~= batcapwh or oldbatcapmah ~= batcapmah then
batcapmah = batcapmah / 100
model.setGlobalVariable(1, used_flightmode, offsetmah) --mA/h
model.setGlobalVariable(2, used_flightmode, offsetwatth) --Wh
model.setGlobalVariable(3, used_flightmode, batcapwh) --Wh
model.setGlobalVariable(4, used_flightmode, batcapmah) --mAh
model.setGlobalVariable(2, used_flightmode, offsetwatth) --Wh
model.setGlobalVariable(3, used_flightmode, batcapwh) --Wh
model.setGlobalVariable(4, used_flightmode, batcapmah) --mAh
--model.setGlobalVariable(4, used_flightmode, batcapmah/1000) --mAh
--model.setGlobalVariable(5, used_flightmode, batcapmah-(batcapmah/1000)) --mAh
oldoffsetmah = offsetmah
oldoffsetwatth = offsetwatth
oldbatcapwh = batcapwh
Expand Down
24 changes: 12 additions & 12 deletions Lua_Telemetry/DisplayApmPosition/SCRIPTS/MIXES/service.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Service lua
--
-- Copyright (C) 2015 Michael Wolkstein
--
--
-- https://github.com/Clooney82/MavLink_FrSkySPort
--
-- This program is free software; you can redistribute it and/or modify
Expand All @@ -19,7 +19,7 @@
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--

local inputs = { {"Main Ser.", VALUE,0,156,156}, {"Serv 1", VALUE, 0, 156, 0}, {"Serv 2", VALUE, 0, 156, 0}, {"Serv 3", VALUE, 0, 156, 0}, {"Repeat", VALUE, 0, 10, 5} }


Expand All @@ -38,38 +38,38 @@ local mainreached = 0

local function run_func(mainservice, serviceone, servicetwo, servicethree, repeats)

timertwotime = model.getTimer(1).value
timertwotime = model.getTimer(1).value
checkfortimetesttime=getTime()

-- each second
if checkfortimetesttime-lastcheckfortimetest>=checkfortimetest then

if serviceone > 0 and math.fmod(timertwotime, serviceone*3600) == 0 then
testone = repeats
end

if servicetwo > 0 and math.fmod(timertwotime, servicetwo*3600) == 0 then
testtwo = repeats
end

if servicethree > 0 and math.fmod(timertwotime, servicethree*3600) == 0 then
testthree = repeats
end

if mainservice > 0 and timertwotime >= mainservice * 3600 then
mainreached = repeats
mainreached = repeats
end

lastcheckfortimetest = checkfortimetesttime
end
end

-- all 15 secons
if checkfortimetesttime-lastcheckfortimetesttime>=checkforserviceinterval then

if testone>0 then
playFile("/SOUNDS/en/ServOne.wav")
testone = testone - 1

-- uncomment next three lines (if than) to test timer function in a loop. set "service 1" to something modulo 10.
-- than set yor local timer to 10h and start the timer
-- if testone == 0 then
Expand All @@ -85,7 +85,7 @@ local function run_func(mainservice, serviceone, servicetwo, servicethree, repea
if testthree>0 then
playFile("/SOUNDS/en/ServThre.wav")
testthree = testthree - 1
end
end

if mainreached > 0 then
playFile("/SOUNDS/en/ServMain.wav")
Expand Down
Loading

1 comment on commit 41e6a5a

@Clooney82
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basicly it work, but I messed up something during char conversion.
Conversion char to bin work.
transmitting ? think so.
Conversion on taranis bin to char mixes everything up.
Maybe transmission to slow or behavier in opentx2.1.x changes.

Please sign in to comment.