0% found this document useful (0 votes)
5 views2 pages

RPM and Fuel Flow Visualization Code

Uploaded by

axel.lory12345
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

RPM and Fuel Flow Visualization Code

Uploaded by

axel.lory12345
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

function onTick()

rpmLeft = [Link](1)
rpmRight = [Link](2)
fuelFlow = [Link](3)
-- your code
end

function onDraw()
h = [Link]()
w = [Link]()
local centerH = h/2
local centerW = w/2
[Link](10,10,20)--bleu exterieur
[Link]()

[Link](27,40,56)--bleu ecriture
[Link](100,100,100)--blanc vvent
[Link](5,5,10)--gbleu fonce

[Link](27,40,56)

drawBar(centerW - 7, 60, rpmRight, 30, 6, 10, 3, 5) -- RPM optimal entre 5


et 10 rps
drawBar(centerW, 60, fuelFlow, 40, 6, 8, 0.5, 1.5) -- Fuel optimal
entre 3 et 7 L/s
drawBar(centerW + 7, 60, rpmLeft, 30, 6, 10, 3, 5)

[Link](100,100,100)--blanc vvent
[Link](centerW - 12,3, 20, 15)
[Link](centerW - 31, 38, 17, 15)
[Link](centerW + 13, 38, 17, 15)

[Link](centerW - 10, 5, "L/s")


[Link](centerW - 10, 11, [Link]("%.1f", fuelFlow))

-- RPM Droit (gauche de la jauge)


[Link](centerW - 30, 40, "RPS")
[Link](centerW - 30, 46, [Link]("%.0f", rpmRight))

-- RPM Gauche (droite de la jauge)


[Link](centerW + 14, 40, "RPS")
[Link](centerW + 14, 46, [Link]("%.0f", rpmLeft))

end
function drawBar(x, y, value, maxHeight, width, maxValue, optMin, optMax)
if maxValue == 0 then maxValue = 1 end

local ratio = value / maxValue


local barHeight = [Link](ratio, 1) * maxHeight

local left = x - width / 2


local top = y - maxHeight
local optTop = y - ([Link](optMax / maxValue, 1) * maxHeight)
local optBottom = y - ([Link](optMin / maxValue, 1) * maxHeight)
[Link](0,40,29) -- bleu écriture
[Link](left, optTop, width, optBottom - optTop)

-- Contour de la barre
[Link](27,40,56) -- bleu écriture
[Link](left, top, width, maxHeight)

-- Couleur selon dépassement


if value > optMax then
if value > maxValue then
[Link](100, 0, 0)
else
[Link](100, 30, 0)

end

elseif( value < optMin )then


[Link](100, 100, 30)

else
[Link](0, 100, 30)

end

-- Remplissage de la barre
[Link](left, y - barHeight, width, barHeight)

-- Graduation (lignes horizontales toutes les 25 %)


[Link](27,40,56) -- bleu écriture
for i = 1, 3 do
local gy = y - (i * maxHeight / 4)
[Link](left, gy, left + width - 3, gy)
end

-- --- Marquage rouge (petits traits) à droite dans la zone optimale ---
[Link](200, 0, 0) -- rouge vif
[Link](left, optTop, left, optBottom)

-- Reset couleur
[Link](255, 255, 255)
end

You might also like