Skip to content

Commit 8dc247c

Browse files
committed
Add control schema patch files, update README.md, add readme image
1 parent 6fe5a84 commit 8dc247c

File tree

4 files changed

+129
-34
lines changed

4 files changed

+129
-34
lines changed

README.md

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,49 @@
22
*based on release [1.3.0](https://github.com/betaflight/betaflight-tx-lua-scripts/releases/tag/1.3.0)*
33

44
## Changes
5-
**+ Display external telemetry templates beside betaflight screens**
5+
**+ Display telemetry screens inside betaflight**
66

77
**+ Configurable navigation controls, radio type independent**
88
- added user events: `longPress.page`, `release.page`
99
- added radio schemes: Taranis X-Lite, Taranis X9E
1010
- added controls:
11-
* ***Page back*** on long press [PAGE]
12-
* ***Back to first page*** on long press [MENU]
11+
* ***Page back*\*** on long press [PAGE]
12+
* ***Back to first page*\*** on long press [MENU]
1313
* ***Close menu*** on release [MENU] button
14-
* ***Quit editing*** on release [MENU] button *(not discarding changes)*
14+
* ***Quit editing*** on release [MENU] button
1515

16-
**+ Minified script files, shrinked down to 75% the size of 1.3.0** (thanks to [mathiasbynens/luamin](https://github.com/mathiasbynens/luamin))
16+
**+ Minified script files** (thanks to [mathiasbynens/luamin](https://github.com/mathiasbynens/luamin))
1717

18-
## Notes
19-
Wanted to explore the potential of the popular betaflight-tx-lua-scripts a bit, as I wasn't quit satisfied with a few things. Came up with this mod and it upgraded the UX for me so well, that I decided to share it with the community. Runs nique smooth on my FrSky Taranis Q X7, but I wasn't able to do tests with any other models than FrSky so far.
18+
##
2019

21-
Install and use this modified version just the way you're used to. First time users should have a glimpse at the [install instructions](#installing).
20+
![alt text](img/navigation.gif "more convenient navigation")
21+
22+
> \**You can not access other telemetry screen slots, cause its part of design. The input [PAGE] is used for stepping pages, similar to the OpenTX system menu.
23+
Apply [a patch](https://github.com/Matze-Jung/betaflight-tx-lua-scripts-mod/tree/master/patches) if you want to have the original input mapping restored.*
24+
25+
26+
##
27+
28+
OpenTX provides only four telemetry screen slots and to me, the navigation doesn't seem to be very familiar. Sacrifice switches to trigger screens ain't an satisfying option either. The betaflight script has the capability of navigating screens already and is compatible to a range of radios. So why not use that?
29+
30+
With this mod the limit number of telemetry screens depend only on the system memory. Just list them in your platforms config file. You don't even have to display the betaflight screens if not needed.
31+
32+
Install this modified version just the way you're used to. First time users should have a glimpse at the [install instructions](#installing).
2233

2334
### Loading telemetry scripts
2435
To add, change or reorder pages, edit the `PageFiles = { ... }` table in your `SCRIPTS/BF/[platform]/[platform]pre.lua` file.
2536

26-
As a point to start, uncomment the first line of `PageFiles` to load the example home screen `exmpl1.lua` *(except Horus)*.
37+
Uncomment the first item of `PageFiles` to load the example home screen `../../TELEMETRY/exmpl1.lua` or insert your own scripts.
38+
> *If you have TBS Crossfire, try* `../../../CROSSFIRE/crossfire.lua`
2739
28-
Order the pages to your needs (I prefer the vtx settings as my second, after the custom home screen).
40+
Order the pages to your needs. I prefer the vtx settings as last, one before home screen. Then long press [MENU], long press [PAGE] is a quick and rememberable action to access vtx settings.
2941

3042
Prepend `-- ` to the line to hide a page (e.g. rescue.lua and gps.lua, if you don't use GPS).
3143

32-
Use relative pathnames to refer external templates.
44+
Use relative pathnames to refer external scripts.
3345
If you add or edit pages, keep in mind that the radios internal memory isn't endless.
3446

35-
> *If you have TBS Crossfire, you can try* `../../../CROSSFIRE/crossfire.lua`*. The Page seems to load, but tell me if it's actually working.*
47+
> *To layout and create custom telemetry screens, I would recommend a grid-system like [opentx-lua-widgets](https://github.com/Matze-Jung/opentx-lua-widgets).*
3648
3749
### Mapping navigation controls
3850
The code wich handles the user events was abstracted from `ui.lua` into a table `ctrlSchema = { ... }` and placed in each `SCRIPTS/BF/[platform]/[platform]pre.lua` file.
@@ -42,14 +54,14 @@ For instance: if you want to have switching pages on the [DIAL WHEEL] input, cha
4254

4355
To add a transmitter control schema based on its platform, just overwrite the affected table fields below the schema table (see overrides for X9E in `SCRIPTS/BF/X9/x9pre.lua` [for example](https://github.com/Matze-Jung/betaflight-tx-lua-scripts-mod/blob/7c4463aec29757763e8eb7aea49905e677711ef7/src/SCRIPTS/BF/X9/x9pre.lua#L101)).
4456

45-
This concept should have the potential to implement new coming radios much easier and be handled separately from the core ui code.
57+
This concept should have the potential to implement new coming radios much easier and be maintenanced separately from the core ui code.
4658

4759
### Memory warning
48-
If you just copied the files, launched the script and a `not enough memory` warning appears, probably restarting the radio is the only thing to do here. If OpenTX still complains, try to delete all `.luac` files (compiled with LUAC 5.3.5, don't know if that's a problem with some devices).
60+
If you just copied the files, launched the script and a `not enough memory` warning appears, probably restarting the radio is the only thing to do here. If OpenTX still complains, try to delete all `.luac` files and make shure that you've did build OpenTX with the luac-option checked.
4961

5062
## Test environment
51-
* OpenTX v2.2.3 on Taranis Q X7, Betaflight 4.0.3 on OmnibusF4, R-XSR
52-
* Companion Sim v2.2.3 & 2.3.0N34 (*FrSky radios only*)
63+
* [OpenTX v2.2.4](https://github.com/opentx/opentx) on Taranis Q X7, [Betaflight 4.0.5](https://github.com/betaflight/betaflight) on OmnibusF4 w/ R-XSR
64+
* [Companion Sim v2.2.4](https://www.open-tx.org/) (*FrSky platforms only*)
5365

5466
> *Any [feedback](https://github.com/Matze-Jung/betaflight-tx-lua-scripts-mod/issues/new/choose) about testing on different hardware welcome.*
5567
@@ -63,24 +75,24 @@ Please go to the [releases page](https://github.com/Matze-Jung/betaflight-tx-lua
6375
- Compiled/minified files will be created at the `obj` folder. Copy the files to your transmitter as instructed in the [Installing section](#installing) below as if you unzipped from a downloaded file.
6476

6577
## Control schema layout
66-
| State | Action | Condition (X7) |
67-
| - | - | - |
68-
| display | prevPage | *longPress.page* |
69-
| | nextPage | *release.page* |
70-
| | prevLine | *dial.left* |
71-
| | nextLine | *dial.right* |
72-
| | edit | *release.enter* |
73-
| | menu | *release.menu* |
74-
| | home | *longPress.menu* |
75-
| | exit | *release.exit* |
76-
| editing | decValue | *dial.left* |
77-
| | stepValue | *dial.right* |
78-
| | exit | *release.exit* or *release.enter* or *release.menu* |
79-
| displayMenu | prev | *dial.left* |
80-
| | next | *dial.right* |
81-
| | cnfrm | *release.enter* |
82-
| | exit | *release.exit* or *release.menu* |
83-
> *Action `func()` is fired when condition is true and in application state.*
78+
| State | Action | Event *(X7)* | Event *(X9)* |
79+
| - | - | - | - |
80+
| display | prevPage | *longPress.page* | *longPress.page* |
81+
| | nextPage | *release.page* | *release.page* |
82+
| | prevLine | *dial.left* | *release.plus* |
83+
| | nextLine | *dial.right* | *release.minus* |
84+
| | edit | *release.enter* | *release.enter* |
85+
| | menu | *release.menu* | *release.menu* |
86+
| | home | *longPress.menu* | *longPress.menu* |
87+
| | exit | *release.exit* | *release.exit* |
88+
| editing | decValue | *dial.left* | *release.plus* |
89+
| | stepValue | *dial.right* | *release.minus* |
90+
| | exit | *release.exit* or *release.enter* or *release.menu* | *release.exit* or *release.enter* or *release.menu* |
91+
| displayMenu | prev | *dial.left* | *release.plus* |
92+
| | next | *dial.right* | *release.minus* |
93+
| | cnfrm | *release.enter* | *release.enter* |
94+
| | exit | *release.exit* or *release.menu* | *release.exit* or *release.menu* |
95+
> *The control schema is located in the `SCRIPTS/BF/[platform]/[platform]pre.lua` file.*
8496
8597
## User events
8698
| Action | Name |
@@ -104,6 +116,11 @@ Please go to the [releases page](https://github.com/Matze-Jung/betaflight-tx-lua
104116
| | left |
105117
| | right |
106118

119+
## Resources
120+
* [Manual for OpenTX 2.2](https://opentx.gitbooks.io/manual-for-opentx-2-2)
121+
* [OpenTX 2.2 Lua Reference Guide](https://opentx.gitbooks.io/opentx-2-2-lua-reference-guide/)
122+
* [OpenTX Taranis Manual](https://opentx.gitbooks.io/opentx-taranis-manual)
123+
107124
---
108125

109126
# betaflight-tx-lua-scripts 1.3.0

img/navigation.gif

126 KB
Loading

patches/x7pre.lua.patch

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git "a/src/SCRIPTS/BF/X7/x7pre.lua" "b/src/SCRIPTS/BF/X7/x7pre.lua"
2+
index 1db2f35..1a78e6a 100644
3+
--- "a/src/SCRIPTS/BF/X7/x7pre.lua"
4+
+++ "b/src/SCRIPTS/BF/X7/x7pre.lua"
5+
@@ -19,11 +19,11 @@ NoTelem = { 32, 55, "No Telemetry!", BLINK }
6+
ctrlSchema = {
7+
display = {
8+
prevPage = {
9+
- cond = function(e, evs) return e == evs.longPress.page end,
10+
+ cond = function(e, evs) return false end,
11+
func = function() stepPage(-1) end
12+
},
13+
nextPage = {
14+
- cond = function(e, evs) return e == evs.release.page end,
15+
+ cond = function(e, evs) return e == evs.release.menu end,
16+
func = function() stepPage(1) end
17+
},
18+
prevLine = {
19+
@@ -42,14 +42,14 @@ ctrlSchema = {
20+
end
21+
},
22+
menu = {
23+
- cond = function(e, evs) return e == evs.release.menu end,
24+
+ cond = function(e, evs) return e == evs.longPress.menu end,
25+
func = function()
26+
setState("displayMenu")
27+
setLock("displayMenu.exit")
28+
end
29+
},
30+
home = {
31+
- cond = function(e, evs) return e == evs.longPress.menu end,
32+
+ cond = function(e, evs) return false end,
33+
func = function()
34+
setLock("display.menu")
35+
gotoPage(1)
36+
@@ -101,7 +101,4 @@ ctrlSchema = {
37+
if string.match(radio.name, "^xlite") then
38+
ctrlSchema.display.prevPage.cond = function(e, evs) return e == evs.press.pageUp end
39+
ctrlSchema.display.nextPage.cond = function(e, evs) return e == evs.release.menu end
40+
- ctrlSchema.display.menu.cond = function(e, evs) return e == 32 end
41+
- ctrlSchema.display.home.cond = function(e, evs) return e == 128 end
42+
- ctrlSchema.displayMenu.exit.cond = function(e, evs) return e == 32 end
43+
end

patches/x9pre.lua.patch

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
diff --git "a/src/SCRIPTS/BF/X9/x9pre.lua" "b/src/SCRIPTS/BF/X9/x9pre.lua"
2+
index b8a6867..a1074e1 100644
3+
--- "a/src/SCRIPTS/BF/X9/x9pre.lua"
4+
+++ "b/src/SCRIPTS/BF/X9/x9pre.lua"
5+
@@ -20,11 +20,11 @@ NoTelem = { 70, 55, "No Telemetry", BLINK }
6+
ctrlSchema = {
7+
display = {
8+
prevPage = {
9+
- cond = function(e, evs) return e == evs.longPress.page end,
10+
+ cond = function(e, evs) return false end,
11+
func = function() stepPage(-1) end
12+
},
13+
nextPage = {
14+
- cond = function(e, evs) return e == evs.release.page end,
15+
+ cond = function(e, evs) return e == evs.release.menu end,
16+
func = function() stepPage(1) end
17+
},
18+
prevLine = {
19+
@@ -43,14 +43,14 @@ ctrlSchema = {
20+
end
21+
},
22+
menu = {
23+
- cond = function(e, evs) return e == evs.release.menu end,
24+
+ cond = function(e, evs) return e == evs.longPress.menu end,
25+
func = function()
26+
setState("displayMenu")
27+
setLock("displayMenu.exit")
28+
end
29+
},
30+
home = {
31+
- cond = function(e, evs) return e == evs.longPress.menu end,
32+
+ cond = function(e, evs) return false end,
33+
func = function()
34+
setLock("display.menu")
35+
gotoPage(1)

0 commit comments

Comments
 (0)