Page 11 of 12

Re: Script Language

Posted: Tue May 28, 2019 9:26 pm
by MikeB
As currently implemented you may NOT have a space between the function name and the '(', so you need:

Code: Select all

 rssi=getvalue( "RSSI" )
if  rssi =0
resettelemetry(4)
end
stop
then it should work.

Mike

Edit: I've done a change so, in future, a single space or tab character will be accepted between the function name and the '('. I may be able to allow more spaces/tabs, but I don't want to do a more complex change now and, possibly, break something else!

Re: Script Language

Posted: Wed May 29, 2019 6:56 am
by AlessB
Mike thanks so very much! It is working! Thanks again for a very good job!

Re: Script Language

Posted: Sun Nov 17, 2019 10:10 am
by midelic
Mike,
Is it possible to expand the use of scripts to have access to other settings like selecting model,protocol or multi settings?

Re: Script Language

Posted: Sun Nov 17, 2019 10:57 am
by MikeB
It is possible. I had not added thing like this to prevent a script from changing something important during flight. If I add these, I think I would restrict their operation to a stand alone script, not in a telemetry of background script.

Mike

Re: Script Language

Posted: Sun Nov 17, 2019 6:55 pm
by midelic
Yes of course a standalone script for safety reasons. Intended to run with purpose and not forget about it running in background.
I'm thinking to expand the functionality of a DIY D16/LBT rx with changing modes from TX screen using Telemetry basic/Lua script and changing the tx model and other possible settings correspondingly along with changing modes in the rx.This can be the base of a larger project in which I found telemetry scripts most useful.

Re: Script Language

Posted: Sun Nov 17, 2019 11:10 pm
by jhsa
What do you mean by "Changing the TX model"?

João

Re: Script Language

Posted: Mon Nov 18, 2019 7:21 am
by midelic
if proto = D16
setmodel("DogFight_X")
end

Re: Script Language

Posted: Mon Nov 18, 2019 1:36 pm
by jhsa
Why would I use a script to change models, if can do it in the radio itself without even start a script? :) It doesn't make sense at all. Write code to change a model on the same equipment where I just need to push a couple buttons to do the same task? specially when I also have to press perhaps even more buttons to start that code? :o :D :P

And what about if there are other models using proto D16??

This is exactly what was being discussed a while ago, people want to use scripts for doing stuff that can easily be done in the radio itself, like a simple mix, like a voice prompt, like a radio setting. This is an absolutely mis-use of a feature, and it can even be dangerous in some situations.
Scripts are good for doing other stuff like sharing files between radios and configuring external equipment, like receivers and sensors. They are also good to make custom telemetry screens. But I wouldn't use them for stuff that could directly or indirectly affect model control, or model selection.That would be asking for trouble in my opinion.

João

Re: Script Language

Posted: Mon Nov 18, 2019 8:16 pm
by midelic
Joao,
It is not like that to change manually or do manually routine tasks.
It is about an automatic change in base of a condition that is met in the script.
A condition that is triggered by a change in Rx modes or other Rx configuration.
Regarding risk there are many hoops and checks until that condition is supposed to be met.Any telemetry frame when is processed is passed through a string of many conditions to be met on both sides(TX and RX)

About being dangerous and risky if you run a script with specific purpose there is no difference then to change the setting manually, the perceived risk is not changed.The intent is still there.You are doing/executing a task with a specific purpose and waiting for an expected outcome.

What changed like any automation is to make easy our life and do less unnecessary routine things.
That is what scripts are made for.

Re: Script Language

Posted: Tue Nov 19, 2019 3:13 am
by jhsa
Well, I have a different point of view about this scripting thingy. It can help when put to good use. Configuring stuff, exchanging files, telemetry screens, etc.
Anything that deals with control, and when mis-used I see it as potentially dangerous. Believe me, you don't want to mess with safety when.doing model flying. It can be dangerous, expensive, it can hurt you, it can even kill you. Model flying is something serious. I have been doing this for many years, and seen many bad things happen. I have taken a few club friends to hospital, a couple of them with fingers hanging by a bit of skin.
There are limits for everything, and I do believe that Mike is an experienced model flyer and he always did very good judgement of what can be potentially dangerous. This is one of the reasons why I feel safe using ErskyTX, specially when I fly a 3.5 meter wing span 62CC Petrol powered glider tow plane.
Electric models can be even more dangerous as the motor can start at any moment without warning, unlike with an IC engine that needs to be running to be dangerous. I just had one model nearly jumping out of my table recently because I didn't follow the rules. I could have destroyed my model, my computer screen, and worse, I could have hurt myself or someone from my family. :(
The problem is that today people do not get educated about model flying as everything is made available for anyone to buy without having to learn the basics of how to safely use it.
Always have respect for model aircraft, and for the people that are around you when you when you're flying it. Even keeping to the rules accidents happen, without keeping to them, is pushing our luck.
But what does this have to do with scripts?
Well, everything if it messes with controlling a model, or if there is any chance it will interfere with the control.
In my opinion, scripts should NEVER be used to control models. Leave that for the military..

João




Re: Script Language

Posted: Tue Nov 19, 2019 6:58 am
by midelic
Joao,
You know when the train was invented many said that the speed of train will make people collapse and die.Better use horses,trains are dangerous(and they are).
Progress always bring fears in people.And also people always will try to improve things.One invention or innovation will lead to another that is inspired by the previous one.This is how it works, this is how things improved.This is how we have internet this is how we have ersky9x tx with scripting features voice and multiprotocol .
And code is already used to control models or drones(way-points using GPS ,altitude hold,follow me,RTH(return to home)failsafes features) are doing just that).Even now with the existing telemetry scripting I can control a model and I did.
Anyway if Mike want to add this feature for scripts ,ok if not again is ok.It is not something to loose my sleep over.

Re: RE: Re: Script Language

Posted: Tue Nov 19, 2019 8:35 am
by lshems
midelic wrote:Joao,
You know when the train was invented many said that the speed of train will make people collapse and die.Better use horses,trains are dangerous(and they are).
Progress always bring fears in people.And also people always will try to improve things.One invention or innovation will lead to another that is inspired by the previous one.This is how it works, this is how things improved.This is how we have internet this is how we have ersky9x tx with scripting features voice and multiprotocol .
And code is already used to control models or drones(way-points using GPS ,altitude hold,follow me,RTH(return to home)failsafes features) are doing just that).Even now with the existing telemetry scripting I can control a model and I did.
Anyway if Mike want to add this feature for scripts ,ok if not again is ok.It is not something to loose my sleep over.
Scripts are very useful to expand the user interface to support use cases that are not standard, or that force people into a limited set of options in order to easy the installation/setup of some specific models.

You can check www.justfly.solutions to see that in place for opentx.

And yes, changing even a model could well be a useful feature of the scripting API.

There is nothing to be afraid of.

Re: Script Language

Posted: Tue Nov 19, 2019 1:31 pm
by jhsa
Guys, if you have the radio in your hands, why do you want to start a script to change a model in the same radio? :O
Do you guys really know how model flying works?? :) Do you know anything else than drones? (Multirotors)
Or do you only only fly drones?
Talking about progress, there is progress done wisely, which is the good one,
And there is stupid addition of features that are dangerous and make no sense, only because you can add them..
But only because you can it doesn't mean you should.
And let's not even talk about drones, because it is due to the mis-use of such (so called) "progress" that today our hobby has hundreds of limitations. :(
Some people have absolutely no respect for the basic model flying safety rules, and then we see legislation being made limiting our hobby. Most don't even know'about those rules. The rules were the first thing I have learnt, even before I was allowed to touch a radio.
Models are not toys. They can kill you, even the small ones, and if they get out of control they can also injure or kill someone else.
And before you say that I am over reacting, please do a test. Let the smallest / lightest long distance drone (above 100 grams) fall on your head, or on your car from 50 meters high, and.then come back here to share the results.

João

Re: RE: Re: Script Language

Posted: Tue Nov 19, 2019 5:30 pm
by lshems
jhsa wrote:Guys, if you have the radio in your hands, why do you want to start a script to change a model in the same radio? :O
Do you guys really know how model flying works?? :) Do you know anything else than drones? (Multirotors)
Or do you only only fly drones?
Talking about progress, there is progress done wisely, which is the good one,
And there is stupid addition of features that are dangerous and make no sense, only because you can add them..
But only because you can it doesn't mean you should.
And let's not even talk about drones, because it is due to the mis-use of such (so called) "progress" that today our hobby has hundreds of limitations. :(
Some people have absolutely no respect for the basic model flying safety rules, and then we see legislation being made limiting our hobby. Most don't even know'about those rules. The rules were the first thing I have learnt, even before I was allowed to touch a radio.
Models are not toys. They can kill you, even the small ones, and if they get out of control they can also injure or kill someone else.
And before you say that I am over reacting, please do a test. Let the smallest / lightest long distance drone (above 100 grams) fall on your head, or on your car from 50 meters high, and.then come back here to share the results.

João
Sorry, but I really think you are ranting over nothing.

Did you even check what can be done by scripts in opentx?

I don't use this software, I don't like opentx, I do like to make things simpler using scripts.

I don't fly drones, I don't fly anything with a motor (except for testing things out, like f5k), and even if I would your post makes no sense to me.

But hey, who am I?

Better question perhaps, who do you think YOU are to post such a rant?

Can't you keep it to the facts?

I just see a shouting post without any real arguments.
On top of that, it's not you who has to do anything or use anything.

Sorry, but really over the edge.

Have fun and just fly!

Re: RE: Re: Script Language

Posted: Tue Nov 19, 2019 8:08 pm
by jhsa
lshems wrote: Tue Nov 19, 2019 5:30 pm

Better question perhaps, who do you think YOU are to post such a rant?

Ha ha ha ha , you just made me laugh with this one.. I am rolling on my back right now.. No, not right now because I am writing :mrgreen: but I was a while ago.. Good joke :mrgreen:

Well simple answer anyway, not that you deserve it though.. ;) :shock: :lol:

I am someone entitled to write my opinion as much as you are to write yours. And I WILL say what I think, no matter who you are, and whether you like it or not..
But if you are that interested in knowing who I am, I suggest you read the complete forum from the beginning. :)
Over 19000 posts here, most of them helping others. You? 17?? I guess you really can't know who I am.. :mrgreen:

No, it is not up to me to decide what features are implemented on the firmware, but I am really glad that the person that does it is a very wise person and puts safety above all as far as I know.
And I know that whatever he implements. it will be safe..

As you say "Have fun and just fly!"

João

EDIT: And what I said on my last post is not a rant at all. It is ALL TRUE..

Re: Script Language

Posted: Tue Nov 19, 2019 8:22 pm
by lshems
Pityfull selfimage.

I feel sorry for having provoked this conversation.

Re: Script Language

Posted: Tue Nov 19, 2019 8:26 pm
by jhsa
Me too.. :)

Your opinion, but you are entitled to think whatever you want.. we have different opinions and I respect that, but it seems you don't.
Peace.. ;)
João

Re: RE: Re: Script Language

Posted: Tue Nov 19, 2019 8:37 pm
by lshems

jhsa wrote:Me too.. :)

Your opinion, but you are entitled to think whatever you want.. we have different opinions and I respect that, but it seems you don't.
Peace.. ;)
João
It is again over the edge to project assumptions on my definitions of respect.

I can respect any opinion, if brought with arguments. You don't bring any arguments, just a lot of assumptions over attitude, behaviours and preferences, that you than arbitrarily link to classifications of good and bad, based on I don't know what.

I don't want to be the last to speak, but I won't take insinuations without objecting them, whether true or false.

Re: RE: Re: Script Language

Posted: Tue Nov 19, 2019 8:46 pm
by jhsa
lshems wrote: Tue Nov 19, 2019 5:30 pm

Did you even check what can be done by scripts in opentx?
Yes, i know very well what can be done.

I
don't use this software, I don't like opentx, I do like to make things simpler using scripts.
Well, we agree on this one.. But there is a difference.
You see, I do also like to make things simpler using scripts, but, there are limits.. What I said above, and say it again, is that in MY OPINION, they should not be used on anything related to controlling a model, or that could put other people and their
property in danger.
Apart from that, I love them.. Heck, I love the one that allows us to send files from one radio to the other over Bluetooth..
I use it all the time to share files between my radios. And before you ask, no, they are not frsky radios, nor Jumper T16 radios. But yes, they can send files (models, voice files, scripts) to each other over Bluetooth using ErskyTX. Thanks for this Mike.

João

Re: RE: Re: Script Language

Posted: Tue Nov 19, 2019 8:53 pm
by jhsa
lshems wrote: Tue Nov 19, 2019 8:37 pm

It is again over the edge to project assumptions on my definitions of respect.

I can respect any opinion, if brought with arguments. You don't bring any arguments, just a lot of assumptions over attitude, behaviours and preferences, that you than arbitrarily link to classifications of good and bad, based on I don't know what.

I don't want to be the last to speak, but I won't take insinuations without objecting them, whether true or false.
All I said above about safety is true. All I said above about people flying drones where they shouldn't and damaging our hobby, is true. Youtube is full of videos of people doing just that.

Do you want more arguments than that? You don't see them because you do not want to see them. Models can kill, even gliders. A couple years ago, a man was killed in Germany when he was hit by a model glider. Google it, you will find it.
I don't mess with safety, or at least I try not to.

João

Re: Script Language

Posted: Tue Nov 19, 2019 9:28 pm
by jhsa
Why we should care about safety. It can happen when we respect the rules. Never mind when we do not respect them.
Model aircraft are not toys.

Germany, the one i mentioned above. it is in german, you need to use google translator if you don't understand German.

https://www.welt.de/vermischtes/article ... offen.html

England,

https://www.dailymail.co.uk/news/articl ... plane.html

Taiwan, a few days ago, another glider...

https://taiwanenglishnews.com/woman-kil ... estioning/

Heli

https://www.independent.co.uk/news/worl ... 01350.html

And the list could go on.. Now call this also a rant.. :(

João

Re: Script Language

Posted: Tue Nov 19, 2019 10:36 pm
by lshems
You really don't get it do you?

You want to prove driving cars by women is dangerous? You don't do that by listing car accidents.
You show that by proving it is the women that drove those cars.

Turns out you can't prove that.

Same for these model aircraft accidents.
None of these accidents are related to the discussion about the 'danger of scripts'.
It is rather distastefull to reference these deadly accidents, of which I am very well aware, to try and prove a point about using a script being dangerous.

The German accident was at a flying field I regularly fly at.

The Taiwan one triggered me to put the safety issue on the agenda of our flying club again.

You are just linking an unknown and unspecified use of scripts linked to your perception of its intended use to dead and terror.

Just being behind a wheel doesn't make you a killer. Just using scripts to change a model neither.

This entire discussion is taken completely out of reality.
Wake up, and fight for more pedestrian crossings in London.
Might safe more lives than preventing me or someone else changing a model with a script.

The poor guy posting the suggestion was already gone, and you start ranting.

Really, trying to turn a rant into an argumentative discussion by randomly linking mortal accidents is simply cheap and untasteful.

Opinion.

Re: Script Language

Posted: Tue Nov 19, 2019 11:11 pm
by jhsa
lshems wrote: Tue Nov 19, 2019 10:36 pm
Same for these model aircraft accidents.
None of these accidents are related to the discussion about the 'danger of scripts'.
It is rather distastefull to reference these deadly accidents, of which I am very well aware, to try and prove a point about using a script being dangerous.
No, you don't get the point. What I am trying to say is that accidents already happen even if we don't do stupid or dangerous things with our equipment.
But if you want to speak about cars, I speak about airplanes. I wonder then why they still have pilots in the passenger planes cockpits.. They could use just a few scripts to control the thing, right? ;)
Well, I wouldn't get my back side on one of those planes if there wasn't a pilot in the cockpit.. :)


The Taiwan one triggered me to put the safety issue on the agenda of our flying club again.
That is a very good idea.
You are just linking an unknown and unspecified use of scripts linked to your perception of its intended use to dead and terror.
No, what I am trying to say all this time, is that I find allowing scripts to control models dangerous, but you don't seem to understand that, or perhaps you just do not respect my opinion.
Just being behind a wheel doesn't make you a killer. Just using scripts to change a model neither.
I never said that. I shared my opinion about scripts controlling a model.

Oh, by the way, question, now I am curious, In what situation would you use a script to change a model? Well scripts are started from the radio, right? Once you selected the correct model, you shouldn't need to select another model while you fly that one, right? And if you want to fly another model, you just hit Model select and select the model. Why would you want to start a script to change a model, when you can just hit a button and change it anyway? This makes no sense at all :)
This entire discussion is taken completely out of reality.
Wake up, and fight for more pedestrian crossings in London.
Might safe more lives than preventing me or someone else changing a model with a script.
First you accuse me of saying that women can't drive, Now you say that people from London can't drive? C'mon man, make up your mind.. :mrgreen:
The poor guy posting the suggestion was already gone, and you start ranting.
No he is not gone.. He actually knows my rants very well :) :mrgreen: And he is not a poor guy, he is actually a very intelligent person, and a hell of a developer. I build a few of his projects and have been helping him on another great project lately. And we like to make sure it is safe. And he knows I always do my best to help him make it safer. But he also knows I do not agree with everything he says, and he knows that safety is paramount for me. Unfortunately, I also do a lot of mistakes, but I try to learn from them.
By the way, you should build his DIY receiver as well, you would like it :D
Frsky compatible D16 protocol, SBUS, SPORT, and many other goodies. And it tested really good in the air. :)
Really, trying to turn a rant into an argumentative discussion by randomly linking mortal accidents is simply cheap and untasteful.

Opinion.
Yep, your opinion :mrgreen:
Well, you have your opinion, I have mine. I respect yours, and I would like you to respect mine. But that seems to be quite impossible.. I don't mind, I am enjoying it.. :)
If you ever come a bit more north, you're invited to fly at our field, but you need to have an insurance of course. :)
Ah, and I won't let you any near my scripts, as you might want to control your model with them :mrgreen: or even worse, my model :) :D
Have a beer.. :mrgreen:

João

Re: Script Language

Posted: Tue Nov 19, 2019 11:31 pm
by lshems
Respecting an opinion is not the same as respecting someone having an opinion.

I cannot respect an opinion I don't agree with, because this use of the word respect means confirming to.

I do respect the right everyone has to have an opinion. Just don't suggest I should do something I am not according to you, using respect in the same phrase.

Between the lines I can read that you are really concerned about safety. Nothing wrong with that.

To take up the glove, yes I can think of a safe usage of changing models by a script.

It is actually used on some radios currently.

It is to have flight modes, a concept that allows to switch different control configurations depending on the mode of flying.

So to have, or have more, flight modes.

It assumes of course the switching if models is fast enough.

For the rest, I don't see ANY risk in doing this.

And really, I don't object a clear viewpoint on something.
But use arguments that make sense.

And respect is earned, not a right.

Have fun and just fly.

Re: Script Language

Posted: Tue Nov 19, 2019 11:58 pm
by jhsa
lshems wrote: Tue Nov 19, 2019 11:31 pm Respecting an opinion is not the same as respecting someone having an opinion.

I cannot respect an opinion I don't agree with, because this use of the word respect means confirming to.
Not really, you don't have to agree with someone's opinion to respect it.
I do respect the right everyone has to have an opinion. Just don't suggest I should do something I am not according to you, using respect in the same phrase.
No obviously we have different idea about what respect is.
Between the lines I can read that you are really concerned about safety. Nothing wrong with that.
Really, I am Gobsmacked :mrgreen: Thanks.. :D
To take up the glove, yes I can think of a safe usage of changing models by a script.

It is actually used on some radios currently.

It is to have flight modes, a concept that allows to switch different control configurations depending on the mode of flying.

So to have, or have more, flight modes.

It assumes of course the switching if models is fast enough.
You are talking about switching "Flight Modes" (yes I do know what they are), not about switching Models.
What was suggested many posts above was to switch MODELS not modes.

But use arguments that make sense.
well, they make sense to me.. :D
And respect is earned, not a right.
No, you see, I disagree with you again. Everyone has the right to be respected. I respect other people even if I don't know them. So, they don't have to prove anything to me for me to respect them.
For respect to be earned, as you say, you imply that you already have met the other person before, and they had to prove to you that thy deserve your respect.
I am the opposite, everybody has my respect, until they prove they don't deserve it.. So, yeah, everybody has the right to be respected, along with their opinions, even if i do not agree with them.. and that includes you ;) :)
Have fun and just fly.
Oh yeah, I surely do :)

This beauty has taken many big gliders up. Safely
No scripts on this one.. :)

Image

Re: Script Language

Posted: Wed Nov 20, 2019 1:02 am
by lshems
You are just discussing for the sake of discussion.

Perhaps me too.

If you don't have flight modes supported on your radio, switching models (on the radio) is way you can functionally achieve the same.

But ok, you try to read everything in a way that isn't meant, so you clearly just want to score a point.

I no, nobody has the right to be respected, as everybody has the right to his own choices, even if that is not respecting someone.

Rather filosofical. But exactly where you touch my personal integrity by trying to oblige me to make a choice respecting you. No matter if I do or not.

Funny discussion, but way of topic, and very questionable argumentations used.

Opinion. Lol.

Re: Script Language

Posted: Wed Nov 20, 2019 1:52 am
by jhsa
lshems wrote: Wed Nov 20, 2019 1:02 am
If you don't have flight modes supported on your radio, switching models (on the radio) is way you can functionally achieve the same.
If you don't have flight modes on your radio, I doubt it will support scripting. I don't know any. If you do please let me know. :)
As far as I know only OpenTx and ErskyTX support scripts, and both have plenty of flight modes. But hey, perhaps we should ask Mike to remove the flight modes from ErskyTX so we could use scripts to change models, only because it is kinda cool eh? :lol: :mrgreen: So, that argument makes absolutely no sense. But whatever...
But ok, you try to read everything in a way that isn't meant, so you clearly just want to score a point.
Or perhaps you.. :D
I no, nobody has the right to be respected, as everybody has the right to his own choices, even if that is not respecting someone.
wow... :shock: That's very deep, perhaps even rather philosophical :mrgreen:
Rather filosofical. But exactly where you touch my personal integrity by trying to oblige me to make a choice respecting you. No matter if I do or not.
Wrong, I couldn't care less if you respect me or not.. And not asking you to, far from it, actually I really hope you don't.. I just find this interesting I am actually just having a good laugh at it..
Funny discussion, but way of topic, and very questionable argumentations used.
Yeah, specially the part of the flight MODELS.. :mrgreen: :mrgreen: :mrgreen:

Ok, it's been an entertaining discussion, but it is time for my to sign off. Enough is enough.. But very entertaining indeed:) Flight Models.. :mrgreen:

Re: Script Language

Posted: Wed Nov 20, 2019 7:24 am
by lshems
You asked for a possible example, I gave one.

I hope you enjoyed the conversation. At least I did.

Learned some things about attitude and respect.

Might come in handy some time in life.

Have fun and just fly!

Re: RE: Re: Script Language

Posted: Wed Nov 20, 2019 11:41 am
by jhsa

lshems wrote:
Learned some things about attitude and respect.
Good, I am always glad to help someone. [emoji14]

When I asked for an example, I was asking for a real ErskyTX example, which is what is being discussed here. Not another radio running whatever firmware, that doesn't have flight modes but can run scripts.
Even if it existed, it doesn't run ErskyTX. So, talking about bad arguments?

This comes back to what I said on my.first post on this subject. It seems people want to use scripts by force, for doing stuff that the radio can do using its own settings.
And again, IN MY OPINION this could happen due to the fact that people do not know how to use their radio.
They are great if you want a specific telemetry screen and the radio doesn't have it. They are great as configuration tools. They are great for stuff that the radio cannot do.
And we must not forget that a script running cost lots of RAM memory. But this is taken care of as far as I know. Mike wouldn't allow scripts running if they used RAM to a dangeroud level.
But, learn how to use your radio, and see if it can do what you need without using a script first.
ErskyTX can do stuff that even I can't imagine. I say "even I" because I have been using Er9x and ErskTX for over 8 years now. I have seen people doing impressing stuff with it.
And if you are really interested in learning, I have made some video tutorials. They are a bit old now, but still valid. Terrible English though.. :)
Just follow the link below all my comments.

João

Re: Script Language

Posted: Fri Nov 13, 2020 9:12 am
by spinorkit
Hi Mike,
I am wondering why a line like
drawtext(0,0,"------\0AUTO \0 500Hz\0 250Hz\0 200Hz\0 150Hz\0 100Hz\0 50Hz\0 25Hz\0 4Hz"[0])
causes interpreter.exe to crash?

Is the source available?
Is there a better way to display an string from a lookup?
Thanks,
Kit