-- Initialisierung der App-Informationen local AppName = "Telemetrie Sim" local AppVersion = "0.10" local AppAuthor = "M.Heerlein, Privatperson" collectgarbage() -------------------------------------------------------------------------------- -- Lokale Variablen local EL1Geber local EL1min local EL1max -------------------------------------------------------------------------------- -- Formular local function initForm() --Geber Auswählen form.addRow(2) form.addLabel({label="Geber Auswählen"}) form.addInputbox(EL1Geber, true, function(value) EL1Geber = value end) --Werte vorgeben form.addRow(2) form.addLabel({label="kleinster Wert"}) EL1min=form.addIntbox(0,-9999,9999,0,0,10) form.addRow(2) form.addLabel({label="höchster Wert"}) EL1max=form.addIntbox(0,-9999,9999,0,0,10) end -------------------------------------------------------------------------------- local function printForm() --Berechnungen zum Telemetriewert lcd.drawLine(0,70, 310,70) local EL1val1 = form.getValue(EL1min) local EL1val2 = form.getValue(EL1max) local EL1His = EL1val2-EL1val1 local EL1val = system.getInputsVal(EL1Geber) local EL1TVa if EL1Geber==nil then EL1val=0 else EL1val=EL1val*100 end lcd.drawText(10,75, "Geberwert "..math.ceil(EL1val, 0).."%",FONT_BIG) if EL1His>=0 then EL1His=(EL1His*1) else EL1His=(EL1His*-1) end lcd.drawText(10,95, "Histerese "..EL1His,FONT_BIG) if EL1TVa~=nil then EL1TVa=0 else EL1TVa=math.floor(EL1val1+(EL1His/100*EL1val),0) end lcd.drawText(10,115, "simulierter Telemetriewert "..EL1TVa,FONT_BIG) end -------------------------------------------------------------------------------- -- Funktionen der App local function init() end -------------------------------------------------------------------------------- -- wo liegt die App local function loop() system.registerForm(1, MENU_APPS, AppName, initForm, nil, printForm) end -- Ursprung collectgarbage() return {init=init, loop=loop, author=AppAuthor, version=AppVersion, name=AppName}