Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script iNav error: /SCRIPTS/TELEMETRY/iNav.lua:375: bad argument #3 to 'drawText' (string expected, got nil) #43

Closed
MRC3742 opened this issue Nov 2, 2017 · 8 comments

Comments

@MRC3742
Copy link

MRC3742 commented Nov 2, 2017

Telemetry screen will display properly with versions up to and including v1.1.1
After that version I am getting a Syntax error immediately upon switching to the telemetry screen.

With current development version 1.1.6, error is in line 375 and states in debug as follows:
Script iNav error: /SCRIPTS/TELEMETRY/iNav.lua:375: bad argument #3 to 'drawText' (string expected, got nil)
The problem seems to be in the "ext" value. This seems to be the descriptor that follows the telemetry values listed ( ft, mph, A, %, V, db)
If I change "ext" to a numeric value, such as "5" the script will run with 5 shown as the descriptor in all telemetry fields.

Possibly a problem with my setup as no one else seems to be having an issue?

Taranis X9D+ OpenTX v2.2.0
SPRacing EVO with INav v1.8.0 and Ublox GPS
X4R(SB) RX with S.port telemetry
No Current Sensor

@MRC3742
Copy link
Author

MRC3742 commented Nov 2, 2017

Problem solved and yes it was in my setup.

Telemetry distance sensor 0420 was renamed to Dist as per README.md instructions but it had a value descriptor of "Raw(-)"
I manually changed this value to "ft" and all is working again with v1.1.6.

This is how OpenTX discovered that sensor and deleting all sensors and rediscovering did not cure the issue. Possibly an addition to the renaming instructions to also check its descriptor value and set to either "ft" or "m"

This issue can be closed as this description above was the fix.

@teckel12
Copy link
Owner

teckel12 commented Nov 2, 2017

@MRC3742 Looking into this now. I added the auto metric/imperial calibration and indication and maybe didn't test this with the default sensors.

@teckel12
Copy link
Owner

teckel12 commented Nov 2, 2017

@MRC3742 Good catch! I didn't account for a zero value for the sensor unit (Lua uses a base of 1 for arrays). Changing the unit of the sensor to m or ft is the correct solution. But, I've released a v1.1.7 which will avoid this error and defaults the senor to meters unless you change it to feet.

No reason for you to upgrade to v1.1.7 as there's no other changes and you've already set the Dist sensor's unit.

@teckel12 teckel12 closed this as completed Nov 2, 2017
@shaiss
Copy link

shaiss commented Apr 27, 2018

Maybe I'm missing something, but I have this same error and just downloaded the master.zip. Running the script I get the same error as the OP. on the sensors I have 16: 0402 0. I'm not sure where I would set this to f or m. Any help would be appreciated. Thank you! My other senor values work as expected.

@teckel12
Copy link
Owner

@shaiss This is a very old error which was corrected so it shouldn't be for the same reason. Basically, if you're getting this error, it's probably not related.

In any case, your 0420 sensor needs to be changed. To do this, from your transmitter go to the TELEMETRY screen, scroll down to sensor 0420 and in the Name field change the sensor name to Dist (case is important). Next, scroll down to the Unit field, hit Enter, and change the unit to ft or m.

Let me know how that works for you.

@teckel12 teckel12 reopened this Apr 27, 2018
@shaiss
Copy link

shaiss commented Apr 28, 2018 via email

@teckel12
Copy link
Owner

@shaiss I don't believe it has anything to do with the Dist sensor. This issue was something totally unrelated (other than a similar error message).

I would really need to know what version of Lua Telemetry you're running, if you're running the S.Port or F.Port protocol, and a telemetry log file from your transmitter would also be great (you can turn on telemetry logs and have every sensor value logged). I have mine set to log something like 10 times a second, but you could change the frequency if you wish. It's a good idea anyway as the information you get could be very valuable at some point.

Also, when do you get this error, as soon as you start? Once something happens (like armed), etc. You may also want to try the development version (v1.2.5) that you can get here.

Finally, you may want to open a new issue as this issue is totally unrelated. It's a script error, but EVERY error is a script error.

@teckel12 teckel12 changed the title Script Syntax Error Script iNav error: /SCRIPTS/TELEMETRY/iNav.lua:375: bad argument #3 to 'drawText' (string expected, got nil) Apr 28, 2018
@teckel12
Copy link
Owner

teckel12 commented Apr 28, 2018

@shaiss Actually, to keep things clear, I've opened a new ticket for your problem. The link to the issue is #103

I also believe I may know what the problem is (see the link to the issue above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants