-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0cbcd6
commit 4b82bd2
Showing
62 changed files
with
1,420 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-name *.lua ! -name debug*.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/bin/* | ||
!/bin/attachments.sh | ||
!/bin/build.sh | ||
/node_modules | ||
/obj | ||
/releases | ||
.builderr | ||
*.lnk | ||
debug.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-name *.lua ! -name widgets.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
all: | ||
bin/build.sh min |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# README |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
## copy files unprocessed | ||
|
||
cp -fvR src/SCRIPTS/WIDGETS/X9/BMP obj/SCRIPTS/WIDGETS/X9/BMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/bash | ||
|
||
MINIFY=$1 | ||
ERRCNT=0 | ||
|
||
if [ -d obj ]; then | ||
rm -fR obj/* | ||
else | ||
mkdir obj | ||
fi | ||
|
||
if [ -d tmp ]; then | ||
rm -dfR tmp | ||
fi | ||
mkdir tmp | ||
|
||
echo | ||
luac -v | ||
|
||
if [[ $MINIFY == "min" ]]; then | ||
echo | ||
echo luamin $(npm view luamin version)" "Copyright Mathias Bynens [https://github.com/mathiasbynens/luamin] | ||
fi | ||
|
||
if [ -f .minignore ]; then | ||
EXCLUDE=(`find src/* $(<.minignore)`); | ||
fi | ||
|
||
MANIFEST=(`find src/* $(<.buildfiles)`); | ||
|
||
if [ ${#MANIFEST[@]} -eq 0 ]; then | ||
echo -e "\e[1m\e[39m[\e[31mTEST FAILED\e[39m] \e[21mNo scripts could be found\e[21m! \e[0m" | ||
exit 1 | ||
fi | ||
|
||
rm -f tmp/tmperr | ||
touch tmp/tmperr | ||
|
||
echo | ||
echo "building ..." | ||
|
||
for file in ${MANIFEST[@]}; | ||
do | ||
SRC_PATH=$(dirname ${file})/ | ||
OBJ_PATH=${SRC_PATH/src/obj} | ||
OBJ_LUA=$(basename ${file}) | ||
OBJ_LUAC=${OBJ_LUA/.lua/.luac} | ||
|
||
echo | ||
echo -ne "\e[1m\e[37m${file}\e[39m\e[1m\e[0m ...\e[0m" | ||
|
||
mkdir -p ${OBJ_PATH} | ||
|
||
|
||
if [[ $MINIFY == "min" ]]; then | ||
if [[ $EXCLUDE && ($(printf "_[%s]_" "${EXCLUDE[@]}") =~ .*_\[$file\]_.*) ]]; then | ||
cp -f "$file" "${OBJ_PATH}${OBJ_LUA}" | ||
else | ||
echo -n " minify ..." | ||
node node_modules/luamin/bin/luamin -f "$file" > "${OBJ_PATH}${OBJ_LUA}" | ||
fi | ||
else | ||
cp -f "$file" "${OBJ_PATH}${OBJ_LUA}" | ||
fi | ||
|
||
echo -n " compile ..." | ||
luac -s -o "${OBJ_PATH}${OBJ_LUAC}" "$file" >tmp/tmpvar 2>tmp/tmpvar | ||
STDOUT=$(<tmp/tmpvar) | ||
rm -f tmp/tmpvar | ||
|
||
_fail=$? | ||
if [[ $_fail -ne 0 || $STDOUT ]]; then | ||
((ERRCNT++)) | ||
echo | ||
echo `date +"%Y-%m-%d %T"` "$file $STDOUT"$'\r' >>tmp/tmperr | ||
echo -e "\e[1m\e[39m[\e[31mBUILD FAILED\e[39m] \e[1m \e[0m\e[37mCompilation error:\e[0m" | ||
echo -e "\e[1m\e[37m${STDOUT}\e[39m\e[1m\e[0m \e[0m" | ||
else | ||
echo -ne " \e[1m\e[39m[\e[32mok\e[39m]\e[1m\e[0m\e[0m" | ||
fi | ||
done | ||
|
||
LAST_FAILURES=$(<tmp/tmperr) | ||
|
||
rm -dfR tmp | ||
|
||
echo | ||
if [[ $LAST_FAILURES == '' ]]; then | ||
if [ -f bin/attachments.sh ]; then | ||
echo | ||
echo "copying attachments..." | ||
bash bin/attachments.sh | ||
fi | ||
|
||
echo | ||
echo -e "\e[1m\e[39m[\e[32mSUCCESSFUL\e[39m] \e[21mAll lua files built successfully!\e[21m\e[1m\e[0m\e[0m" | ||
else | ||
echo "$LAST_FAILURES"$'\r' >> ".builderr" | ||
echo | ||
echo -e "\e[1m\e[39m[\e[31mBUILD FAILED\e[39m] \e[1m \e[0m\e[37mCompilation error(s):\e[0m" | ||
echo -e "\e[1m\e[37m${LAST_FAILURES}\e[39m\e[1m\e[0m \e[0m"$'\r' | ||
fi | ||
|
||
echo | ||
exit $ERRCNT |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "betaflight-tx-lua-scripts", | ||
"version": "1.3.0", | ||
"scripts": { | ||
"start": "bash bin/build.sh min" | ||
}, | ||
"description": "", | ||
"devDependencies": { | ||
"luamin": "^1.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- X9 layout based on https://github.com/lynix/opentx-telemetry <[email protected]> | ||
local layout = { | ||
{ {id="X9/tx-batt"} }, | ||
{ {id="X9/mode"}, {id="X9/gps"}, {id="X9/timer"} }, | ||
{ {id="X9/distance"}, {id="X9/altitude"}, {id="X9/speed"} }, | ||
{ {id="X9/rssi"} }, | ||
} | ||
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout) | ||
|
||
return { init=w.init, run=w.run } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
local layout = { | ||
{ | ||
{ | ||
id="graph", | ||
opts={ | ||
uid=7, | ||
src="thr", | ||
lbl="THR", | ||
unit="%", | ||
speed=35, | ||
min=-1000, | ||
max=1000, | ||
lblmax="max", | ||
lblmin="min", | ||
p={l=18} | ||
} | ||
}, | ||
{ | ||
id="graph", | ||
opts={ | ||
uid=8, | ||
src=function() return getGraphAverage(7) end, | ||
lbl="THR AVRG", | ||
unit="%", | ||
speed=70, | ||
min=-1000, | ||
max=1000, | ||
lblmax="max", | ||
lblmin="min", | ||
p={l=18} | ||
} | ||
}, | ||
}, | ||
} | ||
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout) | ||
|
||
return { init=w.init, run=w.run } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local layout = { | ||
{ | ||
{ id="rssi" } | ||
}, | ||
{ | ||
{ id="rssi2" } | ||
}, | ||
-- { | ||
-- { id="batt" } | ||
-- }, | ||
{ | ||
{ id="batt2" } | ||
}, | ||
{ | ||
{ id="batt3", opts={src="tx-voltage", lbl="TX Bat", p={r=0}} } | ||
}, | ||
-- { | ||
-- { id="graph", opts={uid=5, src="thr", lbl="THR", unit="%", speed=50, min=-1000, max=1000, lblmax="max", lblmin="min", p={r=18}} }, | ||
-- { id="graph", opts={uid=6, src=function() return getGraphAverage(5) end, lbl="THR AVRG", unit="%", speed=50, min=-1000, max=1000, lblmax="max", lblmin="min", p={r=18}} }, | ||
-- --[[,"../TELEMETRY/graph3"--]] | ||
-- }, | ||
-- {"fm", "gps", "timer"}, | ||
-- {"distance", "altitude", "speed"}, | ||
-- {"batt"}, | ||
-- {"rssi"}, | ||
} | ||
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout) | ||
|
||
return { init=w.init, run=w.run } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local rssi, alarm_low, alarm_crit = getRSSI() | ||
local layout = { | ||
{ | ||
{ id="batt3", opts={src="tx-voltage", lbl="TX Bat"} } | ||
}, | ||
-- { | ||
-- { id="batt3", opts={src="tx-voltage", lbl="txV"} } | ||
-- }, | ||
{ | ||
-- set opts.parent to a true value, if it should call a nested/sub widget | ||
{ id="../TELEMETRY/wdgts2_sub", opts={parent=1} }, | ||
{ id="graph", | ||
opts={ | ||
uid=5, | ||
src=function() local x = getRSSI() return x end, | ||
speed=100, | ||
min=alarm_crit, | ||
max=99, | ||
crit=alarm_low, | ||
-- lblmax=99, | ||
-- lblmin=alarm_crit, | ||
p={t=6,l=1} | ||
} | ||
}, | ||
} | ||
} | ||
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout) | ||
|
||
return { init=w.init, run=w.run } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
local layout = { | ||
{ | ||
{ | ||
id="value", | ||
opts={ | ||
src=function() return getValue("gvar9") > 0 and getValue("gvar9") or 100 end, | ||
lbl="THR RNG", | ||
unit="%", | ||
style=SMLSIZE, | ||
} | ||
}, | ||
{ | ||
id="value", | ||
opts={ | ||
src=function() local db = getRSSI() return db end, | ||
lbl="RSSI", | ||
unit="dB", | ||
min=alarm_low, | ||
style=SMLSIZE, | ||
p={t=4,r=0}, | ||
} | ||
}, | ||
}, | ||
{ | ||
-- { | ||
-- id="value", | ||
-- opts={ | ||
-- src=function() local m = model.getInfo() return m.name end, | ||
-- lbl="Model", | ||
-- p={r=0,l=0} | ||
-- } | ||
-- }, | ||
{ | ||
id="h-bar", | ||
opts={ | ||
lbl="LQ", | ||
src=function() | ||
local db, low, crit = getRSSI() | ||
return (db - crit) * 100 / (99-crit) | ||
end, | ||
space=0, | ||
bg=true, | ||
-- p={b=-1}, | ||
} | ||
}, | ||
{ | ||
id="value", | ||
opts={ | ||
src=function() return getGraphAverage(5) end, | ||
lbl="Avrg", | ||
unit="dB", | ||
style=SMLSIZE, | ||
p={t=4,r=0}, | ||
} | ||
}, | ||
}, | ||
} | ||
-- set the second param to a true value, if this is nested inside a parent widget | ||
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout, 1) | ||
|
||
return { init=w.init, run=w.run } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
local layout = { | ||
{ | ||
{ id="stairs", | ||
opts={ | ||
lbl="TX Bat", | ||
src=function() | ||
local settings = getGeneralSettings() | ||
return (getValue("tx-voltage") - settings.battMin) * 100 / (settings.battMax-settings.battMin) | ||
end, | ||
stairs=10, | ||
space=2 | ||
} | ||
} | ||
}, | ||
{ | ||
-- set opts.parent to a true value, if it should call a nested/sub widget | ||
{ id="../TELEMETRY/wdgts3_sub", opts={parent=1} }, | ||
{ | ||
id="stairs", | ||
opts={ | ||
src=function() | ||
local settings = getGeneralSettings() | ||
return (getValue("tx-voltage") - settings.battMin) * 100 / (settings.battMax-settings.battMin) | ||
end, | ||
stairs=20, | ||
space=2, | ||
p={t=4,r=0,b=0} | ||
} | ||
}, | ||
} | ||
} | ||
local w = assert(loadScript("/SCRIPTS/WIDGETS/widgets.lua"))(layout) | ||
|
||
return { init=w.init, run=w.run } |
Oops, something went wrong.