• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Taranis Q X7 OpenTX Battery Capacity Remaining Lua Script

#1
Taranis Q X7 OpenTX Battery Capacity Remaining Lua Script
http://rcdiy.ca/battery-capacity-remaining/
https://youtu.be/AeMpwOn516s

The battery capacity remaining script was taken by a user, improved, and sent back to me to share with the community. This is what open source is all about!

Besides battery capacity remaining based on mAh we now have the option to use the script with just a voltage sensor. We also have some cool and silly sound effects when you allow your battery to run down too low :)

Check out the blog post and video.

Stay Safe & Have Fun
 
Last edited:
#2
Hey man, tried this on my Q X7 but unfortunately it doesn't seem to work with the newest version of OpenTX (2.2). I get a

"Script syntax error
TELEMETRY/mAhRe2.lua:7 unexpected symbol near <"

That, or I'm doing something wrong. Not sure what. Not new to OpenTX but this is my first time trying a Lua.
 
Last edited:
#6
Oh... no. I just downloaded the Zip that contained everything.

Weirdly, I did what you suggested, and now it works :)

Could you explain why? It was mAhRe2.lua in the Zip, but the contents are totally different from the one when downloading the way you show. (Looking at it with Lua editor).
 
#7
I should have mentioned - I apologize for not. I am using the 150A Hall effect sensor, not the 40A one with VFAS. So I went to the Lua and disabled the voltage sensor. All is well in that regard and it&#8217;s no longer on the screen when the script is running.

However for some reason, while both real-time current and max current are working, I do not get mAh consumption and thus mAh remaining is not changing. Is there any reason because of the sensor I am using that would cause that? I knew it was designed for a different sensor but I knew that they were probably similar enough (since they both put Amps on the same Telemetry sensor in OpenTX, Curr) that it should at least work with current and mAh. Am I wrong to assume that?
 
Last edited:
#8
I apologize once again - I should do more research before I ask a stupid question :rolleyes:

Realized that I needed to create the sensors for mAh consumed in the Taranis.... works perfectly now :)
 
#9
Wonderful:)
I checked and the zip file does not have the lua script. I've kept it separate so that tracking code changes is easier.
 
#10
hello , first of alll thank you very much for the very useful script. I have some problems while making it work. i am using only the frsky 150a hall sensor. i deactivated vfas by writing

local VoltageSensor = "" -- optional set to "" to ignore
local mAhSensor = "Cons" -- optional set to "" to ignore

and i changed the following and make true


local WriteGVBatRemmAh = true -- set to true to turn off write
local WriteGVBatRemPer = true

and from flight mode page FM0 i put GV7 22 for 2200 battery

Everything is ok till here ,i can see the flight battery monitor page
At this page i see
curr and max correctly
but i couldnt see the change in the Cons and Remaining section
Cons 0mah and remaining 1760 80% always seen but do not change after some consumption.
Also in the main screen 1760mah and 80% always seen but do not change.


if you can help me i will be very happy. Sorry i am very new in lua scripts maybe i do something wrong which is very easy.
 
Last edited:
#12
Taranis Q X7 OpenTX Battery Capacity Remaining Lua Script
http://rcdiy.ca/battery-capacity-remaining/

The battery capacity remaining script was taken by a user, improved, and sent back to me to share with the community. This is what open source is all about!

Besides battery capacity remaining based on mAh we now have the option to use the script with just a voltage sensor. We also have some cool and silly sound effects when you allow your battery to run down too low :)

Check out the blog post and video.

Stay Safe & Have Fun
Hi,
is there a version for HORUS? I use the 40A sensor.
Thanks Max