Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ###############################################################
- -- # #
- -- # Telemetry Lua Script Naze32, Version B1.0 #
- -- # #
- -- # + naze32 telemetry enabled #
- -- # + tested with D4r-II #
- -- # #
- -- # License (Script & images): Share alike #
- -- # Can be used and changed non commercial #
- -- # #
- -- # Inspired by SockEye, Richardoe, Schicksie, lichtl #
- -- # #
- -- # Änderungen: ben_ FPV-Community #
- -- # #
- -- ###############################################################
- local function run(event)
- -- ###############################################################
- -- Batteriestand Leer | Einfach anpassen
- -- ###############################################################
- local four_low=13.5 -- Akku 4s | Warnung, Entladezustand, Restspannung
- local three_low=10.6 -- Akku 3s | Warnung, Entladezustand, Restspannung
- -- ###############################################################
- -- Batteriestand Voll | Einfach anpassen
- -- ###############################################################
- local four_high=16.5 -- Akku 4s | Ladezustand, Spannung bei vollem Akku
- local three_high=12.5 -- Akku 3s | Ladezustand, Spannung bei vollem Akku
- -- ###############################################################
- -- Batteriestand
- -- ###############################################################
- local battype = 3
- local battypestr="_S"
- local percent=0
- local batt_sum = getValue("Cels") -- old "cell-sum" -> Cels
- if batt_sum>3 then
- battype=math.ceil(batt_sum/4.25)
- if battype==4 then
- battypestr="4S"
- percent = (batt_sum-four_low)*(100/(four_high-four_low))
- end
- if battype==3 then
- battypestr="3S"
- percent = (batt_sum-three_low)*(100/(three_high-three_low))
- end
- end
- local myPxHeight = math.floor(percent * 0.37)
- local myPxY = 11 + 37 - myPxHeight
- lcd.drawPixmap(3, 1, "/SCRIPTS/BMP/battery.bmp")
- if percent > 0 then
- lcd.drawFilledRectangle(8, myPxY, 21, myPxHeight, FILL_WHITE )
- end
- local i = 36
- while (i > 0) do
- lcd.drawLine(7, 11 + i, 27, 11 +i, SOLID, GREY_DEFAULT)
- i= i-2
- end
- --if (percent < 50) then
- --playFile("SOUNDS/en/5Left.wav")
- --end
- if (percent < 15) then
- lcd.drawNumber(4,55, batt_sum ,PREC2 + LEFT + BLINK)
- else
- lcd.drawNumber(4,55, batt_sum ,PREC2 + LEFT)
- end
- lcd.drawText(lcd.getLastPos(), 55, "v ", 0)
- lcd.drawText(lcd.getLastPos(), 55,battypestr,0)
- -- ###############################################################
- -- Timer
- -- ###############################################################
- local timer = model.getTimer(0)
- lcd.drawText(98, 45, "Timer:",SMLSIZE, 0)
- lcd.drawTimer(133, 41, timer.value, MIDSIZE)
- -- ###############################################################
- -- Cell voltage / Clock
- -- ###############################################################
- lcd.drawText(38,3, "Cell:",SMLSIZE,0) -- this is a custom sensor - use whatever senssor you have or switch to clock below
- lcd.drawNumber(38, 12, getValue("Cell"), PREC2 +LEFT+MIDSIZE) -- lcd.drawTimer(38, 12, getValue(190), LEFT+MIDSIZE)
- -- ###############################################################
- -- Gas Anzeige in %
- -- ###############################################################
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- lcd.drawText(98, 31,"THR %: ",SMLSIZE, 0)
- lcd.drawText(133,27," ",MIDSIZE,0)
- lcd.drawText(133,27,round((getValue(MIXSRC_Thr)/10.24)/2+50,0),MIDSIZE,0)
- -- ###############################################################
- -- Modellbezeichnung zum ändern hier
- -- ###############################################################
- lcd.drawText(98,12,"ZMR250",MIDSIZE) -- model text, moved up top since I don't use baro modes
- -- ###############################################################
- -- Flugmode Bild
- -- ###############################################################
- lcd.drawPixmap(65, 1, "/SCRIPTS/BMP/fm.bmp") -- this is using a custom quadcopter icon, adjust to fit (i didn't like the plane)
- -- ###############################################################
- -- Flightcontrol DISARMED/ARMED switch SF
- -- ###############################################################
- if getValue(MIXSRC_SF)<0 then -- switch SF
- lcd.drawText(38, 31, "FC DISARMED",SMLSIZE)
- else
- lcd.drawText(38, 31, "FC ARMED ",SMLSIZE) -- added spaces
- end
- -- ###############################################################
- -- Beeper ON/OFF switch SA
- -- ###############################################################
- if getValue(MIXSRC_SA)<0 then -- switch SA
- lcd.drawText(38, 45, "BEEPER OFF",SMLSIZE)
- else
- lcd.drawText(38, 45, "BEEPER ON ",SMLSIZE)
- end
- -- ###############################################################
- -- Flightmode1 Level/Horizon/Acro switch SD
- -- ###############################################################
- if getValue(MIXSRC_SD)<0 then -- switch SD
- lcd.drawText(98,1,"Acro ",MIDSIZE) -- Startmode
- elseif getValue(MIXSRC_SD) == 0 then -- switch SD
- lcd.drawText(98,1,"Horizon",MIDSIZE)
- else
- lcd.drawText(98,1,"Angle ",MIDSIZE) -- Level renamed to Angle mode for CleanFlight
- end
- -- ###############################################################
- -- Displays xyz data
- -- ###############################################################
- -- lcd.drawNumber(65,55,getValue("tx-voltage"),PREC1+SMLSIZE,0) -- this doesn't work :(
- -- lcd.drawText(lcd.getLastPos(), 56, "v Tx", SMLSIZE)
- -- ###############################################################
- -- Displays RSSI data
- -- ###############################################################
- if getValue("RSSI") > 38 then
- percent = ((math.log(getValue("RSSI")-28, 10)-1)/(math.log(72, 10)-1))*100
- else
- percent = 0
- end
- if percent > 90 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI10.bmp")
- elseif percent > 80 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI09.bmp")
- elseif percent > 70 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI08.bmp")
- elseif percent > 60 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI07.bmp")
- elseif percent > 50 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI06.bmp")
- elseif percent > 40 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI05.bmp")
- elseif percent > 30 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI04.bmp")
- elseif percent > 20 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI03.bmp")
- elseif percent > 10 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI02.bmp")
- elseif percent > 0 then
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI01.bmp")
- else
- lcd.drawPixmap(164, 1, "/SCRIPTS/BMP/RSSI00.bmp")
- end
- lcd.drawChannel(178, 55, 200, LEFT) -- dB text not needed, included in value
- end
- return { run=run }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement