-- Calculating average cell voltage based on telemetry main battery -- User will be voice prompted on low cell voltage -- User can select Telemtry Source, Cell count, Trigger level, delay and Alarm Interval -- by Adrian May 2020 free to reuse without any warrenty -- SETUP Guide ------------------------------------------------------------------------------------ -- Load this Script to SCRIPT/MIXES on your SD Card -- Select Script on LUA Script Screen on your Transmitter -- Enter required values local lasttime = 0 -- Saves timestamp to trigger alarm in intervals -- Input selection on LUA Sript screen on Transmitter local input = { {"Telemetry", SOURCE }, -- Select Telemetrie Source like RB1V {"Num of Cel", VALUE , 1, 14, 6 }, -- Cells from 1 to 14, default 6 {"Volt Trig", VALUE , 29,40, 34}, -- Low Voltage Level 34 = 3.4V {"Interval", VALUE , 3 , 30, 5} -- Alarm Intervall in Seconds 5..30 default 10 } -- Output on LUA screen local output = {"vcel"} -- Calculating the average and announce it once it's below this Level local function run(voltage, cell, trigger, interval) -- for debugging and testing purpose in Companion, uncomment this, but comment it again later -- voltage = 20 local avCel = voltage/cell*10 -- devide reported voltage by cell multiply by 10 to meet input range if ((avCel > 20) and (avCel < trigger)) then -- if voltage bigger 20 and smaller than trigger local timenow = getTime() -- get actual time to and compare if interval exceeded if (getTime() - lasttime > (interval * 100)) then lasttime = getTime() -- store time for next comparison playFile("SYSTEM/1048.wav") -- Play File Cell Volatage, this is a system file playNumber(avCel, 1, PREC1) -- Play voltage with Unit Voltage and 1 Decimal end end return avCel / 10 *10.24 -- lua leave devided by 1024 to represent percentage in mixer end -- Return statement to run script return { run=run, input=input, output=output }