Skip to content

Commit

Permalink
ADDED: Fixes #1 - mah remains displayed when battery is unplugged fro…
Browse files Browse the repository at this point in the history
…m quad
  • Loading branch information
DynamikArray committed Jul 27, 2016
1 parent 27cd5e3 commit 42a1f9e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
19 changes: 15 additions & 4 deletions KISSdata.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local versionInfo = "KISS Telemetry Data - v1.2.4"
local versionInfo = "KISS Telemetry Data - v1.3.0"

local blnMenuMode = 0

Expand All @@ -12,6 +12,8 @@ local percentUnit = 13

local lastMahAlert = 0

-- Fixes mahAlert not appearing after battery disconnect
local lastKnownMah = 0

----------------------------------------------------------------
-- Custom Functions
Expand Down Expand Up @@ -75,10 +77,19 @@ end
local function drawAlerts()

percVal = 0
curMah = getValue(data.fuelUsed)
percVal = round(((curMah/mahTarget) * 100),0)

lcd.drawText(5, 10, "USED: "..curMah.."mah" , MIDSIZE)
-- Added to fix mah reseting to Zero on battery disconnects
tmpMah = getValue(data.fuelUsed)

if tmpMah ~= 0 then
lastKnownMah = tmpMah
end

-- The display of MAH data is now pulled from the lastKnownMah var which will only
-- be reset on Telemetry reset now.

percVal = round(((lastKnownMah/mahTarget) * 100),0)
lcd.drawText(5, 10, "USED: "..lastKnownMah.."mah" , MIDSIZE)
lcd.drawText(90, 30, percVal.." %" , MIDSIZE)

end
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Version 1.3.0

# KISS_Battery_Monitor
Open TX Telemetry Script for reading and announcing battery mAh consumption. Uses the mAh consumption as reported from KISS 24a ESC as Telemetry data and accepts a configurable user Target mAH and Percentage Notification. The pilot can target how much mAh they intend to use that flight, adjust this value as needed, and this will be used as the "Battery". The Percentage Notification allow for the pilot to receive verbal indication of the "Battery" at the desired intervals. During the final 10% of the "Battery" an indication is given at every 1%. After 100% usage of the "Battery" each additional % used will trigger a "Battery Critical" alarm.
Expand All @@ -18,7 +19,7 @@ ADDITIONAL STEPS FOR SOME USERS
* Some users reported not having the battery critcal alarm sound file. Since release https://github.com/DynamikArray/KISS_Battery_Monitor/tree/v1.2.3 this issue has been addressed with the inclusion of the batcrit.wav file. If your not getting the battery critical alarm, place the (batcrit.wav) if the ``` SOUNDS\en ``` of your SD Card. (Or apporiate region ```SOUNDS\fr, SOUNDS\de, SOUNDS\nl, etc..```)

* If you are having issues after installation with sound playbacks not saying percentage, instead saying "miles per hour", "feet", or something other than "Percentage" then ensure you have the correct Open TX 2.1.X SOUND/SYSTEM files installed. Open TX sound packs are available for download here: http://voices-21.open-tx.org/

# SETUP:
Attach this script to one of your TELEMETRY screens inside your radio.

Expand Down

0 comments on commit 42a1f9e

Please sign in to comment.