Lua scripts: blinking lines and aligning text
Lua scripts: blinking lines and aligning text
Hello.
I have just started with the lua scripts. I am not new in programming and scripting, but new to OpenTX Lua scripts.
I am discovering peace by peace.
I am running into 2 issues:
- If I draw a line or rectangle and starts the simulator, the line or rectangle is visible, but is rappidly blinking/flickering.
Is this a simulator problem?
- Is it possible to align text center or right?
I have just started with the lua scripts. I am not new in programming and scripting, but new to OpenTX Lua scripts.
I am discovering peace by peace.
I am running into 2 issues:
- If I draw a line or rectangle and starts the simulator, the line or rectangle is visible, but is rappidly blinking/flickering.
Is this a simulator problem?
- Is it possible to align text center or right?
Re: Lua scripts: blinking lines and aligning text
If you send me your code I'll check.
Tx?
OpenTX version?
No- Is it possible to align text center or right?
Have you seen this manual?
https://www.gitbook.com/book/opentx/ope ... de/details
RCdiy.ca
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Re: Lua scripts: blinking lines and aligning text
Hello rcdiy,
Thank you for your answers.
I have seen the reference guide and already used some things of it.
My script gives the flickering lines and rectangles, even if it is the only thing in the script. Do I have placed the code in the wrong place?
I mean, the values will have to be refreshed all the time, but the lines do not....
I have sent the script with only the lines and a rectangle....and in THIS VIDEO you can see what happens in the simulator but also in the screen of my Taranis.
Oh and I am using OpenTX 2.2 on a Taranis X9D Plus.
Another question: If I have a text or value and I replace this text with another text, which is shorter than the last text, than the last part of the previous text stays visible. Do I have to clear the old text in some way, before drawing a new text?
Thank you for your answers.
I have seen the reference guide and already used some things of it.
My script gives the flickering lines and rectangles, even if it is the only thing in the script. Do I have placed the code in the wrong place?
I mean, the values will have to be refreshed all the time, but the lines do not....
I have sent the script with only the lines and a rectangle....and in THIS VIDEO you can see what happens in the simulator but also in the screen of my Taranis.
Oh and I am using OpenTX 2.2 on a Taranis X9D Plus.
Another question: If I have a text or value and I replace this text with another text, which is shorter than the last text, than the last part of the previous text stays visible. Do I have to clear the old text in some way, before drawing a new text?
- Attachments
-
- lines.lua
- (800 Bytes) Downloaded 350 times
-
- Posts: 750
- Joined: Tue Dec 27, 2011 11:22 pm
- Country: United States
- Location: Carson City, Nv
Re: Lua scripts: blinking lines and aligning text
I drop a lcd.clear() as the first line in main and the symptom went away.
Don't ask me why, as I have no idea....but it has 'fixed' some of my scripts before.
Don't ask me why, as I have no idea....but it has 'fixed' some of my scripts before.
Dean
OldDmbThms: 1. Takeoff, 2. Crash, 3. Repair, GOTO 1
OldDmbThms: 1. Takeoff, 2. Crash, 3. Repair, GOTO 1
Re: Lua scripts: blinking lines and aligning text
https://opentx.gitbooks.io/opentx-2-2-l ... rview.html
The run function is periodically called when the screen is visible. In OpenTX 2.0 each invocation starts with a blank screen (unless lcd.lock() is used). Under OpenTX 2.1 screen state is always persisted across calls to the run function. Many scripts originally written for OpenTX 2.0 require a call to lcd.clear() at the beginning of their run function in order to display properly under 2.1 and 2.2.
I suggest reading through the manual. I did but find myself having to read it again on occasion to check for updates. The manual is a work in progress.
The run function is periodically called when the screen is visible. In OpenTX 2.0 each invocation starts with a blank screen (unless lcd.lock() is used). Under OpenTX 2.1 screen state is always persisted across calls to the run function. Many scripts originally written for OpenTX 2.0 require a call to lcd.clear() at the beginning of their run function in order to display properly under 2.1 and 2.2.
I suggest reading through the manual. I did but find myself having to read it again on occasion to check for updates. The manual is a work in progress.
RCdiy.ca
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Re: Lua scripts: blinking lines and aligning text
Thank you both, the lcd.clear() function did the trick for both the flickering lines as for the text which was not overwritten...
No I have made my first telemtry screen (See attachment). Not all the functions do work yet and some values are fake values, just for testing the screen.
I now have to buy/make a APM to FrSky converter to get the fake data also filled with real world values.
But I am very excited about the possibilities with the lua scripts in my Taranis!
No I have made my first telemtry screen (See attachment). Not all the functions do work yet and some values are fake values, just for testing the screen.
I now have to buy/make a APM to FrSky converter to get the fake data also filled with real world values.
But I am very excited about the possibilities with the lua scripts in my Taranis!
Re: Lua scripts: blinking lines and aligning text
There has been talk of having the option to have the Taranis go straight to the Telemetry screen.
https://github.com/opentx/opentx/issues/5156
If that is implemented you may want to have the model name show up on that screen.... Maybe show name and disappear after a few seconds if you don't have space....
That is an awesome screen...
If you are open to sharing that script check out rcdiy.ca
https://github.com/opentx/opentx/issues/5156
If that is implemented you may want to have the model name show up on that screen.... Maybe show name and disappear after a few seconds if you don't have space....
That is an awesome screen...
If you are open to sharing that script check out rcdiy.ca
RCdiy.ca
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Re: Lua scripts: blinking lines and aligning text
In the end I want to share it, but it is not finished at the moment. There are still some things to do.
Do you know how to get the value of the transmitter battery.
I have tried things like:
getValue("Batt")
But the value stays zero.....
Do you know how to get the value of the transmitter battery.
I have tried things like:
getValue("Batt")
But the value stays zero.....
-
- Posts: 750
- Joined: Tue Dec 27, 2011 11:22 pm
- Country: United States
- Location: Carson City, Nv
Re: Lua scripts: blinking lines and aligning text
I don't think you can. getValue only works on telemetry that shows in the discovered sensors AFAIK.
None of my models show a txVolt or txBt like rxBt.
Seems to be an oversight, might be worth an OpenTx issue.
It might be worth trying "txBt" in a getValue just for laughs, but I don't think it will play.
None of my models show a txVolt or txBt like rxBt.
Seems to be an oversight, might be worth an OpenTx issue.
It might be worth trying "txBt" in a getValue just for laughs, but I don't think it will play.
Dean
OldDmbThms: 1. Takeoff, 2. Crash, 3. Repair, GOTO 1
OldDmbThms: 1. Takeoff, 2. Crash, 3. Repair, GOTO 1
Re: Lua scripts: blinking lines and aligning text
That would be a pitty....in the default telemetry screens you can select "batt"....
Verstuurd vanaf mijn A0001 met Tapatalk
Verstuurd vanaf mijn A0001 met Tapatalk
Re: Lua scripts: blinking lines and aligning text
getValue("tx-voltage")
Re: Lua scripts: blinking lines and aligning text
In the manual
https://opentx.gitbooks.io/opentx-2-2-l ... Value.html
http://downloads.open-tx.org/2.2/firmwa ... ds_x9d.txt
Last line tx-voltage
https://opentx.gitbooks.io/opentx-2-2-l ... Value.html
http://downloads.open-tx.org/2.2/firmwa ... ds_x9d.txt
Last line tx-voltage
RCdiy.ca
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Stay Safe & Have Fun
OpenTX Manual http://rcdiy.ca
Paying it forward by sharing my Lua scripts, documentation and videos.
Re: Lua scripts: blinking lines and aligning text
That did the trick! Tnx you both!
Verstuurd vanaf mijn A0001 met Tapatalk
Verstuurd vanaf mijn A0001 met Tapatalk