--FunctionScript to loop the mixer values to telemetry sensors to log it in the logfile --Copyright LShems --GNU free to share -- --copy file to /SCRIPTS/FUNTIONS --create special function with switch ON to run the script --detect sensors. --after install, delete logfile with the install date --this to allow the new columns to be created correctly in the new logfile. --Logs will contain ppm value --PPMCENTER WILL BE INCLUDED --improved help and gVar support available --V1.2 NO CURVES SUPPORTED --local mix = true -- if outputs wanted, uncomment. --local gVar = true -- gVar 1-8 for FM0 is set to the calculated value to check wth mixer source MAX weight gVar return { run=function() for i=1,7 do --for 8 servoOutputs do local output = model.getOutput(i-1) local mixer = getValue('ch' .. i)/1024 * 100 --getValue if mix then --nothing, only mixer else if mixer > 0 then --scale and trim mixer = output.offset/10 + mixer/100 *(output.max/10 - ((output.symetrical == 0) and output.offset/10 or 0)) else mixer = output.offset/10 - mixer/100 *(output.min/10 - ((output.symetrical == 0) and output.offset/10 or 0)) end -- mixer = (output.revert == 0 and 1 or -1) * math.min(output.max,math.max(output.min,mixer)) mixer = (output.revert == 0 and 1 or -1) * math.min(output.max/10,math.max(output.min/10,mixer)) --clip local ppm = (1500 + mixer/100*512) + output.ppmCenter end mixer = math.floor(mixer+0.5) if gVar then model.setGlobalVariable(i-1,0,mixer) end setTelemetryValue(0X0000,0,100+i,ppm or mixer,0,0,"ch".. i) end end, }