diff --git a/Bitmap/getSize.md b/Bitmap/getSize.md deleted file mode 100644 index 347282bfa..000000000 --- a/Bitmap/getSize.md +++ /dev/null @@ -1,29 +0,0 @@ - - -## Bitmap.getSize(name) - - - -Return width, height of a bitmap object - -@status current Introduced in 2.2.0 - - -#### Parameters - -* `bitmap` (pointer) point to a bitmap previously opened with Bitmap.open() - - - -#### Return value - -* `multiple` returns 2 values: - * (number) width in pixels - * (number) height in pixels - - - -##### Notice -Only available on Horus - - diff --git a/RadioSpecialFunctions.png b/RadioSpecialFunctions.png deleted file mode 100644 index 2823c40a1..000000000 Binary files a/RadioSpecialFunctions.png and /dev/null differ diff --git a/SUMMARY.md b/SUMMARY.md deleted file mode 100644 index e91f10cc7..000000000 --- a/SUMMARY.md +++ /dev/null @@ -1,190 +0,0 @@ -# Table of contents - -* [EdgeTX 2.10 Lua Reference Guide](README.md) -* [Introduction](introduction/README.md) - * [Acknowledgments](introduction/acknowledgments.md) - * [Getting Started](introduction/getting\_started.md) -* [Script Type Overview](part\_i\_-\_script\_type\_overview/README.md) - * [Custom (Mixer) Scripts](part\_i\_-\_script\_type\_overview/mix.md) - * [Telemetry Scripts](part\_i\_-\_script\_type\_overview/telemetry.md) - * [One-Time Scripts](part\_i\_-\_script\_type\_overview/one-time\_scripts.md) - * [Function Scripts](part\_i\_-\_script\_type\_overview/function\_scripts.md) - * [Widget Scripts](part\_i\_-\_script\_type\_overview/widget\_scripts.md) -* [EdgeTX Lua API Programming Guide](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/README.md) - * [Lua Basics](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/lua-basics.md) - * [Loading Code Modules Dynamically](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/loading-code-modules-dynamically.md) - * [Saving Memory](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/saving-memory.md) - * [Using Key and Touch Events](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/using-key-and-touch-events.md) - * [Drawing Flags and Colors](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/drawing-flags-and-colors.md) - * [Data Exchange with the EdgeTX Model Setup](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/data-exchange-with-the-edgetx-model-setup.md) - * [Included Lua Libraries](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/README.md) - * [io Library](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/io-library/README.md) - * [io.open()](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/io-library/io.open.md) - * [io.close()](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/io-library/io.close.md) - * [io.read()](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/io-library/io.read.md) - * [io.write()](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/io-library/io.write.md) - * [io.seek()](part\_ii\_-\_opentx\_lua\_api\_programming\_guide/included\_lua\_libraries/io-library/io.seek.md) -* [EdgeTX Lua API Reference](part\_iii\_-\_opentx\_lua\_api\_reference/README.md) - * [Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/README.md) - * [Key Event Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/key\_events.md) - * [Touch Event Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/touch-event-constants.md) - * [Flags and Pattern Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/flags-and-pattern-constants.md) - * [Color Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/color-constants.md) - * [Special Character Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/special-character-constants.md) - * [Screen Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/screen-constants.md) - * [Logical Switch Function Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/logical-switch-function-constants.md) - * [Special Function Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/special-function-constants.md) - * [Widget Options Constants](part\_iii\_-\_opentx\_lua\_api\_reference/constants/widget-options.md) - * [General Functions](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/README.md) - * [GREY()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/grey.md) - * [accessTelemetryPush()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/accesstelemetrypush.md) - * [chdir(directory)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/chdir.md) - * [crossfireTelemetryPop()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypop.md) - * [crossfireTelemetryPush()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypush.md) - * [defaultChannel(stick)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/defaultchannel.md) - * [defaultStick(channel)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/defaultstick.md) - * [flushAudio()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/flushaudio.md) - * [getAvailableMemory()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getavailablememory.md) - * [getDateTime()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getdatetime.md) - * [getFieldInfo(source)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getfieldinfo.md) - * [getFlightMode(mode)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getflightmode.md) - * [getGeneralSettings()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getgeneralsettings.md) - * [getGlobalTimer()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getglobaltimer.md) - * [getLogicalSwitchValue(id)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getlogicalswitchvalue-id.md) - * [getOutputValue(outputIndex)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getoutputvalue-outputindex.md) - * [getRAS()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getras.md) - * [getRSSI()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrssi.md) - * [getRotEncMode()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrotencmode.md) - * [getRotEncSpeed()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrotencspeed.md) - * [getRtcTime()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrtctime.md) - * [getShmVar(id)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getshmvar-id.md) - * [getSourceIndex(sourceName)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourceindex-sourcename.md) - * [getSourceName(sourceIndex)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourcename-sourceindex.md) - * [getSourceValue(source)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourcevalue-source.md) - * [getSwitchIndex(positionName)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchindex-positionname.md) - * [getSwitchName(switchIndex)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchname-switchindex.md) - * [getSwitchValue(switchIndex)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchvalue-switchindex.md) - * [getTime()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/gettime.md) - * [getTxGPS()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/gettxgps.md) - * [getUsage()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getusage.md) - * [getValue(source)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getvalue.md) - * [getVersion()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/getversion.md) - * [ghostTelemetryPop()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/ghosttelemetrypop.md) - * [ghostTelemetryPush()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/ghosttelemetrypush.md) - * [killEvents(key)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/killevents.md) - * [loadScript(file \[, mode\], \[,env\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/loadscript.md) - * [multiBuffer(address\[,value\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/multibuffer.md) - * [playDuration(duration \[, hourFormat\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/playduration.md) - * [playFile(name)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/playfile.md) - * [playHaptic(duration, pause \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/playhaptic.md) - * [playNumber(value, unit \[, attributes\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/playnumber.md) - * [playTone(frequency, duration, pause \[, flags \[, freqIncr\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/playtone.md) - * [popupConfirmation(title, message, event)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupconfirmation.md) - * [popupInput(title, event, input, min, max)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupinput.md) - * [popupWarning(title, event)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupwarning.md) - * [resetGlobalTimer(\[type\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/resetglobaltimer.md) - * [serialGetPower(port\_nr)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialgetpower-port\_nr.md) - * [serialRead(\[num\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialread.md) - * [serialSetPower(port\_nr, value)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialsetpower-port\_nr-value.md) - * [serialWrite(str)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialwrite.md) - * [setSerialBaudrate(baudrate)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/setserialbaudrate.md) - * [setShmVar(id, value)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/setshmvar-id-value.md) - * [setStickySwitch(id, value)](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/setstickyswitch-id-value.md) - * [setTelemetryValue(id, subID, instance, value \[, unit \[, precision \[, name\]\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/settelemetryvalue.md) - * [sources(\[first\[, last\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/sources-first-last.md) - * [switches(\[first\[, last\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/switches-first-last.md) - * [sportTelemetryPop()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/sporttelemetrypop.md) - * [sportTelemetryPush()](part\_iii\_-\_opentx\_lua\_api\_reference/general-functions-less-than-greater-than-luadoc-begin-general/sporttelemetrypush.md) - * [Model Functions](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/README.md) - * [model.defaultInputs()](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/defaultinputs.md) - * [model.deleteFlightModes()](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteflightmodes.md) - * [model.deleteInput(input, line)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteinput.md) - * [model.deleteInputs()](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteinputs.md) - * [model.deleteMix(channel, line)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/deletemix.md) - * [model.deleteMixes()](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/deletemixes.md) - * [model.getCurve(curve)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getcurve.md) - * [model.getCustomFunction(function)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getcustomfunction.md) - * [model.getFlightMode(index)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getflightmode.md) - * [model.getGlobalVariable(index, flight\_mode)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getglobalvariable.md) - * [model.getInfo()](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinfo.md) - * [model.getInput(input, line)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinput.md) - * [model.getInputsCount(input)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinputscount.md) - * [model.getLogicalSwitch(switch)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getlogicalswitch.md) - * [model.getMix(channel, line)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmix.md) - * [model.getMixesCount(channel)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmixescount.md) - * [model.getModule(index)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmodule.md) - * [model.getOutput(index)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getoutput.md) - * [model.getSensor(sensor)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/getsensor.md) - * [model.getSwashRing()](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/model.getswashring.md) - * [model.getTimer(timer)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/gettimer.md) - * [model.insertInput(input, line, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/insertinput.md) - * [model.insertMix(channel, line, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/insertmix.md) - * [model.resetSensor(sensor)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/resetsensor.md) - * [model.resetTimer(timer)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/resettimer.md) - * [model.setCurve(curve, params)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setcurve.md) - * [model.setCustomFunction(function, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setcustomfunction.md) - * [model.setFlightMode(index, params)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setflightmode.md) - * [model.setGlobalVariable(index, flight\_mode, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setglobalvariable.md) - * [model.setInfo(value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setinfo.md) - * [model.setLogicalSwitch(switch, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setlogicalswitch.md) - * [model.setModule(index, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setmodule.md) - * [model.setOutput(index, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/setoutput.md) - * [model.setSwashRing(params)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/model.setswashring-params.md) - * [model.setTimer(timer, value)](part\_iii\_-\_opentx\_lua\_api\_reference/model-functions-less-than-greater-than-luadoc-begin-model/settimer.md) - * [Lcd Functions](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/README.md) - * [Lcd Functions Overview](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd\_functions-overview.md) - * [lcd.RGB(r, g, b | rgb)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/rgb.md) - * [lcd.clear(\[color\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/clear.md) - * [lcd.drawAnnulus(x, y, r1, r2, start, end \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawannulus.md) - * [lcd.drawArc(x, y, r, start, end \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawarc.md) - * [lcd.drawBitmap(bitmap, x, y \[, scale\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawbitmap.md) - * [lcd.drawBitmapPattern(bitmap, x, y \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawbitmappattern-bitmap-x-y-flags.md) - * [lcd.drawBitmapPatternPie(bitmap, x, y, startAngle, endAngle \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawbitmappatternpie-bitmap-x-y-startangle-endangle-flags.md) - * [lcd.drawChannel(x, y, source, flags)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawchannel.md) - * [lcd.drawCircle(x, y, r \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcircle.md) - * [lcd.drawCombobox(x, y, w, list, idx \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcombobox.md) - * [lcd.drawFilledCircle(x, y, r \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledcircle.md) - * [lcd.drawFilledRectangle(x, y, w, h \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledrectangle.md) - * [lcd.drawFilledTriangle(x1, y1, x2, y2, x3, y3 \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledtriangle.md) - * [lcd.drawGauge(x, y, w, h, fill, maxfill \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawgauge.md) - * [lcd.drawHudRectangle(pitch, roll, xmin, xmax, ymin, ymax \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawhudrectangle.md) - * [lcd.drawLine(x1, y1, x2, y2, pattern, flags)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawline.md) - * [lcd.drawLineWithClipping(x1, y1, x2, y2, xmin, xmax, ymin, ymax, pattern \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawlinewithclipping.md) - * [lcd.drawNumber(x, y, value \[, flags \[, inversColor\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawnumber.md) - * [lcd.drawPie(x, y, r, start, end \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpie.md) - * [lcd.drawPixmap(x, y, name)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpixmap.md) - * [lcd.drawPoint(x, y)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpoint.md) - * [lcd.drawRectangle(x, y, w, h \[, flags \[, t\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawrectangle.md) - * [lcd.drawScreenTitle(title, page, pages)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawscreentitle.md) - * [lcd.drawSource(x, y, source \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawsource.md) - * [lcd.drawSwitch(x, y, switch, flags)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawswitch.md) - * [lcd.drawText(x, y, text \[, flags \[, inversColor\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtext.md) - * [lcd.drawTextLines(x, y, w, h, text \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawtextlines-x-y-w-h-text-flags.md) - * [lcd.drawTimer(x, y, value \[, flags \[, inversColor\]\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtimer.md) - * [lcd.drawTriangle(x1, y1, x2, y2, x3, y3 \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtriangle.md) - * [lcd.exitFullScreen()](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.exitfullscreen.md) - * [lcd.getColor(flags)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getcolor.md) - * [lcd.getLastLeftPos()](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastleftpos.md) - * [lcd.getLastPos()](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastpos.md) - * [lcd.getLastRightPos()](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastrightpos.md) - * [lcd.invertRect(x, y, w, h \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.invertrect-x-y-w-h-flags.md) - * [lcd.refresh()](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/refresh.md) - * [lcd.resetBacklightTimeout()](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/resetbacklighttimeout.md) - * [lcd.setColor(colorIndex, color)](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/setcolor.md) - * [lcd.sizeText(text \[, flags\])](part\_iii\_-\_opentx\_lua\_api\_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/sizetext.md) - * [Bitmap Functions](part\_iii\_-\_opentx\_lua\_api\_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/README.md) - * [Bitmap.getSize(name)](part\_iii\_-\_opentx\_lua\_api\_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/getsize.md) - * [Bitmap.open(name)](part\_iii\_-\_opentx\_lua\_api\_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/open.md) - * [Bitmap.resize(bitmap, width, height)](part\_iii\_-\_opentx\_lua\_api\_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/bitmap.resize-bitmap-width-height.md) - * [Bitmap.toMask(bitmap)](part\_iii\_-\_opentx\_lua\_api\_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/bitmap.tomask-bitmap.md) - * [Filesystem](part\_iii\_-\_opentx\_lua\_api\_reference/filesystem/README.md) - * [dir(directory)](part\_iii\_-\_opentx\_lua\_api\_reference/filesystem/dir-directory.md) - * [fstat(path)](part\_iii\_-\_opentx\_lua\_api\_reference/filesystem/fstat-path.md) - * [del(file or directory)](part\_iii\_-\_opentx\_lua\_api\_reference/filesystem/del-file-or-directory.md) -* [Advanced Topics](part\_iv\_-\_advanced\_topics/README.md) - * [Lua data sharing across scripts](part\_iv\_-\_advanced\_topics/lua\_data\_sharing\_across\_scripts.md) - * [Debugging techniques](part\_iv\_-\_advanced\_topics/debugging\_techniques.md) - * [Speed/memory optimizaton tricks](part\_iv\_-\_advanced\_topics/optimization\_tricks.md) -* [Appendix](appendix/README.md) - * [Fonts](appendix/fonts.md) - * [Units](appendix/units.md) diff --git a/acknowledgments.md b/acknowledgments.md deleted file mode 100644 index 25cfe72f2..000000000 --- a/acknowledgments.md +++ /dev/null @@ -1,13 +0,0 @@ - -### Acknowledgments -The OpenTX team has no intention of making a profit from their work. OpenTX is free and open source and will remain free and open source. But OpenTX is more expensive to maintain than most open source projects. The reason is that there is a never ending flood of hardware to integrate and maintain code for. Hardware that costs. - -Another reason is that OpenTX maintains a build server that serves firmware compiled on demand. This is where OpenTX Companion orders your customized firmware. The server is not for free and the bandwidth is ever increasing with tens of thousands of firmware downloads each month. - -The OpenTX team is grateful to those who have donated to the project. You have helped making OpenTX and OpenTX Companion great. - -The [Github Donor List](https://github.com/opentx/opentx/blob/master/DONATIONS.txt) is updated at each OpenTX release. - -If you would like to contribute to OpenTX, donations are welcome and appreciated: - -[![](btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJ9MASSKVW8WN) diff --git a/part_iv_-_advanced_topics/README.md b/advanced_topics/README.md similarity index 100% rename from part_iv_-_advanced_topics/README.md rename to advanced_topics/README.md diff --git a/part_iv_-_advanced_topics/debugging_techniques.md b/advanced_topics/debugging_techniques.md similarity index 100% rename from part_iv_-_advanced_topics/debugging_techniques.md rename to advanced_topics/debugging_techniques.md diff --git a/part_iv_-_advanced_topics/lua_data_sharing_across_scripts.md b/advanced_topics/lua_data_sharing_across_scripts.md similarity index 100% rename from part_iv_-_advanced_topics/lua_data_sharing_across_scripts.md rename to advanced_topics/lua_data_sharing_across_scripts.md diff --git a/part_iv_-_advanced_topics/optimization_tricks.md b/advanced_topics/optimization_tricks.md similarity index 100% rename from part_iv_-_advanced_topics/optimization_tricks.md rename to advanced_topics/optimization_tricks.md diff --git a/debugging_techniques.md b/debugging_techniques.md deleted file mode 100644 index 886b16e33..000000000 --- a/debugging_techniques.md +++ /dev/null @@ -1,95 +0,0 @@ -# Debugging techniques - -## Debugging your code before testing - -### A good editor is key -It is always good practice to check your code on syntax before even testing it. There are several good LUA editors on the market, some of them for free. The ZeroBrane (https://studio.zerobrane.com/) suite is quite powerful, and very simple to use. In the rest of this article we will assume you use ZeroBrane, but the same techniques can be used in any powerful code editor. - -You can set ZeroBrane to use the Scripts directory of your simulated transmitter SDCard image as a default directory, and it will show you all the files in a nice navigation tree. - -If you open a LUA file, you will already have some markup in your screen, indicating errors or important info. In ZeroBrane for instance, a not declared variable will always get underlined, so that you are made aware you forgot to declare it, or you redeclared it by accident afterwards again. - -### Checking if the code can be compiled -The editor will have an "execute code" option, that will try to run the code on it's own interpreter (code processing engine). If there are any syntax errors, it will not be able to execute the code, and inform you about the errors. A common error in LUA is using a single equal sign (=) in a condition in an 'if' statement, whereas in LUA that should be a double equal sign (==). The interpreter will inform you about such an error ocurring, and mention the line where you made the error. - -Since the OpenTX LUA environment has some own functions, like lcd.drawText(), the interpreter will 'complain' it cannot call an unspecified function, but it will check the entire syntax nonetheless. - -### Ready to run the code -In zerobrane, if you tried to run the code, it will first save it if it could be interpreted correctly. A common workflow would be: -* do some code corrections / additions -* try to run the code in the editor -* if the code gets compiled, the edited LUA file gets saved automatically -* run the code in the transmitter simulator -* check for the desired functionality -* restart this cycle - -## The lua debug viewer -In the later versions of the companion software, a LUA debug screen is available. So once you start your just syntaxically verified and saved LUA script, you can follow some of it's output and actions in the debug screen. It will tell you where and in what line an eventual crash occured. - -## Using a script loader -If you made some code changes, chances are that you have to do a whole sequence of key-clicks and actions on the transmitter simulator in order to retest the same script after those changes. - -You can substatially reduce the effort of all this by using a script loader in your transmitter. This is nothing more then a function that will load and run your code. If you press the enter button, it will unload the current code, and ask if you want to run the code again. -So, with just two clicks, you can unload the running code and reload your updated code. On the Taranis simulator, you can also reload the LUA scripts environment with just a buttonclick. - -An example of such a script is found under the notes. You can adapt it for other types of scripts of course. - -## Notes - -### Script Loader - -This script loader will load the file /SCRIPTS/TELEM/telem1.lua, run it, and wait for an Enter Break event. Once received, it will unload the code and wait for a next Enter Break event. - -```lua -local fileToLoad="/SCRIPTS/TELEM/telem1.lua" -local active = true -  -local thisPage={} -local page={} -  -local function clearTable(t) - if type(t)=="table" then - for i,v in pairs(t) do - if type(v) == "table" then - clearTable(v) - end - t[i] = nil - end - end - collectgarbage() - return t -end - -thisPage.init=function(...) - if active then - page=dofile(fileToLoad) - page.init(...) - end - return true -end -  -thisPage.background=function(...) - if active then - page.background(...) - end - return true -end -  -thisPage.run=function(...) - if active then - page.run(...) - active= not (...==EVT_ENTER_BREAK) - else - lcd.drawText( 15, 2, fileToLoad, 0 ) - lcd.drawText( 15, 20, "disabled", 0 ) - lcd.drawText( 15, 40,"press enter-button to activate",0) - clearTable(page) - active= (...==EVT_ENTER_BREAK) - thisPage.init() - end - return not (...==EVT_MENU_BREAK) -end -  -return thisPage -``` - diff --git a/function_scripts.md b/function_scripts.md deleted file mode 100644 index fd6be4cb3..000000000 --- a/function_scripts.md +++ /dev/null @@ -1,129 +0,0 @@ -# Function Scripts - -#####Overview - -Function scripts are invoked via the **'Lua Script'** option of Special Functions configuration page. - -![Companion Special Functions Window](CompanionSpecialFunctions.png) - -![Taranis Special Functions Display](RadioSpecialFunctions.png) - -##### Typical uses - -* specialized handling in response to switch position changes -* customized announcements - -##### Limitations - -* should not exceed allowed run-time/ number of instructions. -* all function scripts are stopped while one-time script is running (see Lua One-time scripts) -* Function scripts **DO NOT HAVE ACCESS TO LCD DISPLAY** - -##### Location - -Place them on SD card in folder /SCRIPTS/FUNCTIONS/ - -##### Lifetime - -* script *init* function is called once when model is loaded -* script *run* function is periodically called as long as switch condition is true -* script is stopped and disabled if it misbehaves (too long runtime, error in code, low memory) - - -##### Script interface definition - -Every script must include a *return* statement at the end, that defines its interface to the rest of OpenTX code. This statement defines: -* script *init* function (optional, see [Init Function Syntax](init_function_syntax.md)) -* script *run* function (see [Run Function Syntax](run_function_syntax.md)) - -#####Example (interface only): -```lua -local function init_func() -end - -local function run_func() -end - -return { run=run_func, init=init_func } -``` - -#####Notes: -* local variables retain their values for as long as the model is loaded regardless of switch condition value - - -#####Advanced example (save as /SCRIPTS/FUNCTIONS/cntdwn.lua) - -The script below is an example of customized countdown announcements. Note that the init function determines which version of OpenTX is running and sets the unit parameter for playNumber() accordingly. - -```lua - - -local lstannounce -local target - -local running = false - -local duration = 120 -- two minute countdown -local announcements = { 120, 105, 90, 75, 60, 55, 50, 45, 40, 35, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0} -local annIndex - -local minUnit - -local function init() - local version = getVersion() - if version < "2.1" then - minUnit = 16 -- unit for minutes in OpenTX 2.0 - elseif version < "2.2" then - minUnit = 23 -- unit for minutes in OpenTX 2.1 - else - minUnit = 25 -- unit for minutes in OpenTX 2.2 - end -end - -local function run() - - local timenow = getTime() -- 10ms tick count - local remaining - local minutes - local seconds - - if not running then - running = true - target = timenow + (duration * 100) - annIndex = 1 - end - - remaining = math.floor(((target - timenow) / 100) + .7) -- +.7 adjust for announcement lag - - if remaining < 0 then - running = false -- we were 'paused' and missed zero - return - end - - while remaining < announcements[annIndex] do - annIndex = annIndex + 1 -- catch up in case we were paused - end - - if remaining == announcements[annIndex] then - minutes = math.floor(remaining / 60) - seconds = remaining % 60 - if minutes > 0 then - playNumber(minutes, minUnit, 0) - end - if seconds > 0 then - playNumber(seconds, 0, 0) - end - annIndex = annIndex + 1 - end - - if remaining <= 0 then - playNumber(0,0,0) - running = false - end - -end - -return { init=init, run=run } -``` - - diff --git a/getting_started.md b/getting_started.md deleted file mode 100644 index 8e3477675..000000000 --- a/getting_started.md +++ /dev/null @@ -1,16 +0,0 @@ - -### Getting Started - - -#### Downloading OpenTX Companion - -OpenTX Companion 2.2 is available for download at http://www.open-tx.org/downloads.html - - -#### Updating firmware with Lua option selected - -If you intend to use mixer scripts, when updating the firmware on your transmitter you need to make sure the lua option is checked in the settings for your radio profile (Main menu -> Settings ->Settings...) as shown below. This is not required if you only intend to run telemetry, one-time and function scripts, support for those is included by default. - -Also note that the SD Structure path should contain a valid path to a copy of your transmitter's SD card contents, although that's not specific to Lua. - -![Edit Settings dialog from OpenTX Companion](companion-settings.png) \ No newline at end of file diff --git a/handling_gps_sensor_data.md b/handling_gps_sensor_data.md deleted file mode 100644 index ccd3f64f7..000000000 --- a/handling_gps_sensor_data.md +++ /dev/null @@ -1,58 +0,0 @@ -# Handling GPS Sensor data - -#####Overview - -With OpenTx 2.2 it is possible to have multiple GPS sensors, each with their own set of telemetry values which may have user-assigned names. - -Value names are case sensitive and may include some or all of the following: - - GPS (latitude and longitude as a lua table containing [lat] and [lng]) - - GSpd (speed in knots) - - GAlt (altitude in meters) - - Date (gps date converted to local time as a lua table containing [year] [mon] [day] [hour] [min] [sec]) - - Hdg (heading in degrees true) - -This example demonstrates getting latitude and longitude from a sensor with the default name of 'GPS' - -```lua -local gpsValue = "unknown" - -local function rnd(v,d) - if d then - return math.floor((v*10^d)+0.5)/(10^d) - else - return math.floor(v+0.5) - end -end - -local function getTelemetryId(name) - field = getFieldInfo(name) - if field then - return field.id - else - return -1 - end -end - -local function init() - gpsId = getTelemetryId("GPS") -end - -local function background() - gpsLatLon = getValue(gpsId) - if (type(gpsLatLon) == "table") then - gpsValue = rnd(gpsLatLon["lat"],4) .. ", " .. rnd(gpsLatLon["lon"],4) - else - gpsValue = "not currently available" - end -end - -local function run(e) - lcd.clear() - background() -- update current GPS position - lcd.drawText(1,1,"OpenTX 2.2 GPS example",0) - lcd.drawText(1,11,"GPS:", 0) - lcd.drawText(lcd.getLastPos()+2,11,gpsValue,0) -end - -return{init=init,run=run,background=background} -``` diff --git a/handling_lipo_sensor_data.md b/handling_lipo_sensor_data.md deleted file mode 100644 index 2e411f9ee..000000000 --- a/handling_lipo_sensor_data.md +++ /dev/null @@ -1,47 +0,0 @@ -# Handling Lipo Sensor Data -With OpenTx 2.2 it is possible to have multiple Lipo sensors, each with a user-assigned name. The call to getValue() returns a table with the current voltage of each of the cells it is monitoring. - -This example demonstrates getting Lipo cell voltage from a sensor with the default name of 'Cels' - -#####Example: - -```lua -local cellValue = "unknown" -local cellResult = nil -local cellID = nil - -local function getTelemetryId(name) - field = getFieldInfo(name) - if field then - return field.id - else - return -1 - end -end - -local function init() - cellId = getTelemetryId("Cels") -end - -local function background() - cellResult = getValue(cellId) - if (type(cellResult) == "table") then - cellValue = "" - for i, v in ipairs(cellResult) do - cellValue = cellValue .. i .. ": " .. v .. " " - end - else - cellValue = "telemetry not available" - end -end - -local function run(e) - background() - lcd.clear() - lcd.drawText(1,1,"OpenTX 2.2 cell voltage example",0) - lcd.drawText(1,11,"Cels:", 0) - lcd.drawText(lcd.getLastPos()+2,11,cellValue,0) -end - -return{init=init,run=run,background=background} -``` diff --git a/included_lua_libraries.md b/included_lua_libraries.md deleted file mode 100644 index e632a443a..000000000 --- a/included_lua_libraries.md +++ /dev/null @@ -1,16 +0,0 @@ - -# The following Lua libraries are available in OpenTx - - -| Lua Standard Libraries | Included | -| -- | -- | -| package | - | -| coroutine | - | -| table | - | -| [io](lib/io.md) | since OpenTX 2.1.0 (with limitations) | -| os | - | -| string | since OpenTX 2.1.7 | -| bit32 | since OpenTX 2.1.0 | -| math | since OpenTX 2.0.0 | -| debug | - | - diff --git a/init_function_syntax.md b/init_function_syntax.md deleted file mode 100644 index 6f0a76b71..000000000 --- a/init_function_syntax.md +++ /dev/null @@ -1,17 +0,0 @@ -# Init Function Syntax - -If defined, *init* function is called right after the script is loaded from SD card and begins execution. Init is called only once before the run function is called for the first time. - -```lua -local function () - -- code here runs only once when the model is loaded -end -``` - -* #####Input Parameters: -none - -* #####Return values: -none - - diff --git a/input_table_syntax.md b/input_table_syntax.md deleted file mode 100644 index e471a7b2a..000000000 --- a/input_table_syntax.md +++ /dev/null @@ -1,46 +0,0 @@ -# Input Table Syntax - -#####Overview - -The input table defines what values are available as input(s) to [mix scripts](mix.md). There are two forms of input table entries. - -* #####SOURCE syntax -```lua -{ "", SOURCE } -``` -SOURCE inputs provide the current value of a selected OpenTX variable. The source must set by the user when the mix script is configured. Source can be any value OpenTX knows about (inputs, channels, telemetry values, switches, custom functions,...).
-*Note:* typical range is -1024 thru +1024. Simply divide the input value by 10.24 to interpret as a percentage from -100% to +100%. - -* #####VALUE syntax -```lua -{ "", VALUE, , , } -``` -VALUE inputs provide a constant value that is set by the user when the mix script is configured. - * *name* - maximum length of 8 characters - * *min* - minimum value of -128 - * *max* - maximum value of 127 - * *default* - must be within the valid range specified - - -* #####Maximum of 6 inputs per script (warning : was 8 in 2.1) - -#####Example using a SOURCE and a VALUE -```lua -local input = - { - { "Strength", SOURCE}, -- user selects source (typically slider or knob) - { "Interval", VALUE, 0, 100, 0 } -- interval value, default = 0. - } - -local function run(strength, interval) - -- variable strength will contain the current slider value - -- variable interval is set by the user and constant through script lifetime - - -- this script has no return value but may use playFile() to alert user - - return -end - -return {input=input, run=run} -``` - diff --git a/introduction.md b/introduction.md deleted file mode 100644 index 188e352a8..000000000 --- a/introduction.md +++ /dev/null @@ -1,3 +0,0 @@ -# Introduction - -This section includes Acknowledgments and Getting Started. \ No newline at end of file diff --git a/key_events.md b/key_events.md deleted file mode 100644 index 85e8b8f60..000000000 --- a/key_events.md +++ /dev/null @@ -1,74 +0,0 @@ -# Key Events - -This page describes the value that is passed to scripts in the `event` parameter. It is used in [Telemetry](telemetry.md) and [One-Time](one-time_scripts.md) scripts. - -## The key event mechanism - -Each time a key is pressed, held and released a number of events get generated. Here is a typical flow: - * when a key is pressed a `FIRST` event is generated - * if the key continues to be pressed, then after a while a `LONG` event is generated - * if the key continues to be pressed, then a `REPEAT` events are being generated - * when the key is released a `BREAK` event is generated - -Couple of examples: - * a short press on key would generate: `FIRST`, `BREAK` - * a longer pres on key would generate: `FIRST`, `LONG`, `BREAK` - * even longer press: `FIRST`, `LONG`, `REPEAT, `REPEAT, ..., `BREAK` - -This normal key event sequence can be altered with the [killEvents(key)](general/killEvents.md) function. Any time this function is called (after the `FIRST` event) all further key events for this key will be suppressed until the next key press of this key. Examples: - * kill immediately after the key press would generate: `FIRST` - * kill after the long key press would generate: `FIRST`, `LONG` - - -## Constants - -The `event` parameter in the [Telemetry](telemetry.md) and [One-Time](one-time_scripts.md) scripts run function actually carries two pieces of information: - * key number - * type of event - -The two fields are combined into one single number. Some of these combinations are defined as constants and are available to Lua scripts: - -|Key Event Name|Comments| -|:--------:|:-------:| -|EVT_MENU_BREAK| **MENU** key release | -|EVT_PAGE_BREAK| **PAGE** key release | -|EVT_PAGE_LONG| **MENU** key long press | -|EVT_ENTER_BREAK| **ENT** key release | -|EVT_ENTER_LONG| **ENT** key long press| -|EVT_EXIT_BREAK| **EXIT** key release | -|EVT_PLUS_BREAK| **+** key release | -|EVT_MINUS_BREAK| **-** key release | -|EVT_PLUS_FIRST| **+** key press | -|EVT_MINUS_FIRST| **-** key press | -|EVT_PLUS_REPT| **+** key repeat | -|EVT_MINUS_REPT|**-** key repeat| - -Radios with rotary encoder (X7 and Horus) have also: - -|Key Event Name|Comments| -|:--------:|:-------:| -|EVT_ROT_BREAK| rotary encoder release | -|EVT_ROT_LONG| rotary encoder long press | -|EVT_ROT_LEFT| rotary encoder rotated left | -|EVT_ROT_RIGHT| rotary encoder rotated right | - -## Virtual events - -Given the large number of radios supported by OpenTX, and the large difference in keys available on those, a set of VIRTUAL KEYS has been defined and are mapped to best fit available hardware - -|Virtual Key Event Name|Comments| -|:--------:|:-------:| -|EVT_VIRTUAL_NEXT_PAGE| for PAGE navigation | -|EVT_VIRTUAL_PREVIOUS_PAGE| for PAGE navigation | -|EVT_VIRTUAL_ENTER| | -|EVT_VIRTUAL_ENTER_LONG| | -|EVT_VIRTUAL_MENU| | -|EVT_VIRTUAL_MENU_LONG| | -|EVT_VIRTUAL_NEXT| for FIELDS navigation| -|EVT_VIRTUAL_NEXT_REPT| for FIELDS navigation| -|EVT_VIRTUAL_PREVIOUS| for FIELDS navigation| -|EVT_VIRTUAL_PREV_REPT| for FIELDS navigation| -|EVT_VIRTUAL_INC| for VALUES navigation| -|EVT_VIRTUAL_INC_REPT| for VALUES navigation| -|EVT_VIRTUAL_DEC| for VALUES navigation| -|EVT_VIRTUAL_DEC_REPT| for VALUES navigation| \ No newline at end of file diff --git a/known_issues.md b/known_issues.md deleted file mode 100644 index a061ffad9..000000000 --- a/known_issues.md +++ /dev/null @@ -1,21 +0,0 @@ -### General Issues in converting scripts written for OpenTX 2.0 - -#### Deprecated Functions - -**lcd.Lock()** is deprecated, will be obsolete in 2.2. Lua scripts must now explicitly call lcd.Clear() and re-draw the whole display if necessary. - -
-TODO: research killEvents() and use of keys in telemetry scripts -
- -#### Obsolete Telemetry Field Names - -OpenTX since version 2.1 provides more flexibility in the number and type of supported remote sensors. As a result, several field name constants are obsolete and need to be modified in scripts originally written for OpenTX 2.0. - -**GPS field names** are covered in [Handling GPS Sensor Data](handling_gps_sensor_data.md) - -**Lipo voltage field names (LVSS)** are covered in [Handling Lipo Sensor Data](handling_lipo_sensor_data.md) - -#### Maintaining compatibility with OpenTX 2.0 - -**Automatic invocation of the background function** - Beginning in OpenTX 2.1 the background() function is called automatically prior to each invocation of the run() function. Under 2.0 you must explicitly call your background function within your run function. \ No newline at end of file diff --git a/part_ii_-_opentx_lua_api_programming_guide/README.md b/lua_api_programming_guide/README.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/README.md rename to lua_api_programming_guide/README.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/data-exchange-with-the-edgetx-model-setup.md b/lua_api_programming_guide/data-exchange-with-the-edgetx-model-setup.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/data-exchange-with-the-edgetx-model-setup.md rename to lua_api_programming_guide/data-exchange-with-the-edgetx-model-setup.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/drawing-flags-and-colors.md b/lua_api_programming_guide/drawing-flags-and-colors.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/drawing-flags-and-colors.md rename to lua_api_programming_guide/drawing-flags-and-colors.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/README.md b/lua_api_programming_guide/included_lua_libraries/README.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/README.md rename to lua_api_programming_guide/included_lua_libraries/README.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/bit32.library.md b/lua_api_programming_guide/included_lua_libraries/bit32.library.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/bit32.library.md rename to lua_api_programming_guide/included_lua_libraries/bit32.library.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/README.md b/lua_api_programming_guide/included_lua_libraries/io-library/README.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/README.md rename to lua_api_programming_guide/included_lua_libraries/io-library/README.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.close.md b/lua_api_programming_guide/included_lua_libraries/io-library/io.close.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.close.md rename to lua_api_programming_guide/included_lua_libraries/io-library/io.close.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.open.md b/lua_api_programming_guide/included_lua_libraries/io-library/io.open.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.open.md rename to lua_api_programming_guide/included_lua_libraries/io-library/io.open.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.read.md b/lua_api_programming_guide/included_lua_libraries/io-library/io.read.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.read.md rename to lua_api_programming_guide/included_lua_libraries/io-library/io.read.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.seek.md b/lua_api_programming_guide/included_lua_libraries/io-library/io.seek.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.seek.md rename to lua_api_programming_guide/included_lua_libraries/io-library/io.seek.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.write.md b/lua_api_programming_guide/included_lua_libraries/io-library/io.write.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/io-library/io.write.md rename to lua_api_programming_guide/included_lua_libraries/io-library/io.write.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/math.library.md b/lua_api_programming_guide/included_lua_libraries/math.library.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/math.library.md rename to lua_api_programming_guide/included_lua_libraries/math.library.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/string.library.md b/lua_api_programming_guide/included_lua_libraries/string.library.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/included_lua_libraries/string.library.md rename to lua_api_programming_guide/included_lua_libraries/string.library.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/init_function_syntax.md b/lua_api_programming_guide/init_function_syntax.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/init_function_syntax.md rename to lua_api_programming_guide/init_function_syntax.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/input_table_syntax.md b/lua_api_programming_guide/input_table_syntax.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/input_table_syntax.md rename to lua_api_programming_guide/input_table_syntax.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/loading-code-modules-dynamically.md b/lua_api_programming_guide/loading-code-modules-dynamically.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/loading-code-modules-dynamically.md rename to lua_api_programming_guide/loading-code-modules-dynamically.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/lua-basics.md b/lua_api_programming_guide/lua-basics.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/lua-basics.md rename to lua_api_programming_guide/lua-basics.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/output_table_syntax.md b/lua_api_programming_guide/output_table_syntax.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/output_table_syntax.md rename to lua_api_programming_guide/output_table_syntax.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/return_statement_syntax.md b/lua_api_programming_guide/return_statement_syntax.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/return_statement_syntax.md rename to lua_api_programming_guide/return_statement_syntax.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/run_function_syntax.md b/lua_api_programming_guide/run_function_syntax.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/run_function_syntax.md rename to lua_api_programming_guide/run_function_syntax.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/saving-memory.md b/lua_api_programming_guide/saving-memory.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/saving-memory.md rename to lua_api_programming_guide/saving-memory.md diff --git a/part_ii_-_opentx_lua_api_programming_guide/using-key-and-touch-events.md b/lua_api_programming_guide/using-key-and-touch-events.md similarity index 100% rename from part_ii_-_opentx_lua_api_programming_guide/using-key-and-touch-events.md rename to lua_api_programming_guide/using-key-and-touch-events.md diff --git a/part_iii_-_opentx_lua_api_reference/README.md b/lua_api_reference/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/README.md rename to lua_api_reference/README.md diff --git a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/README.md b/lua_api_reference/bitmap/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/README.md rename to lua_api_reference/bitmap/README.md diff --git a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/bitmap.resize-bitmap-width-height.md b/lua_api_reference/bitmap/bitmap.resize-bitmap-width-height.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/bitmap.resize-bitmap-width-height.md rename to lua_api_reference/bitmap/bitmap.resize-bitmap-width-height.md diff --git a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/bitmap.tomask-bitmap.md b/lua_api_reference/bitmap/bitmap.tomask-bitmap.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/bitmap.tomask-bitmap.md rename to lua_api_reference/bitmap/bitmap.tomask-bitmap.md diff --git a/part_iii_-_opentx_lua_api_reference/Bitmap-functions-less-than-greater-than-luadoc-begin-Bitmap/getsize.md b/lua_api_reference/bitmap/getsize.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/Bitmap-functions-less-than-greater-than-luadoc-begin-Bitmap/getsize.md rename to lua_api_reference/bitmap/getsize.md diff --git a/Bitmap/open.md b/lua_api_reference/bitmap/open.md similarity index 100% rename from Bitmap/open.md rename to lua_api_reference/bitmap/open.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/README.md b/lua_api_reference/constants/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/README.md rename to lua_api_reference/constants/README.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/color-constants.md b/lua_api_reference/constants/color-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/color-constants.md rename to lua_api_reference/constants/color-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/flags-and-pattern-constants.md b/lua_api_reference/constants/flags-and-pattern-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/flags-and-pattern-constants.md rename to lua_api_reference/constants/flags-and-pattern-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/key_events.md b/lua_api_reference/constants/key_events.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/key_events.md rename to lua_api_reference/constants/key_events.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/logical-switch-function-constants.md b/lua_api_reference/constants/logical-switch-function-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/logical-switch-function-constants.md rename to lua_api_reference/constants/logical-switch-function-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/screen-constants.md b/lua_api_reference/constants/screen-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/screen-constants.md rename to lua_api_reference/constants/screen-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/special-character-constants.md b/lua_api_reference/constants/special-character-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/special-character-constants.md rename to lua_api_reference/constants/special-character-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/special-function-constants.md b/lua_api_reference/constants/special-function-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/special-function-constants.md rename to lua_api_reference/constants/special-function-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/touch-event-constants.md b/lua_api_reference/constants/touch-event-constants.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/touch-event-constants.md rename to lua_api_reference/constants/touch-event-constants.md diff --git a/part_iii_-_opentx_lua_api_reference/constants/widget-options.md b/lua_api_reference/constants/widget-options.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/constants/widget-options.md rename to lua_api_reference/constants/widget-options.md diff --git a/part_iii_-_opentx_lua_api_reference/filesystem/README.md b/lua_api_reference/filesystem/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/filesystem/README.md rename to lua_api_reference/filesystem/README.md diff --git a/part_iii_-_opentx_lua_api_reference/filesystem/del-file-or-directory.md b/lua_api_reference/filesystem/del-file-or-directory.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/filesystem/del-file-or-directory.md rename to lua_api_reference/filesystem/del-file-or-directory.md diff --git a/part_iii_-_opentx_lua_api_reference/filesystem/dir-directory.md b/lua_api_reference/filesystem/dir-directory.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/filesystem/dir-directory.md rename to lua_api_reference/filesystem/dir-directory.md diff --git a/part_iii_-_opentx_lua_api_reference/filesystem/fstat-path.md b/lua_api_reference/filesystem/fstat-path.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/filesystem/fstat-path.md rename to lua_api_reference/filesystem/fstat-path.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/README.md b/lua_api_reference/general/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/README.md rename to lua_api_reference/general/README.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/accesstelemetrypush.md b/lua_api_reference/general/accesstelemetrypush.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/accesstelemetrypush.md rename to lua_api_reference/general/accesstelemetrypush.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/chdir.md b/lua_api_reference/general/chdir.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/chdir.md rename to lua_api_reference/general/chdir.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypop.md b/lua_api_reference/general/crossfiretelemetrypop.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypop.md rename to lua_api_reference/general/crossfiretelemetrypop.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypush.md b/lua_api_reference/general/crossfiretelemetrypush.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/crossfiretelemetrypush.md rename to lua_api_reference/general/crossfiretelemetrypush.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/defaultchannel.md b/lua_api_reference/general/defaultchannel.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/defaultchannel.md rename to lua_api_reference/general/defaultchannel.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/defaultstick.md b/lua_api_reference/general/defaultstick.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/defaultstick.md rename to lua_api_reference/general/defaultstick.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/flushaudio.md b/lua_api_reference/general/flushaudio.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/flushaudio.md rename to lua_api_reference/general/flushaudio.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getavailablememory.md b/lua_api_reference/general/getavailablememory.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getavailablememory.md rename to lua_api_reference/general/getavailablememory.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getdatetime.md b/lua_api_reference/general/getdatetime.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getdatetime.md rename to lua_api_reference/general/getdatetime.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getfieldinfo.md b/lua_api_reference/general/getfieldinfo.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getfieldinfo.md rename to lua_api_reference/general/getfieldinfo.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getflightmode.md b/lua_api_reference/general/getflightmode.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getflightmode.md rename to lua_api_reference/general/getflightmode.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getgeneralsettings.md b/lua_api_reference/general/getgeneralsettings.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getgeneralsettings.md rename to lua_api_reference/general/getgeneralsettings.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getglobaltimer.md b/lua_api_reference/general/getglobaltimer.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getglobaltimer.md rename to lua_api_reference/general/getglobaltimer.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getlogicalswitchvalue-id.md b/lua_api_reference/general/getlogicalswitchvalue-id.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getlogicalswitchvalue-id.md rename to lua_api_reference/general/getlogicalswitchvalue-id.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getoutputvalue-outputindex.md b/lua_api_reference/general/getoutputvalue-outputindex.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getoutputvalue-outputindex.md rename to lua_api_reference/general/getoutputvalue-outputindex.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getras.md b/lua_api_reference/general/getras.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getras.md rename to lua_api_reference/general/getras.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrotencmode.md b/lua_api_reference/general/getrotencmode.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrotencmode.md rename to lua_api_reference/general/getrotencmode.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrotencspeed.md b/lua_api_reference/general/getrotencspeed.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrotencspeed.md rename to lua_api_reference/general/getrotencspeed.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrssi.md b/lua_api_reference/general/getrssi.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrssi.md rename to lua_api_reference/general/getrssi.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrtctime.md b/lua_api_reference/general/getrtctime.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getrtctime.md rename to lua_api_reference/general/getrtctime.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getshmvar-id.md b/lua_api_reference/general/getshmvar-id.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getshmvar-id.md rename to lua_api_reference/general/getshmvar-id.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourceindex-sourcename.md b/lua_api_reference/general/getsourceindex-sourcename.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourceindex-sourcename.md rename to lua_api_reference/general/getsourceindex-sourcename.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourcename-sourceindex.md b/lua_api_reference/general/getsourcename-sourceindex.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourcename-sourceindex.md rename to lua_api_reference/general/getsourcename-sourceindex.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourcevalue-source.md b/lua_api_reference/general/getsourcevalue-source.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getsourcevalue-source.md rename to lua_api_reference/general/getsourcevalue-source.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchindex-positionname.md b/lua_api_reference/general/getswitchindex-positionname.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchindex-positionname.md rename to lua_api_reference/general/getswitchindex-positionname.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchname-switchindex.md b/lua_api_reference/general/getswitchname-switchindex.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchname-switchindex.md rename to lua_api_reference/general/getswitchname-switchindex.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchvalue-switchindex.md b/lua_api_reference/general/getswitchvalue-switchindex.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getswitchvalue-switchindex.md rename to lua_api_reference/general/getswitchvalue-switchindex.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/gettime.md b/lua_api_reference/general/gettime.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/gettime.md rename to lua_api_reference/general/gettime.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/gettxgps.md b/lua_api_reference/general/gettxgps.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/gettxgps.md rename to lua_api_reference/general/gettxgps.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getusage.md b/lua_api_reference/general/getusage.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getusage.md rename to lua_api_reference/general/getusage.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getvalue.md b/lua_api_reference/general/getvalue.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getvalue.md rename to lua_api_reference/general/getvalue.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getversion.md b/lua_api_reference/general/getversion.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getversion.md rename to lua_api_reference/general/getversion.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/ghosttelemetrypop.md b/lua_api_reference/general/ghosttelemetrypop.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/ghosttelemetrypop.md rename to lua_api_reference/general/ghosttelemetrypop.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/ghosttelemetrypush.md b/lua_api_reference/general/ghosttelemetrypush.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/ghosttelemetrypush.md rename to lua_api_reference/general/ghosttelemetrypush.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/grey.md b/lua_api_reference/general/grey.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/grey.md rename to lua_api_reference/general/grey.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/killevents.md b/lua_api_reference/general/killevents.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/killevents.md rename to lua_api_reference/general/killevents.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/loadscript.md b/lua_api_reference/general/loadscript.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/loadscript.md rename to lua_api_reference/general/loadscript.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/multibuffer.md b/lua_api_reference/general/multibuffer.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/multibuffer.md rename to lua_api_reference/general/multibuffer.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playduration.md b/lua_api_reference/general/playduration.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playduration.md rename to lua_api_reference/general/playduration.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playfile.md b/lua_api_reference/general/playfile.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playfile.md rename to lua_api_reference/general/playfile.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playhaptic.md b/lua_api_reference/general/playhaptic.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playhaptic.md rename to lua_api_reference/general/playhaptic.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playnumber.md b/lua_api_reference/general/playnumber.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playnumber.md rename to lua_api_reference/general/playnumber.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playtone.md b/lua_api_reference/general/playtone.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/playtone.md rename to lua_api_reference/general/playtone.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupconfirmation-title-message-event.md b/lua_api_reference/general/popupconfirmation-title-message-event.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupconfirmation-title-message-event.md rename to lua_api_reference/general/popupconfirmation-title-message-event.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupconfirmation.md b/lua_api_reference/general/popupconfirmation.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupconfirmation.md rename to lua_api_reference/general/popupconfirmation.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupinput.md b/lua_api_reference/general/popupinput.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupinput.md rename to lua_api_reference/general/popupinput.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupwarning.md b/lua_api_reference/general/popupwarning.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/popupwarning.md rename to lua_api_reference/general/popupwarning.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/resetglobaltimer.md b/lua_api_reference/general/resetglobaltimer.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/resetglobaltimer.md rename to lua_api_reference/general/resetglobaltimer.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialgetpower-port_nr.md b/lua_api_reference/general/serialgetpower-port_nr.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialgetpower-port_nr.md rename to lua_api_reference/general/serialgetpower-port_nr.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialread.md b/lua_api_reference/general/serialread.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialread.md rename to lua_api_reference/general/serialread.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialsetpower-port_nr-value.md b/lua_api_reference/general/serialsetpower-port_nr-value.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialsetpower-port_nr-value.md rename to lua_api_reference/general/serialsetpower-port_nr-value.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialwrite.md b/lua_api_reference/general/serialwrite.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/serialwrite.md rename to lua_api_reference/general/serialwrite.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setserialbaudrate-baudrate.md b/lua_api_reference/general/setserialbaudrate-baudrate.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setserialbaudrate-baudrate.md rename to lua_api_reference/general/setserialbaudrate-baudrate.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setserialbaudrate.md b/lua_api_reference/general/setserialbaudrate.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setserialbaudrate.md rename to lua_api_reference/general/setserialbaudrate.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setshmvar-id-value.md b/lua_api_reference/general/setshmvar-id-value.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setshmvar-id-value.md rename to lua_api_reference/general/setshmvar-id-value.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setstickyswitch-id-value.md b/lua_api_reference/general/setstickyswitch-id-value.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/setstickyswitch-id-value.md rename to lua_api_reference/general/setstickyswitch-id-value.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/settelemetryvalue.md b/lua_api_reference/general/settelemetryvalue.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/settelemetryvalue.md rename to lua_api_reference/general/settelemetryvalue.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/sources-first-last.md b/lua_api_reference/general/sources-first-last.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/sources-first-last.md rename to lua_api_reference/general/sources-first-last.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/sporttelemetrypop.md b/lua_api_reference/general/sporttelemetrypop.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/sporttelemetrypop.md rename to lua_api_reference/general/sporttelemetrypop.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/sporttelemetrypush.md b/lua_api_reference/general/sporttelemetrypush.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/sporttelemetrypush.md rename to lua_api_reference/general/sporttelemetrypush.md diff --git a/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/switches-first-last.md b/lua_api_reference/general/switches-first-last.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/switches-first-last.md rename to lua_api_reference/general/switches-first-last.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/README.md b/lua_api_reference/lcd/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/README.md rename to lua_api_reference/lcd/README.md diff --git a/lcd/RGB.md b/lua_api_reference/lcd/RGB.md similarity index 100% rename from lcd/RGB.md rename to lua_api_reference/lcd/RGB.md diff --git a/lcd/clear.md b/lua_api_reference/lcd/clear.md similarity index 100% rename from lcd/clear.md rename to lua_api_reference/lcd/clear.md diff --git a/lcd/drawBitmap.md b/lua_api_reference/lcd/drawBitmap.md similarity index 100% rename from lcd/drawBitmap.md rename to lua_api_reference/lcd/drawBitmap.md diff --git a/lcd/drawChannel.md b/lua_api_reference/lcd/drawChannel.md similarity index 100% rename from lcd/drawChannel.md rename to lua_api_reference/lcd/drawChannel.md diff --git a/lcd/drawCombobox.md b/lua_api_reference/lcd/drawCombobox.md similarity index 100% rename from lcd/drawCombobox.md rename to lua_api_reference/lcd/drawCombobox.md diff --git a/lcd/drawFilledRectangle.md b/lua_api_reference/lcd/drawFilledRectangle.md similarity index 100% rename from lcd/drawFilledRectangle.md rename to lua_api_reference/lcd/drawFilledRectangle.md diff --git a/lcd/drawGauge.md b/lua_api_reference/lcd/drawGauge.md similarity index 100% rename from lcd/drawGauge.md rename to lua_api_reference/lcd/drawGauge.md diff --git a/lcd/drawLine.md b/lua_api_reference/lcd/drawLine.md similarity index 100% rename from lcd/drawLine.md rename to lua_api_reference/lcd/drawLine.md diff --git a/lcd/drawNumber.md b/lua_api_reference/lcd/drawNumber.md similarity index 100% rename from lcd/drawNumber.md rename to lua_api_reference/lcd/drawNumber.md diff --git a/lcd/drawPixmap.md b/lua_api_reference/lcd/drawPixmap.md similarity index 100% rename from lcd/drawPixmap.md rename to lua_api_reference/lcd/drawPixmap.md diff --git a/lcd/drawPoint.md b/lua_api_reference/lcd/drawPoint.md similarity index 100% rename from lcd/drawPoint.md rename to lua_api_reference/lcd/drawPoint.md diff --git a/lcd/drawRectangle.md b/lua_api_reference/lcd/drawRectangle.md similarity index 100% rename from lcd/drawRectangle.md rename to lua_api_reference/lcd/drawRectangle.md diff --git a/lcd/drawScreenTitle.md b/lua_api_reference/lcd/drawScreenTitle.md similarity index 100% rename from lcd/drawScreenTitle.md rename to lua_api_reference/lcd/drawScreenTitle.md diff --git a/lcd/drawSource.md b/lua_api_reference/lcd/drawSource.md similarity index 100% rename from lcd/drawSource.md rename to lua_api_reference/lcd/drawSource.md diff --git a/lcd/drawSwitch.md b/lua_api_reference/lcd/drawSwitch.md similarity index 100% rename from lcd/drawSwitch.md rename to lua_api_reference/lcd/drawSwitch.md diff --git a/lcd/drawText.md b/lua_api_reference/lcd/drawText.md similarity index 100% rename from lcd/drawText.md rename to lua_api_reference/lcd/drawText.md diff --git a/lcd/drawTimer.md b/lua_api_reference/lcd/drawTimer.md similarity index 100% rename from lcd/drawTimer.md rename to lua_api_reference/lcd/drawTimer.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawannulus.md b/lua_api_reference/lcd/drawannulus.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawannulus.md rename to lua_api_reference/lcd/drawannulus.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawarc.md b/lua_api_reference/lcd/drawarc.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawarc.md rename to lua_api_reference/lcd/drawarc.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcircle.md b/lua_api_reference/lcd/drawcircle.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcircle.md rename to lua_api_reference/lcd/drawcircle.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledcircle.md b/lua_api_reference/lcd/drawfilledcircle.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledcircle.md rename to lua_api_reference/lcd/drawfilledcircle.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledtriangle.md b/lua_api_reference/lcd/drawfilledtriangle.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledtriangle.md rename to lua_api_reference/lcd/drawfilledtriangle.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawhudrectangle.md b/lua_api_reference/lcd/drawhudrectangle.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawhudrectangle.md rename to lua_api_reference/lcd/drawhudrectangle.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawlinewithclipping.md b/lua_api_reference/lcd/drawlinewithclipping.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawlinewithclipping.md rename to lua_api_reference/lcd/drawlinewithclipping.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpie.md b/lua_api_reference/lcd/drawpie.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpie.md rename to lua_api_reference/lcd/drawpie.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtriangle.md b/lua_api_reference/lcd/drawtriangle.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtriangle.md rename to lua_api_reference/lcd/drawtriangle.md diff --git a/lcd/getColor.md b/lua_api_reference/lcd/getColor.md similarity index 100% rename from lcd/getColor.md rename to lua_api_reference/lcd/getColor.md diff --git a/lcd/getLastLeftPos.md b/lua_api_reference/lcd/getLastLeftPos.md similarity index 100% rename from lcd/getLastLeftPos.md rename to lua_api_reference/lcd/getLastLeftPos.md diff --git a/lcd/getLastPos.md b/lua_api_reference/lcd/getLastPos.md similarity index 100% rename from lcd/getLastPos.md rename to lua_api_reference/lcd/getLastPos.md diff --git a/lcd/getLastRightPos.md b/lua_api_reference/lcd/getLastRightPos.md similarity index 100% rename from lcd/getLastRightPos.md rename to lua_api_reference/lcd/getLastRightPos.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawbitmappattern-bitmap-x-y-flags.md b/lua_api_reference/lcd/lcd.drawbitmappattern-bitmap-x-y-flags.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawbitmappattern-bitmap-x-y-flags.md rename to lua_api_reference/lcd/lcd.drawbitmappattern-bitmap-x-y-flags.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawbitmappatternpie-bitmap-x-y-startangle-endangle-flags.md b/lua_api_reference/lcd/lcd.drawbitmappatternpie-bitmap-x-y-startangle-endangle-flags.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawbitmappatternpie-bitmap-x-y-startangle-endangle-flags.md rename to lua_api_reference/lcd/lcd.drawbitmappatternpie-bitmap-x-y-startangle-endangle-flags.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawtextlines-x-y-w-h-text-flags.md b/lua_api_reference/lcd/lcd.drawtextlines-x-y-w-h-text-flags.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.drawtextlines-x-y-w-h-text-flags.md rename to lua_api_reference/lcd/lcd.drawtextlines-x-y-w-h-text-flags.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.exitfullscreen.md b/lua_api_reference/lcd/lcd.exitfullscreen.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.exitfullscreen.md rename to lua_api_reference/lcd/lcd.exitfullscreen.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.invertrect-x-y-w-h-flags.md b/lua_api_reference/lcd/lcd.invertrect-x-y-w-h-flags.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd.invertrect-x-y-w-h-flags.md rename to lua_api_reference/lcd/lcd.invertrect-x-y-w-h-flags.md diff --git a/lcd/lcd_functions-overview.md b/lua_api_reference/lcd/lcd_functions-overview.md similarity index 100% rename from lcd/lcd_functions-overview.md rename to lua_api_reference/lcd/lcd_functions-overview.md diff --git a/lcd/refresh.md b/lua_api_reference/lcd/refresh.md similarity index 100% rename from lcd/refresh.md rename to lua_api_reference/lcd/refresh.md diff --git a/lcd/resetBacklightTimeout.md b/lua_api_reference/lcd/resetBacklightTimeout.md similarity index 100% rename from lcd/resetBacklightTimeout.md rename to lua_api_reference/lcd/resetBacklightTimeout.md diff --git a/lcd/setColor.md b/lua_api_reference/lcd/setColor.md similarity index 100% rename from lcd/setColor.md rename to lua_api_reference/lcd/setColor.md diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/sizetext.md b/lua_api_reference/lcd/sizetext.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/sizetext.md rename to lua_api_reference/lcd/sizetext.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/README.md b/lua_api_reference/model/README.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/README.md rename to lua_api_reference/model/README.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/defaultinputs.md b/lua_api_reference/model/defaultinputs.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/defaultinputs.md rename to lua_api_reference/model/defaultinputs.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteflightmodes.md b/lua_api_reference/model/deleteflightmodes.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteflightmodes.md rename to lua_api_reference/model/deleteflightmodes.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteinput.md b/lua_api_reference/model/deleteinput.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteinput.md rename to lua_api_reference/model/deleteinput.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteinputs.md b/lua_api_reference/model/deleteinputs.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deleteinputs.md rename to lua_api_reference/model/deleteinputs.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deletemix.md b/lua_api_reference/model/deletemix.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deletemix.md rename to lua_api_reference/model/deletemix.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deletemixes.md b/lua_api_reference/model/deletemixes.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/deletemixes.md rename to lua_api_reference/model/deletemixes.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getcurve.md b/lua_api_reference/model/getcurve.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getcurve.md rename to lua_api_reference/model/getcurve.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getcustomfunction.md b/lua_api_reference/model/getcustomfunction.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getcustomfunction.md rename to lua_api_reference/model/getcustomfunction.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getflightmode.md b/lua_api_reference/model/getflightmode.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getflightmode.md rename to lua_api_reference/model/getflightmode.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getglobalvariable.md b/lua_api_reference/model/getglobalvariable.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getglobalvariable.md rename to lua_api_reference/model/getglobalvariable.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinfo.md b/lua_api_reference/model/getinfo.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinfo.md rename to lua_api_reference/model/getinfo.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinput.md b/lua_api_reference/model/getinput.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinput.md rename to lua_api_reference/model/getinput.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinputscount.md b/lua_api_reference/model/getinputscount.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getinputscount.md rename to lua_api_reference/model/getinputscount.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getlogicalswitch.md b/lua_api_reference/model/getlogicalswitch.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getlogicalswitch.md rename to lua_api_reference/model/getlogicalswitch.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmix.md b/lua_api_reference/model/getmix.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmix.md rename to lua_api_reference/model/getmix.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmixescount.md b/lua_api_reference/model/getmixescount.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmixescount.md rename to lua_api_reference/model/getmixescount.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmodule.md b/lua_api_reference/model/getmodule.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getmodule.md rename to lua_api_reference/model/getmodule.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getoutput.md b/lua_api_reference/model/getoutput.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getoutput.md rename to lua_api_reference/model/getoutput.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getsensor.md b/lua_api_reference/model/getsensor.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/getsensor.md rename to lua_api_reference/model/getsensor.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/gettimer.md b/lua_api_reference/model/gettimer.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/gettimer.md rename to lua_api_reference/model/gettimer.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/insertinput.md b/lua_api_reference/model/insertinput.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/insertinput.md rename to lua_api_reference/model/insertinput.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/insertmix.md b/lua_api_reference/model/insertmix.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/insertmix.md rename to lua_api_reference/model/insertmix.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/model.getswashring.md b/lua_api_reference/model/model.getswashring.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/model.getswashring.md rename to lua_api_reference/model/model.getswashring.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/model.setswashring-params.md b/lua_api_reference/model/model.setswashring-params.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/model.setswashring-params.md rename to lua_api_reference/model/model.setswashring-params.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/resetsensor.md b/lua_api_reference/model/resetsensor.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/resetsensor.md rename to lua_api_reference/model/resetsensor.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/resettimer.md b/lua_api_reference/model/resettimer.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/resettimer.md rename to lua_api_reference/model/resettimer.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setcurve.md b/lua_api_reference/model/setcurve.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setcurve.md rename to lua_api_reference/model/setcurve.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setcustomfunction.md b/lua_api_reference/model/setcustomfunction.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setcustomfunction.md rename to lua_api_reference/model/setcustomfunction.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setflightmode.md b/lua_api_reference/model/setflightmode.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setflightmode.md rename to lua_api_reference/model/setflightmode.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setglobalvariable.md b/lua_api_reference/model/setglobalvariable.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setglobalvariable.md rename to lua_api_reference/model/setglobalvariable.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setinfo.md b/lua_api_reference/model/setinfo.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setinfo.md rename to lua_api_reference/model/setinfo.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setlogicalswitch.md b/lua_api_reference/model/setlogicalswitch.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setlogicalswitch.md rename to lua_api_reference/model/setlogicalswitch.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setmodule.md b/lua_api_reference/model/setmodule.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setmodule.md rename to lua_api_reference/model/setmodule.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setoutput.md b/lua_api_reference/model/setoutput.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/setoutput.md rename to lua_api_reference/model/setoutput.md diff --git a/part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/settimer.md b/lua_api_reference/model/settimer.md similarity index 100% rename from part_iii_-_opentx_lua_api_reference/model-functions-less-than-greater-than-luadoc-begin-model/settimer.md rename to lua_api_reference/model/settimer.md diff --git a/lua_data_sharing_across_scripts.md b/lua_data_sharing_across_scripts.md deleted file mode 100644 index 1f04a5f04..000000000 --- a/lua_data_sharing_across_scripts.md +++ /dev/null @@ -1,178 +0,0 @@ -# Lua data sharing across scripts - -#####Overview: -OpenTX considers all function, mix, and telemetry scripts to be 'permanent' scripts that share the same runtime environment. They are typically loaded at power up or when a new model is selected. However, they are also reinitialized when a script is added or removed during model editing. - -#####Lua scoping rules: -Any variable or function not declared local is implicitly global. Care must be taken to avoid unintentional global declarations, and ensure that the globals you intentionally declare have unique names to avoid conflicts with scripts written by others. - -#####Example: -This example consists of three scripts -- **count-dn.lua** - this is a mix script than can be run stand alone to announce time remaining based on a user-defined switch and duration. It updates two global variables (gCountUp and gCountDown). It also creates output values (ctup and ctdn) which are for demonstration purposes only. -- **count-up.lua** - this is an optional function script which will do count up announcements based on harded coded values. -- **shocount.lua** - this is an optional telemetry script which simply shows the current values of the gCountUp and gCountDown variables. - -#####Installation: - - count-dn.lua - - copy to /SCRIPTS/MIXES - - configure on the transmitter CUSTOM SCRIPT page - - suggested switch = "SA" - - suggested mins = 3 - - suggested sw_high = 0 - - screen image: -![count-dn.lua mix script](count-dn.png) - - - - count-up.lua - - copy to /SCRIPTS/FUNCTIONS - - configure on the transmitter SPECIAL FUNCTIONS page - - suggested switch SA(down) - - screen image: -![count-up.lua function script](count-up.png) - - - - shocount.lua - - copy to /SCRIPTS/TELEMETRY - - configure on the transmitter TELEMETRY page - - screen image: -![shocount.lua function script](shocount.png) - -#####Script sources: - -######count-dn.lua -```lua --- these globals can be referenced in function and telemetry scripts -gCountUp = 0 -gCountDown = 0 - -local target -local running = false -local complete = false -local announcements = { 720, 660, 600, 540, 480, 420, 360, 300, 240, 180, 120, 105, 90, 75, 60, 55, 50, 45, 40, 35, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0} -local annIndex -- index into the announcements table (1 based) -local minUnit -- used by playNumber() for unit announcement - -local input = - { - { "switch", SOURCE}, -- switch used to activate count down - { "mins", VALUE, 1, 12, 2 }, -- minutes to count down - { "sw_high", VALUE, 0, 1, 1 } -- 0 = active when low, otherwise active when high - } - -local output = {"ctup", "ctdn" } - -local function init() - local version = getVersion() - if version < "2.1" then - minUnit = 16 -- unit for minutes in OpenTX 2.0 - elseif version < "2.2" then - minUnit = 23 -- unit for minutes in OpenTX 2.1 - else - minUnit = 25 -- unit for minutes in OpenTX 2.2 - end -end - -local function countdownIsRunning(switch, sw_high) - -- evaluate switch - return true if we should be counting down - if (sw_high > 0) then - return (switch > -1000) - else - return (switch < 1000) - end -end - -local function run(switch, mins, sw_high) - local timenow = getTime() -- 10ms tick count - local minutes - local seconds - - if (not countdownIsRunning(switch, sw_high)) then - running = false - complete = false - return 0, 0 -- ***** NOTE: early exit ***** - end - - if (complete) then - return 0, 0 -- must reset the switch before we go again - end - - if (not running) then - running = true - target = timenow + ((mins * 60) * 100) - annIndex = 1 - end - - gCountDown = math.floor(((target - timenow) / 100) + .7) -- + is adj. to for announcement lag - gCountUp = (mins * 60) - gCountDown - - while gCountDown < announcements[annIndex] do - annIndex = annIndex + 1 -- catch up - end - - if gCountDown == announcements[annIndex] then - minutes = math.floor(gCountDown / 60) - seconds = gCountDown % 60 - if minutes > 0 then - playNumber(minutes, minUnit, 0) - end - if seconds > 0 then - playNumber(seconds, 0, 0) - end - annIndex = annIndex + 1 - end - - if gCountDown <= 0 then - playNumber(0,0,0) - running = false - gCountDown = 0 - complete = true - end - - return gCountUp * 10.24, gCountDown * 10.24 -end - -return { input=input, output=output, init=init, run=run } -``` - -######count-up.lua -```lua -gCountUp = 0 - -local min = 5 -local max = 30 -local last = 0 -local announcements = { 5, 10, 15, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 } -local annIndex = 1 - -local function run(e) - if not (gCountUp == last) then - last = gCountUp - for key, value in pairs(announcements) do - if value == last then - playNumber(last, 0, 0) - end - end - end -end - -return{run=run} -``` - -######shocount.lua -```lua --- these globals can be referenced in mix, function, and telemetry scripts -gCountUp = 0 -gCountDown = 0 - -local function run(e) - lcd.clear() - lcd.drawText(1,1,"OpenTx Lua Data Sharing",0) - - lcd.drawText(1,11,"gCountUp:", 0) - lcd.drawText(lcd.getLastPos()+2,11,gCountUp,0) - lcd.drawText(1, 21, "gCountDown:", 0) - lcd.drawText(lcd.getLastPos()+2,21,gCountDown,0) -end - -return{run=run} -``` diff --git a/mix.md b/mix.md deleted file mode 100644 index 495306035..000000000 --- a/mix.md +++ /dev/null @@ -1,86 +0,0 @@ -# Mix Scripts - -***WARNING - *** -**Do not use Lua mix scripts for controlling any aspect of your model that could cause a crash if script stops executing.** - -## Description - -Each model can have several mix scripts associated with it. These scripts are run periodically for entire time that model is selected. These scripts behave similar to standard OpenTX mixers but at the same time provide much more flexible and powerful tool. - -Mix scripts take one or more values as inputs, do some calculation or logic processing based on them and output one or more values. Each run of a script should be as short as possible. Exceeding the script execution runtime limit will result in the script being forcefully stopped and disabled. - - -## Typical uses - -* replacement for complex mixes that are not critical to model function -* complex processing of inputs and reaction to their current state and/or their history -* filtering of telemetry values - -## Limitations - -* cannot update LCD screen or perform user input. -* should not exceed allowed run-time/ number of instructions. -* mix scripts are run with less priority than built-in mixes. Their execution period is around 30ms and is not guaranteed! -* can be disabled/killed anytime due to logic errors in script, not enough free memory, etc...) - -## Location - -Place them on SD card in folder /SCRIPTS/MIXES/. File name length (without extension) **must be 6 characters or less** (this limit was 8 characters in OpenTX 2.1). - -## Lifetime - -* script is loaded from SD card when model is selected -* script *init* function is called -* script *run* function is periodically called (inside GUI thread, period cca 30ms) -* script is killed (stopped and disabled) if it misbehaves (too long runtime, error in code, low memory) -* all mix scripts are stopped while one-time script is running (see Lua One-time scripts) - -### Disabled script - -If as script output is used as a `mixer source` and the script is killed for what ever reason, then `the whole mixer line is disabled`! This can be used for example to provide a fall-back in case Lua mixer script gets killed. - -Example where Lua mix script is used to drive ailerons in some clever way, but -control falls back to the standard aileron mix if script is killed. Second mixer line replaces the first one when the script is alive: -``` -CH1 [I4]Ail Weight(+100%) - := LUA4b Weight(+100%) -``` - - - -## Script interface definition - -Every script must include a *return* statement at the end, that defines its interface to the rest of OpenTX code. This statement defines: -* script *input* table (optional, see [Input Table Syntax](input_table_syntax.md)) -* script *output* table (optional, see [Output Table Syntax](output_table_syntax.md)) -* script *init* function (optional, see [Init Function Syntax](init_function_syntax.md)) -* script *run* function (see [Run Function Syntax](run_function_syntax.md)) - -### Example (interface only): -```lua -local input {} - -local output {} - -local function init_func() -end - -local function run_func() -end - -return { input=input, output=output, run=run_func, init=init_func } -``` - -### Notes: -* inputs table defines input parameters (name and source) to run function ([see Input Table Syntax](input_table_syntax.md)) -* outputs table defines names for values returned by run function (see [Output Table Syntax](output_table_syntax.md)) -* init_func() function is called once when script is loaded. -* run_func() function is called periodically - - - - - - - - diff --git a/model/defaultInputs.md b/model/defaultInputs.md deleted file mode 100644 index f878dbbc4..000000000 --- a/model/defaultInputs.md +++ /dev/null @@ -1,19 +0,0 @@ - - -## model.defaultInputs() - - - -Set all inputs to defaults - -@status current Introduced in 2.0.0 - - -#### Parameters - -none - -#### Return value - -none - diff --git a/model/deleteFlightModes.md b/model/deleteFlightModes.md deleted file mode 100644 index ae7105974..000000000 --- a/model/deleteFlightModes.md +++ /dev/null @@ -1,19 +0,0 @@ - - -## model.deleteFlightModes() - - - -Clear all flightModes - -@status current Introduced in 2.3.10 - - -#### Parameters - -none - -#### Return value - -none - diff --git a/model/deleteInput.md b/model/deleteInput.md deleted file mode 100644 index 13dfb79cb..000000000 --- a/model/deleteInput.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## model.deleteInput(input, line) - - - -Delete line from specified input - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `input` (unsigned number) input number (use 0 for Input1) - -* `line` (unsigned number) input line (use 0 for first line) - - - -#### Return value - -none - diff --git a/model/deleteInputs.md b/model/deleteInputs.md deleted file mode 100644 index 8e6d76f0b..000000000 --- a/model/deleteInputs.md +++ /dev/null @@ -1,19 +0,0 @@ - - -## model.deleteInputs() - - - -Delete all Inputs - -@status current Introduced in 2.0.0 - - -#### Parameters - -none - -#### Return value - -none - diff --git a/model/deleteMix.md b/model/deleteMix.md deleted file mode 100644 index 210a9d16f..000000000 --- a/model/deleteMix.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## model.deleteMix(channel, line) - - - -Delete mixer line from specified Channel - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `channel` (unsigned number) channel number (use 0 for CH1) - -* `line` (unsigned number) mix number (use 0 for first line(mix)) - - - -#### Return value - -none - diff --git a/model/deleteMixes.md b/model/deleteMixes.md deleted file mode 100644 index c57bce39f..000000000 --- a/model/deleteMixes.md +++ /dev/null @@ -1,19 +0,0 @@ - - -## model.deleteMixes() - - - -Remove all mixers - -@status current Introduced in 2.0.0 - - -#### Parameters - -none - -#### Return value - -none - diff --git a/model/getCurve.md b/model/getCurve.md deleted file mode 100644 index c7932c2ac..000000000 --- a/model/getCurve.md +++ /dev/null @@ -1,38 +0,0 @@ - - -## model.getCurve(curve) - - - -Get Curve parameters - - Note that functions returns the tables starting with index 0 contrary to LUA's - usual index starting with 1 - -@status current Introduced in 2.0.12 - - -#### Parameters - -* `curve` (unsigned number) curve number (use 0 for Curve1) - - - -#### Return value - -* `nil` requested curve does not exist - -* `table` curve data: - * `name` (string) name - * `type` (number) type - * `smooth` (boolean) smooth - * `points` (number) number of points - * `y` (table) table of Y values: - * `key` is point number (zero based) - * `value` is y value - * `x` (table) **only included for custom curve type**: - * `key` is point number (zero based) - * `value` is x value - - - diff --git a/model/getCustomFunction.md b/model/getCustomFunction.md deleted file mode 100644 index ffc01394b..000000000 --- a/model/getCustomFunction.md +++ /dev/null @@ -1,32 +0,0 @@ - - -## model.getCustomFunction(function) - - - -Get Custom Function parameters - -@status current Introduced in 2.0.0, TODO rename function - - -#### Parameters - -* `function` (unsigned number) custom function number (use 0 for CF1) - - - -#### Return value - -* `nil` requested custom function does not exist - -* `table` custom function data: - * `switch` (number) switch index - * `func` (number) function index - * `name` (string) Name of track to play (only returned only returned if action is play track, sound or script) - * `value` (number) value (only returned only returned if action is **not** play track, sound or script) - * `mode` (number) mode (only returned only returned if action is **not** play track, sound or script) - * `param` (number) parameter (only returned only returned if action is **not** play track, sound or script) - * `active` (number) 0 = disabled, 1 = enabled - - - diff --git a/model/getFlightMode.md b/model/getFlightMode.md deleted file mode 100644 index 90fd28113..000000000 --- a/model/getFlightMode.md +++ /dev/null @@ -1,35 +0,0 @@ - - -## model.getFlightMode(index) - - - -Return input data for given input and line number - -@status current Introduced in 2.3.10 - - -#### Parameters - -* `index` (unsigned number) flight mode number (use 0 for FM0) - - - -#### Return value - -* `nil` requested input or line does not exist - -* `table` input data: - * `name` (string) input line name - * `switch` (number) input switch index - * `fadeIn` (number) fade in value (in 0.1s) - * `fadeOut` (number) fade out value (in 0.1s) - * `trimsValues` (table) table of trim values: - * `key` is trim number (zero based) - * `value` is trim value - * `trimsModes` (table) table of trim mode: - * `key` is trim number (zero based) - * `value` is trim mode - - - diff --git a/model/getGlobalVariable.md b/model/getGlobalVariable.md deleted file mode 100644 index 13ef46226..000000000 --- a/model/getGlobalVariable.md +++ /dev/null @@ -1,36 +0,0 @@ - - -## model.getGlobalVariable(index, flight_mode) - - - -Return current global variable value - -Example: - -```lua - -- get GV3 (index = 2) from Flight mode 0 (FM0) - val = model.getGlobalVariable(2, 0) -``` - - -#### Parameters - -* `index` zero based global variable index, use 0 for GV1, 8 for GV9 - -* `flight_mode` Flight mode number (0 = FM0, 8 = FM8) - - - -#### Return value - -* `nil` requested global variable does not exist - -* `number` current value of global variable - - - -##### Notice -a simple warning or notice - - diff --git a/model/getInfo.md b/model/getInfo.md deleted file mode 100644 index 4b86bb536..000000000 --- a/model/getInfo.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## model.getInfo() - - - -Get current Model information - -@status current Introduced in 2.0.6, changed in 2.2.0 - - -#### Parameters - -none - -#### Return value - -* `table` model information: - * `name` (string) model name - * `bitmap` (string) bitmap name (not present on X7) - - - diff --git a/model/getInput.md b/model/getInput.md deleted file mode 100644 index ec544ede9..000000000 --- a/model/getInput.md +++ /dev/null @@ -1,37 +0,0 @@ - - -## model.getInput(input, line) - - - -Return input data for given input and line number - -@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10, flighmode reworked in 2.3.11 - - -#### Parameters - -* `input` (unsigned number) input number (use 0 for Input1) - -* `line` (unsigned number) input line (use 0 for first line) - - - -#### Return value - -* `nil` requested input or line does not exist - -* `table` input data: - * `name` (string) input line name - * `inputName` (string) input input name - * `source` (number) input source index - * `weight` (number) input weight - * `offset` (number) input offset - * `switch` (number) input switch index - * `curveType` (number) curve type (function, expo, custom curve) - * `curveValue` (number) curve index - * `carryTrim` (boolean) input trims applied - * 'flightModes' (number) bit-mask of active flight modes - - - diff --git a/model/getInputsCount.md b/model/getInputsCount.md deleted file mode 100644 index 60ad9d13a..000000000 --- a/model/getInputsCount.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## model.getInputsCount(input) - - - -Return number of lines for given input - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `input` (unsigned number) input number (use 0 for Input1) - - - -#### Return value - -* `number` number of configured lines for given input - - - diff --git a/model/getLogicalSwitch.md b/model/getLogicalSwitch.md deleted file mode 100644 index 7d7b93c74..000000000 --- a/model/getLogicalSwitch.md +++ /dev/null @@ -1,32 +0,0 @@ - - -## model.getLogicalSwitch(switch) - - - -Get Logical Switch parameters - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `switch` (unsigned number) logical switch number (use 0 for LS1) - - - -#### Return value - -* `nil` requested logical switch does not exist - -* `table` logical switch data: - * `func` (number) function index - * `v1` (number) V1 value (index) - * `v2` (number) V2 value (index or value) - * `v3` (number) V3 value (index or value) - * `and` (number) AND switch index - * `delay` (number) delay (time in 1/10 s) - * `duration` (number) duration (time in 1/10 s) - - - diff --git a/model/getMix.md b/model/getMix.md deleted file mode 100644 index 4615f9bf2..000000000 --- a/model/getMix.md +++ /dev/null @@ -1,42 +0,0 @@ - - -## model.getMix(channel, line) - - - -Get configuration for specified Mix - -@status current Introduced in 2.0.0, parameters below `multiplex` added in 2.0.13 - - -#### Parameters - -* `channel` (unsigned number) channel number (use 0 for CH1) - -* `line` (unsigned number) mix number (use 0 for first line(mix)) - - - -#### Return value - -* `nil` requested channel or line does not exist - -* `table` mix data: - * `name` (string) mix line name - * `source` (number) source index - * `weight` (number) weight (1024 == 100%) value or GVAR1..9 = 4096..4011, -GVAR1..9 = 4095..4087 - * `offset` (number) offset value or GVAR1..9 = 4096..4011, -GVAR1..9 = 4095..4087 - * `switch` (number) switch index - * `multiplex` (number) multiplex (0 = ADD, 1 = MULTIPLY, 2 = REPLACE) - * `curveType` (number) curve type (function, expo, custom curve) - * `curveValue` (number) curve index - * `flightModes` (number) bit-mask of active flight modes - * `carryTrim` (boolean) carry trim - * `mixWarn` (number) warning (0 = off, 1 = 1 beep, .. 3 = 3 beeps) - * `delayUp` (number) delay up (time in 1/10 s) - * `delayDown` (number) delay down - * `speedUp` (number) speed up - * `speedDown` (number) speed down - - - diff --git a/model/getMixesCount.md b/model/getMixesCount.md deleted file mode 100644 index 5eca8ce77..000000000 --- a/model/getMixesCount.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## model.getMixesCount(channel) - - - -Get the number of Mixer lines that the specified Channel has - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `channel` (unsigned number) channel number (use 0 for CH1) - - - -#### Return value - -* `number` number of mixes for requested channel - - - diff --git a/model/getModule.md b/model/getModule.md deleted file mode 100644 index 9f8917969..000000000 --- a/model/getModule.md +++ /dev/null @@ -1,57 +0,0 @@ - - -## model.getModule(index) - - - -Get RF module parameters - -`Type` values: - * 0 NONE - * 1 PPM - * 2 XJT_PXX1 - * 3 ISRM_PXX2 - * 4 DSM2 - * 5 CROSSFIRE - * 6 MULTIMODULE - * 7 R9M_PXX1 - * 8 R9M_PXX2 - * 9 R9M_LITE_PXX1 - * 10 R9M_LITE_PXX2 - * 11 R9M_LITE_PRO_PXX1 - * 12 R9M_LITE_PRO_PXX2 - * 13 SBUS - * 14 XJT_LITE_PXX2 - -`subType` values for XJT_PXX1: - * -1 OFF - * 0 D16 - * 1 D8 - * 2 LR12 - -@status current Introduced in 2.2.0 - - -#### Parameters - -* `index` (number) module index (0 for internal, 1 for external) - - - -#### Return value - -* `nil` requested module does not exist - -* `table` module parameters: - * `subType` (number) protocol index - * `modelId` (number) receiver number - * `firstChannel` (number) start channel (0 is CH1) - * `channelsCount` (number) number of channels sent to module - * `Type` (number) module type - * if the module type is Multi additional information are available - * `protocol` (number) protocol number (Multi only) - * `subProtocol` (number) sub-protocol number (Multi only) - * `channelsOrder` (number) first 4 channels expected order (Multi only) - - - diff --git a/model/getOutput.md b/model/getOutput.md deleted file mode 100644 index 79c1b170f..000000000 --- a/model/getOutput.md +++ /dev/null @@ -1,35 +0,0 @@ - - -## model.getOutput(index) - - - -Get servo parameters - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `index` (unsigned number) output number (use 0 for CH1) - - - -#### Return value - -* `nil` requested output does not exist - -* `table` output parameters: - * `name` (string) name - * `min` (number) Minimum % * 10 - * `max` (number) Maximum % * 10 - * `offset` (number) Subtrim * 10 - * `ppmCenter` (number) offset from PPM Center. 0 = 1500 - * `symetrical` (number) linear Subtrim 0 = Off, 1 = On - * `revert` (number) irection 0 = ­­­---, 1 = INV - * `curve` - * (number) Curve number (0 for Curve1) - * or `nil` if no curve set - - - diff --git a/model/getSensor.md b/model/getSensor.md deleted file mode 100644 index f5d9ca662..000000000 --- a/model/getSensor.md +++ /dev/null @@ -1,32 +0,0 @@ - - -## model.getSensor(sensor) - - - -Get Telemetry Sensor parameters - -@status current Introduced in 2.3.0 - - -#### Parameters - -* `sensor` (unsigned number) sensor number (use 0 for sensor 1) - - - -#### Return value - -* `nil` requested sensor does not exist - -* `table` with sensor data: - * `type` (number) 0 = custom, 1 = calculated - * `name` (string) Name - * `unit` (number) See list of units in the appendix of the OpenTX Lua Reference Guide - * `prec` (number) Number of decimals - * `id` (number) Only custom sensors - * `instance` (number) Only custom sensors - * `formula` (number) Only calculated sensors. 0 = Add etc. see list of formula choices in Companion popup - - - diff --git a/model/getTimer.md b/model/getTimer.md deleted file mode 100644 index 57a4053b5..000000000 --- a/model/getTimer.md +++ /dev/null @@ -1,32 +0,0 @@ - - -## model.getTimer(timer) - - - -Get model timer parameters - -@status current Introduced in 2.0.0, name added in 2.3.6 - - -#### Parameters - -* `timer` (number) timer index (0 for Timer 1) - - - -#### Return value - -* `nil` requested timer does not exist - -* `table` timer parameters: - * `mode` (number) timer trigger source: off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw - * `start` (number) start value [seconds], 0 for up timer, 0> down timer - * `value` (number) current value [seconds] - * `countdownBeep` (number) countdown beep (0­ = silent, 1 =­ beeps, 2­ = voice) - * `minuteBeep` (boolean) minute beep - * `persistent` (number) persistent timer - * `name` (string) timer name - - - diff --git a/model/insertInput.md b/model/insertInput.md deleted file mode 100644 index 1746aba4b..000000000 --- a/model/insertInput.md +++ /dev/null @@ -1,25 +0,0 @@ - - -## model.insertInput(input, line, value) - - - -Insert an Input at specified line - -@status current Introduced in 2.0.0, curveType/curveValue/carryTrim added in 2.3, inputName added 2.3.10 - - -#### Parameters - -* `input` (unsigned number) input number (use 0 for Input1) - -* `line` (unsigned number) input line (use 0 for first line) - -* `value` (table) input data, see model.getInput() - - - -#### Return value - -none - diff --git a/model/insertMix.md b/model/insertMix.md deleted file mode 100644 index a7955cdde..000000000 --- a/model/insertMix.md +++ /dev/null @@ -1,25 +0,0 @@ - - -## model.insertMix(channel, line, value) - - - -Insert a mixer line into Channel - -@status current Introduced in 2.0.0, parameters below `multiplex` added in 2.0.13 - - -#### Parameters - -* `channel` (unsigned number) channel number (use 0 for CH1) - -* `line` (unsigned number) mix number (use 0 for first line(mix)) - -* `value` (table) see model.getMix() for table format - - - -#### Return value - -none - diff --git a/model/resetSensor.md b/model/resetSensor.md deleted file mode 100644 index 1c64e4bee..000000000 --- a/model/resetSensor.md +++ /dev/null @@ -1,21 +0,0 @@ - - -## model.resetSensor(sensor) - - - -Reset Telemetry Sensor parameters - -@status current Introduced in 2.3.11 - - -#### Parameters - -* `sensor` (unsigned number) sensor number (use 0 for sensor 1) - - - -#### Return value - -* `nil` - diff --git a/model/resetTimer.md b/model/resetTimer.md deleted file mode 100644 index c63b6e0f2..000000000 --- a/model/resetTimer.md +++ /dev/null @@ -1,21 +0,0 @@ - - -## model.resetTimer(timer) - - - -Reset model timer to a startup value - -@status current Introduced in TODO - - -#### Parameters - -* `timer` (number) timer index (0 for Timer 1) - - - -#### Return value - -none - diff --git a/model/setCurve.md b/model/setCurve.md deleted file mode 100644 index 0cb316a1b..000000000 --- a/model/setCurve.md +++ /dev/null @@ -1,51 +0,0 @@ - - -## model.setCurve(curve, params) - - - -Set Curve parameters - -The first and last x value must -100 and 100 and x values must be monotonically increasing - -@status current Introduced in 2.2.0 - -Example setting a 4-point custom curve: -```lua - params = {} - params["x"] = {-100, -34, 77, 100} - params["y"] = {-70, 20, -89, -100} - params["smooth"] = true - params["type"] = 1 - val = model.setCurve(2, params) - ``` -setting a 6-point standard smoothed curve - ```lua - val = model.setCurve(3, {smooth=true, y={-100, -50, 0, 50, 100, 80}}) - ``` - - - -#### Parameters - -* `curve` (unsigned number) curve number (use 0 for Curve1) - -* `params` see model.getCurve return format for table format. setCurve uses standard - lua array indexing and arrays start at index 1 - - - -#### Return value - -* `` 0 - Everything okay - 1 - Wrong number of points - 2 - Invalid Curve number - 3 - Cuve does not fit anymore - 4 - point of out of index - 5 - x value not monotonically increasing - 6 - y value not in range [-100;100] - 7 - extra values for y are set - 8 - extra values for x are set - - - diff --git a/model/setCustomFunction.md b/model/setCustomFunction.md deleted file mode 100644 index a9e8577d5..000000000 --- a/model/setCustomFunction.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## model.setCustomFunction(function, value) - - - -Set Custom Function parameters - -@status current Introduced in 2.0.0, TODO rename function - - -#### Parameters - -* `function` (unsigned number) custom function number (use 0 for CF1) - -* `value` (table) custom function parameters, see model.getCustomFunction() for table format - - - -#### Return value - -none - -##### Notice -If a parameter is missing from the value, then -that parameter remains unchanged. - - diff --git a/model/setFlightMode.md b/model/setFlightMode.md deleted file mode 100644 index 1951ed7d8..000000000 --- a/model/setFlightMode.md +++ /dev/null @@ -1,23 +0,0 @@ - - -## model.setFlightMode(index, params) - - - -Set Flight mode parameters - -@status current Introduced in 2.3.10 - - -#### Parameters - -* `index` (unsigned number) flight mode number (use 0 for FM0) - -* `params` see model.getFlightMode return format for table format. - - - -#### Return value - -none - diff --git a/model/setGlobalVariable.md b/model/setGlobalVariable.md deleted file mode 100644 index bc2f3dd57..000000000 --- a/model/setGlobalVariable.md +++ /dev/null @@ -1,30 +0,0 @@ - - -## model.setGlobalVariable(index, flight_mode, value) - - - -Sets current global variable value. See also model.getGlobalVariable() - - -#### Parameters - -* `index` zero based global variable index, use 0 for GV1, 8 for GV9 - -* `flight_mode` Flight mode number (0 = FM0, 8 = FM8) - -* `value` new value for global variable. Permitted range is -from -1024 to 1024. - - - -#### Return value - -none - -##### Notice -Global variable can only store integer values, -any floating point value is converted into integer value -by truncating everything behind a floating point. - - diff --git a/model/setInfo.md b/model/setInfo.md deleted file mode 100644 index dbb968369..000000000 --- a/model/setInfo.md +++ /dev/null @@ -1,26 +0,0 @@ - - -## model.setInfo(value) - - - -Set the current Model information - -@status current Introduced in 2.0.6, changed in TODO - - -#### Parameters - -* `value` model information data, see model.getInfo() - - - -#### Return value - -none - -##### Notice -If a parameter is missing from the value, then -that parameter remains unchanged. - - diff --git a/model/setLogicalSwitch.md b/model/setLogicalSwitch.md deleted file mode 100644 index d46630b0f..000000000 --- a/model/setLogicalSwitch.md +++ /dev/null @@ -1,32 +0,0 @@ - - -## model.setLogicalSwitch(switch, value) - - - -Set Logical Switch parameters - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `switch` (unsigned number) logical switch number (use 0 for LS1) - -* `value` (table) see model.getLogicalSwitch() for table format - - - -#### Return value - -none - -##### Notice -If a parameter is missing from the value, then -that parameter remains unchanged. - - -To set the `and` member (which is Lua keyword) -use the following syntax: `model.setLogicalSwitch(30, {func=4,v1=1,v2=-99, ["and"]=24})` - - diff --git a/model/setModule.md b/model/setModule.md deleted file mode 100644 index 221c89051..000000000 --- a/model/setModule.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## model.setModule(index, value) - - - -Set RF module parameters - -@status current Introduced in 2.2.0, modified in 2.3.12 (proto/subproto) - - -#### Parameters - -* `index` (number) module index (0 for internal, 1 for external) - -* `value` module parameters, see model.getModule() - - - -#### Return value - -none - -##### Notice -If a parameter is missing from the value, then -that parameter remains unchanged. - - diff --git a/model/setOutput.md b/model/setOutput.md deleted file mode 100644 index 85e6dd00f..000000000 --- a/model/setOutput.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## model.setOutput(index, value) - - - -Set servo parameters - -@status current Introduced in 2.0.0 - - -#### Parameters - -* `index` (unsigned number) channel number (use 0 for CH1) - -* `value` (table) servo parameters, see model.getOutput() for table format - - - -#### Return value - -none - -##### Notice -If a parameter is missing from the value, then -that parameter remains unchanged. - - diff --git a/model/setTimer.md b/model/setTimer.md deleted file mode 100644 index 1d4cf8831..000000000 --- a/model/setTimer.md +++ /dev/null @@ -1,28 +0,0 @@ - - -## model.setTimer(timer, value) - - - -Set model timer parameters - -@status current Introduced in 2.0.0, name added in 2.3.6 - - -#### Parameters - -* `timer` (number) timer index (0 for Timer 1) - -* `value` timer parameters, see model.getTimer() - - - -#### Return value - -none - -##### Notice -If a parameter is missing from the value, then -that parameter remains unchanged. - - diff --git a/one-time_scripts.md b/one-time_scripts.md deleted file mode 100644 index 4c8b82f54..000000000 --- a/one-time_scripts.md +++ /dev/null @@ -1,23 +0,0 @@ -# One-Time Scripts - -#####Overview - -One-Time scripts start when called upon by a specific radio function or when the user selects them from a contextual menu. They do their task and are then terminated and unloaded. Please note that all persistent scripts are halted during the execution of one time scripts. They are automatically restarted once the one time script is finished. This is done to provide enough system resources to execute the one time script. - -#####***WARNING! - *** - - Running a One-Time script will suspend execution of all other currently loaded Lua scripts (Mix, Telemetry, and Functions) - -##### File Location - -Place them anywhere on SD card, the folder /SCRIPTS/ is recommended. The only exception is official model wizard script, that should be put into /SCRIPTS/WIZARD/ folder that way it will start automatically -when new model is created. - -##### Lifetime of One-Time scripts - -Script is executed when user selects Execute on a script file from SD card browser screen. - -Script executes until: - - it returns value different from 0 - - is forcefully closed by user by long press of EXIT key - - is forcefully closed by system if if it misbehaves (too long runtime, error in code, low -memory) \ No newline at end of file diff --git a/optimization_tricks.md b/optimization_tricks.md deleted file mode 100644 index e4890a476..000000000 --- a/optimization_tricks.md +++ /dev/null @@ -1,31 +0,0 @@ -# Speed and Memory Optimization Tricks - - -## Faster getValue() - -Normally one uses [getValue()](general/getValue.md) function with the source/filed name like so: - -```lua -local foo = getValue("bar") -``` - -This works and is recommended method for portability. But if a particular script needs to get the value of certain field a lot, then it is faster to use this syntax: - -```lua - -local my_id = getFiledInfo("bar").id -- here we get the numerical id of the filed "bar" - -local function run_a_lot() - local my_value = getValue(my_id) -- exactly the same effect as local my_value = getValue("bar"), but faster -end -``` - -Why is this method faster? With the function [getFieldInfo(name)](general/getFieldInfo.md) we get the `numerical id` of the wanted filed. The function has to find the requested value by its name in the table of all available sources. That search takes some time. - -When we use this syntax the search is only done once. In comparison in the first -example the search must be performed every time `getValue("bar")` is called. - -So when the `getValue(my_id)` is called the search can be skipped and the requested value if fetched directly. - -Of course there is a trade-of, the second example uses little more memory (for variable `my_id`). - diff --git a/output_table_syntax.md b/output_table_syntax.md deleted file mode 100644 index 523ae2071..000000000 --- a/output_table_syntax.md +++ /dev/null @@ -1,37 +0,0 @@ -# Output Table Syntax - -#####Overview - -Outputs are only used in mix scripts. The output table defines only name(s), the actual values are determined by the script's [run function](run_function_syntax.md). - -```lua -{ "", "" } -``` - - -Example: -```lua -local output { "Val1", "Val2" } - -local function run() - return 0, -1024 -- these values will be available in OpenTX as Val1 and Val2 -end - -return {output=output, run=run} -``` - -#####Notes: - -* Output name is limited to four characters. - -* A maximum of 6 outputs are supported - -* Number Format -Outputs are 16 bit signed integers when they leave Lua script and are then divided by 10.24 to produce output value in percent: - -|Script Return Value|Mix Value in OpenTX| -|-----|----| -|0| 0%| -|996| 97.2%| -|1024| 100%| -|-1024|-100%| diff --git a/part_i_-_script_type_overview.md b/part_i_-_script_type_overview.md deleted file mode 100644 index d5b5df8aa..000000000 --- a/part_i_-_script_type_overview.md +++ /dev/null @@ -1,3 +0,0 @@ -# Part I - Script Type Overview - -This section introduces the types of Lua scripts supported by OpenTX and how they may be used. \ No newline at end of file diff --git a/part_ii_-_opentx_lua_api_programming_guide.md b/part_ii_-_opentx_lua_api_programming_guide.md deleted file mode 100644 index efb1fe9b0..000000000 --- a/part_ii_-_opentx_lua_api_programming_guide.md +++ /dev/null @@ -1,2 +0,0 @@ -# Part II - OpenTX Lua API Programming Guide -This section provides more specifics on the OpenTX Lua implementation. Here you will find syntax rules for interface tables and functions. \ No newline at end of file diff --git a/part_iii_-_opentx_lua_api_reference.md b/part_iii_-_opentx_lua_api_reference.md deleted file mode 100644 index 2f1e3745d..000000000 --- a/part_iii_-_opentx_lua_api_reference.md +++ /dev/null @@ -1,3 +0,0 @@ -# Part III - OpenTX Lua API Reference - -This section describes the Lua libraries, functions and constants that are provided by OpenTX. \ No newline at end of file diff --git a/part_iii_-_opentx_lua_api_reference/Bitmap-functions-less-than-greater-than-luadoc-begin-Bitmap/open.md b/part_iii_-_opentx_lua_api_reference/Bitmap-functions-less-than-greater-than-luadoc-begin-Bitmap/open.md deleted file mode 100644 index 45a6c8c3a..000000000 --- a/part_iii_-_opentx_lua_api_reference/Bitmap-functions-less-than-greater-than-luadoc-begin-Bitmap/open.md +++ /dev/null @@ -1,34 +0,0 @@ - - -## Bitmap.open(name) - - - -Loads a bitmap in memory, for later use with lcd.drawBitmap(). Bitmaps should be loaded only -once, returned object should be stored and used for drawing. If loading fails for whatever -reason the resulting bitmap object will have width and height set to zero. - -Bitmap loading can fail if: - * File is not found or contains invalid image - * System is low on memory - * Combined memory usage of all Lua script bitmaps exceeds certain value - -@status current Introduced in 2.2.0 - - -#### Parameters - -* `name` (string) full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”) - - - -#### Return value - -* `bitmap` (object) a bitmap object that can be used with other bitmap functions - - - -##### Notice -Only available on Horus - - diff --git a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/getsize.md b/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/getsize.md deleted file mode 100644 index d7e790d63..000000000 --- a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/getsize.md +++ /dev/null @@ -1,20 +0,0 @@ -# Bitmap.getSize\(name\) - -Return width, height of a bitmap object - -@status current Introduced in 2.2.0 - -## Parameters - -* `bitmap` \(pointer\) point to a bitmap previously opened with Bitmap.open\(\) - -## Return value - -* `multiple` returns 2 values: - * \(number\) width in pixels - * \(number\) height in pixels - -### Notice - -Only available on Horus - diff --git a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/open.md b/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/open.md deleted file mode 100644 index a6ff06b97..000000000 --- a/part_iii_-_opentx_lua_api_reference/bitmap-functions-less-than-greater-than-luadoc-begin-bitmap/open.md +++ /dev/null @@ -1,24 +0,0 @@ -# Bitmap.open\(name\) - -Loads a bitmap in memory, for later use with lcd.drawBitmap\(\). Bitmaps should be loaded only once, returned object should be stored and used for drawing. If loading fails for whatever reason the resulting bitmap object will have width and height set to zero. - -Bitmap loading can fail if: - -* File is not found or contains invalid image -* System is low on memory -* Combined memory usage of all Lua script bitmaps exceeds certain value - -@status current Introduced in 2.2.0 - -## Parameters - -* `name` \(string\) full path to the bitmap on SD card \(i.e. “/IMAGES/test.bmp”\) - -## Return value - -* `bitmap` \(object\) a bitmap object that can be used with other bitmap functions - -### Notice - -Only available on Horus - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/clear.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/clear.md deleted file mode 100644 index 8841c70f4..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/clear.md +++ /dev/null @@ -1,14 +0,0 @@ -# lcd.clear\(\[color\]\) - -Clear the LCD screen - -@status current Introduced in 2.0.0, `color` parameter introduced in 2.2.0 RC12 - -## Parameters - -* `color` \(optional, only on color screens\) - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawbitmap.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawbitmap.md deleted file mode 100644 index db7ca35fd..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawbitmap.md +++ /dev/null @@ -1,20 +0,0 @@ -# lcd.drawBitmap\(bitmap, x, y \[, scale\]\) - -Displays a bitmap at \(x,y\) - -@status current Introduced in 2.2.0 - -## Parameters - -* `bitmap` \(pointer\) point to a bitmap previously opened with Bitmap.open\(\) -* `x,y` \(positive numbers\) starting coordinates -* `scale` \(positive numbers\) scale in %, 50 divides size by two, 100 is unchanged, 200 doubles size. Omitting scale draws image in 1:1 scale and is faster than specifying 100 for scale. - -## Return value - -none - -### Notice - -Only available on Horus - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawchannel.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawchannel.md deleted file mode 100644 index e155eb5ee..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawchannel.md +++ /dev/null @@ -1,16 +0,0 @@ -# lcd.drawChannel\(x, y, source, flags\) - -Display a telemetry value at \(x,y\) - -@status current Introduced in 2.0.6, changed in 2.1.0 \(only telemetry sources are valid\) - -## Parameters - -* `x,y` \(positive numbers\) starting coordinate -* `source` can be a source identifier \(number\) or a source name \(string\). See getValue\(\) -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcombobox.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcombobox.md deleted file mode 100644 index faf2a88f0..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawcombobox.md +++ /dev/null @@ -1,25 +0,0 @@ -# lcd.drawCombobox\(x, y, w, list, idx \[, flags\]\) - -Draw a combo box - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) top left corner position -* `w` \(number\) width of combo box in pixels -* `list` \(table\) combo box elements, each element is a string -* `idx` \(integer\) index of entry to highlight -* `flags` \(unsigned number\) drawing flags, the flags can not be combined: - * `BLINK` combo box is expanded - * `INVERS` combo box collapsed, text inversed - * `0 or not present` combo box collapsed, text normal - -## Return value - -none - -### Notice - -Only available on Taranis - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledrectangle.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledrectangle.md deleted file mode 100644 index 041040a5f..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawfilledrectangle.md +++ /dev/null @@ -1,18 +0,0 @@ -# lcd.drawFilledRectangle\(x, y, w, h \[, flags\]\) - -Draw a solid rectangle from top left corner \(x,y\) of specified width and height - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) top left corner position -* `w` \(number\) width in pixels -* `h` \(number\) height in pixels -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants -* `opacity` \(number\) opacity defaults to 0 \(only on Horus\) - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawgauge.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawgauge.md deleted file mode 100644 index 303cddbe4..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawgauge.md +++ /dev/null @@ -1,19 +0,0 @@ -# lcd.drawGauge\(x, y, w, h, fill, maxfill \[, flags\]\) - -Draw a simple gauge that is filled based upon fill value - -@status current Introduced in 2.0.0, changed in 2.2.0 - -## Parameters - -* `x,y` \(positive numbers\) top left corner position -* `w` \(number\) width in pixels -* `h` \(number\) height in pixels -* `fill` \(number\) amount of fill to apply -* `maxfill` \(number\) total value of fill -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawline.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawline.md deleted file mode 100644 index e0585f94d..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawline.md +++ /dev/null @@ -1,21 +0,0 @@ -# lcd.drawLine\(x1, y1, x2, y2, pattern, flags\) - -Draw a straight line on LCD - -@status current Introduced in 2.0.0, flags introduced in 2.3.6 - -## Parameters - -* `x1,y1` \(positive numbers\) starting coordinate -* `x2,y2` \(positive numbers\) end coordinate -* `pattern` SOLID or DOTTED -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants - -## Return value - -none - -### Notice - -If the start or the end of the line is outside the LCD dimensions, then the whole line will not be drawn \(starting from OpenTX 2.1.5\) - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawnumber.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawnumber.md deleted file mode 100644 index 4583c6d75..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawnumber.md +++ /dev/null @@ -1,17 +0,0 @@ -# lcd.drawNumber\(x, y, value \[, flags \[, inversColor\]\]\) - -Display a number at \(x,y\) - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) starting coordinate -* `value` \(number\) value to display -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants -* `inversColor` \(optional with INVERS flag\) overrides the inverse text color for INVERS - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpixmap.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpixmap.md deleted file mode 100644 index c46eb2cf2..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpixmap.md +++ /dev/null @@ -1,19 +0,0 @@ -# lcd.drawPixmap\(x, y, name\) - -Draw a bitmap at \(x,y\) - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) starting coordinates -* `name` \(string\) full path to the bitmap on SD card \(i.e. “/IMAGES/test.bmp”\) - -## Return value - -none - -### Notice - -Maximum image size is \[display width / 2\] x \[display height\] pixels. - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpoint.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpoint.md deleted file mode 100644 index 2d95aea29..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawpoint.md +++ /dev/null @@ -1,20 +0,0 @@ -# lcd.drawPoint\(x, y\) - -Draw a single pixel at \(x,y\) position - -@status current Introduced in 2.0.0 - -## Parameters - -* `x` \(positive number\) x position -* `y` \(positive number\) y position -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants - -## Return value - -none - -### Notice - -Taranis has an LCD display width of 212 pixels and height of 64 pixels. Position \(0,0\) is at top left. Y axis is negative, top line is 0, bottom line is 63. Drawing on an existing black pixel produces white pixel \(TODO check this!\) - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawrectangle.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawrectangle.md deleted file mode 100644 index 99271e748..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawrectangle.md +++ /dev/null @@ -1,19 +0,0 @@ -# lcd.drawRectangle\(x, y, w, h \[, flags \[, t\]\]\) - -Draw a rectangle from top left corner \(x,y\) of specified width and height - -@status current Introduced in 2.0.0, changed in 2.2.0 - -## Parameters - -* `x,y` \(positive numbers\) top left corner position -* `w` \(number\) width in pixels -* `h` \(number\) height in pixels -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants -* `t` \(number\) thickness in pixels, defaults to 1 \(only on Horus\) -* `opacity` \(number\) opacity defaults to 0 \(only on Horus\) - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawscreentitle.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawscreentitle.md deleted file mode 100644 index 087eccb58..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawscreentitle.md +++ /dev/null @@ -1,20 +0,0 @@ -# lcd.drawScreenTitle\(title, page, pages\) - -Draw a title bar - -@status current Introduced in 2.0.0 - -## Parameters - -* `title` \(string\) text for the title -* `page` \(number\) page number -* `pages` \(number\) total number of pages. Only used as indicator on the right side of title bar. \(i.e. idx=2, cnt=5, display `2/5`\) - -## Return value - -none - -### Notice - -Only available on Taranis - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawsource.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawsource.md deleted file mode 100644 index a746ad894..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawsource.md +++ /dev/null @@ -1,16 +0,0 @@ -# lcd.drawSource\(x, y, source \[, flags\]\) - -Displays the name of the corresponding input as defined by the source at \(x,y\) - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) starting coordinate -* `source` \(number\) source index -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawswitch.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawswitch.md deleted file mode 100644 index b13ec8def..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawswitch.md +++ /dev/null @@ -1,16 +0,0 @@ -# lcd.drawSwitch\(x, y, switch, flags\) - -Draw a text representation of switch at \(x,y\) - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) starting coordinate -* `switch` \(number\) number of switch to display, negative number displays negated switch -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) constants, only SMLSIZE, BLINK and INVERS. - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtext.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtext.md deleted file mode 100644 index 537c46ff4..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtext.md +++ /dev/null @@ -1,16 +0,0 @@ -# lcd.drawText(x, y, text \[, flags \[, inversColor]]) - -Draw a text beginning at (x,y) - -@status current Introduced in 2.0.0, `SHADOWED` introduced in 2.2.1 - -## Parameters - -* `x,y` (positive numbers) starting coordinate -* `text` (string) text to display -* `flags` (optional) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants for drawing flags and colors, and [Appendix](../../appendix/fonts.md) for available characters in each font set. -* `inversColor` (optional with the INVERS flag) overrides the inverse text color for INVERS - -## Return value - -none diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtimer.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtimer.md deleted file mode 100644 index 8c4b79f8b..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/drawtimer.md +++ /dev/null @@ -1,17 +0,0 @@ -# lcd.drawTimer\(x, y, value \[, flags \[, inversColor\]\]\) - -Display a value formatted as time at \(x,y\) - -@status current Introduced in 2.0.0 - -## Parameters - -* `x,y` \(positive numbers\) starting coordinate -* `value` \(number\) time in seconds -* `flags` \(optional\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants -* `inversColor` \(optional with INVERS flag\) overrides the inverse text color for INVERS - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getcolor.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getcolor.md deleted file mode 100644 index 42870a17d..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getcolor.md +++ /dev/null @@ -1,18 +0,0 @@ -# lcd.getColor\(flags\) - -Get the color value from flags - -@status current Introduced in 2.3.11 - -## Parameters - -* `flags` \(flags\) please see [flags](../constants/flags-and-pattern-constants.md) and [color](../constants/color-constants.md) constants - -## Return value - -* `color` \(flag\) only the RGB565 color value of the input - -### Notice - -Only available on radios with color display - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastleftpos.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastleftpos.md deleted file mode 100644 index 6db6f0989..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastleftpos.md +++ /dev/null @@ -1,18 +0,0 @@ -# lcd.getLastLeftPos\(\) - -Returns the leftmost x position from previous drawtext or drawNumber output - -@status current Introduced in 2.2.0 - -## Parameters - -none - -## Return value - -* `number` \(integer\) x position - -### Notice - -Only available on Taranis - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastpos.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastpos.md deleted file mode 100644 index 2ade6a6ee..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastpos.md +++ /dev/null @@ -1,20 +0,0 @@ -# lcd.getLastPos\(\) - -Returns the rightmost x position from previous output - -@status current Introduced in 2.0.0 - -## Parameters - -none - -## Return value - -* `number` \(integer\) x position - -### Notice - -Only available on Taranis - -For added clarity, it is recommended to use lcd.getLastRightPos\(\) - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastrightpos.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastrightpos.md deleted file mode 100644 index 7ee37c2b4..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/getlastrightpos.md +++ /dev/null @@ -1,20 +0,0 @@ -# lcd.getLastRightPos\(\) - -Returns the rightest x position from previous drawtext or drawNumber output - -@status current Introduced in 2.2.0 - -## Parameters - -none - -## Return value - -* `number` \(integer\) x position - -### Notice - -Only available on Taranis - -This is strictly equivalent to former lcd.getLastPos\(\) - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.md deleted file mode 100644 index a4445798e..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/lcd_functions-overview.md +++ /dev/null @@ -1,14 +0,0 @@ -# Lcd Functions Overview - -## Description - -Lcd functions allow scripts to interact with the transmitter display. This access is limited to the `run` function of One-Time and Telemetry scripts, and the `refresh` function of Widget scripts on radios with color display. - -## Notes: - -The run function is periodically called when the screen is visible. In OpenTX 2.0 each invocation starts with a blank screen \(unless lcd.lock\(\) is used\). Under OpenTX 2.1 screen state is always persisted across calls to the run function. **Many scripts originally written for OpenTX 2.0 require a call to lcd.clear\(\) at the beginning of their run function in order to display properly under 2.1 and 2.2.** - -For Widget scripts, `lcd.clear()` is not needed, as each invocation starts with a blank screen showing the theme background. But it can be used to overwrite the theme background with another color by calling `lcd.clear(color)`. - -Please see above for a description of the constants for [flags and patterns](../constants/flags-and-pattern-constants.md), [colors](../constants/color-constants.md), and [screen size](../constants/screen-constants.md) that can be used with lcd drawing functions. - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/refresh.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/refresh.md deleted file mode 100644 index 755afe1df..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/refresh.md +++ /dev/null @@ -1,16 +0,0 @@ -# lcd.refresh\(\) - -Refresh the LCD screen - -From 2.4.0 on color LCDs, this is done automatically when the screen needs to be refreshed \(on events and depending on refresh period\). - -@status current Only used on non-color LCDs. - -## Parameters - -none - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/resetbacklighttimeout.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/resetbacklighttimeout.md deleted file mode 100644 index abe2000ed..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/resetbacklighttimeout.md +++ /dev/null @@ -1,14 +0,0 @@ -# lcd.resetBacklightTimeout\(\) - -Reset the backlight timeout - -@status current Introduced in 2.3.6 - -## Parameters - -none - -## Return value - -none - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/rgb.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/rgb.md deleted file mode 100644 index 0eb757b1e..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/rgb.md +++ /dev/null @@ -1,21 +0,0 @@ -# lcd.RGB\(r, g, b \| rgb\) - -Returns a drawing flag with RGB color code - -@status current Introduced in 2.2.0 - -## Parameters - -* `r` \(integer\) a number between 0 and 255 that expresses the amount of red in the color -* `g` \(integer\) a number between 0 and 255 that expresses the amount of green in the color -* `b` \(integer\) a number between 0 and 255 that expresses the amount of blue in the color -* `rgb` \(integer\) a number between 0 and 0xFFFFFF that expresses the RGB value \(0xFF0000=RED, 0x00FF00=GREEN, 0x0000FF=BLUE\) - -## Return value - -* `flag` with RGB565 color - -### Notice - -Only available on radios with color display. Use _either_ lcd.RGB\(r,g,b\) _or_ lcd.RGB\(rgb\). - diff --git a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/setcolor.md b/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/setcolor.md deleted file mode 100644 index 4772e72b0..000000000 --- a/part_iii_-_opentx_lua_api_reference/lcd-functions-less-than-greater-than-luadoc-begin-lcd/setcolor.md +++ /dev/null @@ -1,24 +0,0 @@ -# lcd.setColor\(colorIndex, color\) - -Change an indexed color \(theme colors and CUSTOM\_COLOR\). - -@status current Introduced in 2.2.0 - -## Notice - -* Changing theme colors affects not only other Lua widgets, but the entire radio interface. -* Only available on radios with color display - -## Parameters - -* `colorIndex` \(flags\) must be an indexed color, please see [color](../constants/color-constants.md) constants. -* `color` \(flags\) please see [color](../constants/color-constants.md) constants. - -## Return value - -none - -### Notice - -Only available on radios with color display - diff --git a/part_iv_-_converting_opentx_20_scripts.md b/part_iv_-_converting_opentx_20_scripts.md deleted file mode 100644 index df9829887..000000000 --- a/part_iv_-_converting_opentx_20_scripts.md +++ /dev/null @@ -1,6 +0,0 @@ -# Part IV - Converting OpenTX 2.0 Scripts - -The handling of telemetry data is significantly improved in OpenTX 2.1. However, in order to support the additional flexibility of having multiple sensors of the same type, many Lua scripts referencing GPS and Lipo sensor data will require revision. - -This section also covers some of the requirements for scripts that are necessary for them to function properly under both OpenTX 2.1 and OpenTX 2.0. - diff --git a/part_vi_-_advanced_topics.md b/part_vi_-_advanced_topics.md deleted file mode 100644 index 7dd3a7bde..000000000 --- a/part_vi_-_advanced_topics.md +++ /dev/null @@ -1,3 +0,0 @@ -# Part VI - Advanced Topics - -The advanced topics section covers file i/o, data sharing, and debugging techniques \ No newline at end of file diff --git a/part_vii_-_appendix.md b/part_vii_-_appendix.md deleted file mode 100644 index 6bac8da68..000000000 --- a/part_vii_-_appendix.md +++ /dev/null @@ -1,3 +0,0 @@ -# Part VII - Appendix - -Various additional documents \ No newline at end of file diff --git a/return_statement_syntax.md b/return_statement_syntax.md deleted file mode 100644 index 84466ffa3..000000000 --- a/return_statement_syntax.md +++ /dev/null @@ -1,22 +0,0 @@ -# Return Statement Syntax - -The return statment is the last statement in an OpenTX Lua script. It defines the input/output table values and functions used to run the script. - -Parameters *init*, *input* and *output* are optional. If a script doesn't use them, they can be omitted from return statement. - -Example without *init* and *output*: - -```lua -local inputs = { { "Aileron", SOURCE }, { "Ail. ratio", VALUE, -100, 100, 0 } } - -local function run_func(ail, ratio) - -- do some stuff - if (ail > 50) and ( ratio < 40) then - playFile("foo.wav") - end -end - --- script that only uses input and run -return { run=run_func, input=inputs } -``` -  \ No newline at end of file diff --git a/run_function_syntax.md b/run_function_syntax.md deleted file mode 100644 index d9fbbfcab..000000000 --- a/run_function_syntax.md +++ /dev/null @@ -1,44 +0,0 @@ -# Run Function Syntax - -The run function is the function that is periodically called for the lifetime of script execution. Syntax of the run function is different between [mix scripts](mix.md) and [telemetry scripts](telemetry.md). - - ---- - - -#### Run Function for Mix Scripts -```lua -local function ([first input, [second input], …]) - - -- if mix has no return values - return - - -- if mix has two return values - return value1, value2 - -end -``` -* #####Input parameters: -zero or more input values, their names are arbitrary, their meaning and order is defined by the input table. (see [Input Table Syntax](input_table_syntax.md)) - -* #####Return values: - - none - if output table is empty (i.e. script has no output) - values
\- or \- - - comma separated list of output values, their order and meaning is defined by the output table. (see [Output Table Syntax](output_table_syntax.md)) - - - ---- - - -####Run Function for Telemetry Scripts -```lua -local function (key-event) - return 0 -- values other than zero will halt the script -end -``` - -* #####Input parameters: -The *key-event* parameter indicates which transmitter button has been pressed (see [Key Events](key_events.md)) -* #####Return values: -A non-zero return value will halt the script diff --git a/part_i_-_script_type_overview/README.md b/script_type_overview/README.md similarity index 100% rename from part_i_-_script_type_overview/README.md rename to script_type_overview/README.md diff --git a/part_i_-_script_type_overview/function_scripts.md b/script_type_overview/function_scripts.md similarity index 100% rename from part_i_-_script_type_overview/function_scripts.md rename to script_type_overview/function_scripts.md diff --git a/script_type_overview/mix.md b/script_type_overview/mix.md new file mode 100644 index 000000000..0f51cdc72 --- /dev/null +++ b/script_type_overview/mix.md @@ -0,0 +1,113 @@ +# Custom (Mixer) Scripts + +_**WARNING -**_ **Do not use Lua Custom scripts for controlling any aspect of your model that could cause a crash if the script stops executing!** + +## Overview + +Each model can have several custom scripts associated with it, and these scripts are run periodically. They behave similarly to standard OpenTX mixers, but at the same time they provide a much more flexible and powerful tool. Custom scripts take one or more values as inputs, do some processing in Lua code, and output one or more values. + +**Please note:** the firmware must be compiled with the option `LUA_MIXER=Y` for Custom scripts to be available. + +**Please note:** the scripts should be as short as possible, to avoid delays. It is also important to keep in mind that other loaded Telemetry and Function scripts can add to the response time, or worse: hang the system! + +### Typical uses + +* replacement for complex mixes that are _not critical_ to model function +* complex processing of inputs and reaction to their current state and/or their history +* filtering of telemetry values + +### Limitations + +* cannot update LCD screen or perform user input. +* should not exceed allowed run-time/ number of instructions. +* custom scripts are run with less priority than built-in mixes. Their execution period is around 30ms and is not guaranteed! +* can be disabled/killed anytime due to logic errors in script, not enough free memory, etc...) + +## Lifetime + +* Custom scripts are loaded from SD card when model is selected +* `init` \_\_function is called first +* `run` function is called periodically (about 30 times per second) +* the script is killed (stopped and disabled) if it misbehaves (e.g. run-time error or low memory) +* all Custom scripts are stopped while a One-Time script is running (see Lua One-time scripts) + +### Disabled script + +If the script output is used as a `mixer source` , and the script is killed for whatever reason, then _the whole mixer line is disabled_ ! This can be used for example to provide a fallback in case Lua Custom script is killed. + +Example where Lua mix script is used to drive ailerons in some clever way, but control falls back to the standard aileron mix if script is killed. Second mixer line replaces the first one when the script is alive: + +``` +CH1 [I4]Ail Weight(+100%) + := LUA4b Weight(+100%) +``` + +## File Location + +Place them on SD card in folder /SCRIPTS/MIXES/. File name length (without extension) **must be 6 characters or less** (this limit was 8 characters in OpenTX 2.1). + +## Interface + +Every script must include a `return` statement at the end, defining its interface to EdgeTX. This statement returns a table with the following fields: + +* `input` table (optional) +* `output` table (optional) +* `init` function (optional) +* `run` function + +### Example + +```lua +local input = + { + { "Strength", SOURCE}, -- user selects source (typically slider or knob) + { "Interval", VALUE, 0, 100, 0 } -- interval value, default = 0. + } + +local output = { "Val1", "Val2" } + +local function init() + -- Called once when the script is loaded +end + +local function run(Strength, Interval) -- Must match input table + local v1, v2 + -- Called periodically + return v1, v2 -- Must match output table +end + +return { input=input, output=output, run=run, init=init } +``` + +#### Input table + +The input table defines what values are available as input(s) to custom scripts. There are two forms of input table entries. + +``` +{ "", SOURCE } +``` + +SOURCE inputs provide the current value of a selected OpenTX variable. The source must be selected by the user when the script is configured. Source can be any value that EdgeTX knows about (inputs, channels, telemetry values, switches, custom functions etc.).\ +**Note:** the typical input range is -1024 thru +1024. Simply divide the input value by 10.24 to convert to a percentage from -100% to +100%. + +``` +{ "", VALUE, , , } +``` + +VALUE inputs provide a constant value that is set by the user when the script is configured. + +* _name_ - maximum length of 8 characters +* _min_ - minimum value of -128 +* _max_ - maximum value of 127 +* _default_ - must be within the valid range specified +* **Maximum of 6 inputs per script** (was 8 in 2.1) + +#### Output table + +The output table defines only name(s), as the actual values are returned by the script's run function. + +```lua +{ "", "" } +``` + +**Note:** the above names are only visible as source values on the radio screen when the script is running. If the model is edited in Companion, then the values show as `LUA1a` and `LUA1b` etc. diff --git a/script_type_overview/one-time_scripts.md b/script_type_overview/one-time_scripts.md new file mode 100644 index 000000000..496df205b --- /dev/null +++ b/script_type_overview/one-time_scripts.md @@ -0,0 +1,56 @@ +# One-Time Scripts + +_**WARNING -**_ **Running a One-Time script will suspend execution of all other currently loaded Lua scripts (Custom, Telemetry, and Functions)** + +## Overview + +One-Time scripts start when called upon by a specific radio function or when the user selects them from a contextual menu. They do their task and are then terminated and unloaded. Please note that all persistent scripts are halted during the execution of One-Time scripts. They are automatically restarted once the One-Time script is finished. This is done to provide enough system resources to execute the One-Time script. + +## Lifetime + +Script is executed when user selects Execute on a script file from SD card browser screen, or opens a Lua Tool, or creates a new model with a Wizard script. + +The script executes until: + +* it returns value different from 0 +* is forcefully closed by user by long press of EXIT key +* is forcefully closed by system if it misbehaves (e.g. run-time error or low + + memory) + +## File Location + +General One-Time scripts can be placed anywhere on SD card, however, the folder /SCRIPTS/ is recommended. + +Tool scripts must be stored in /SCRIPTS/TOOLS. + +Wizard scripts must be stored in the same subfolder of /TEMPLATES/ with the same "first name" as the template file using it. Some Wizard scripts are just small scripts that load one of the common scripts located in /SCRIPTS/WIZARD/. + +## **Interface** + +Every script must include a `return` statement at the end, defining its interface to EdgeTX. This statement returns a table with the following fields: + +* `init` function (optional) +* `run` function + +### Example + +```lua +local function init() + -- init is called once when model is loaded +end + +local function run(event, touchState) + -- run is called periodically only when screen is visible + -- A non-zero return value will halt the script + return x +end + +return { run=run, init=init } +``` + +### Notes: + +* The `event` parameter indicates which transmitter key has been pressed (see [Key Events](../part\_iii\_-\_opentx\_lua\_api\_reference/constants/key\_events.md)). +* The `touchState` value is only present when `event` is a touch event (see [Touch State Events](../part\_iii\_-\_opentx\_lua\_api\_reference/constants/touch-event-constants.md)). +* A non-zero return value from `run` will halt the script. If the return value is a text string with the file path to a new Lua script, then the new script will be loaded and run. diff --git a/part_i_-_script_type_overview/telemetry.md b/script_type_overview/telemetry.md similarity index 100% rename from part_i_-_script_type_overview/telemetry.md rename to script_type_overview/telemetry.md diff --git a/part_i_-_script_type_overview/widget_scripts.md b/script_type_overview/widget_scripts.md similarity index 100% rename from part_i_-_script_type_overview/widget_scripts.md rename to script_type_overview/widget_scripts.md diff --git a/telemetry.md b/telemetry.md deleted file mode 100644 index dedd05c30..000000000 --- a/telemetry.md +++ /dev/null @@ -1,56 +0,0 @@ -##Telemetry Scripts - -## General description - -Telemetry scripts are used for building customized screens. Each model can have up to three active scripts as configured on the model's telemetry configuration page. The same script can be assigned to multiple models. - -## File Location - -Scripts are located on the SD card in the folder /SCRIPTS/TELEMETRY/<*name*>.lua. File name length (without extension) **must be 6 characters or less** (this limit was 8 characters in OpenTX 2.1). - -## Lifetime of telemetry script - -Telemetry scripts are started when the model is loaded. - -* script init function is called -* script background function is periodically called when custom telemetry screen is **not visible**. *Notice*: - * In OpenTX 2.0 this function is **not called** when the custom telemetry screen is visible. - * Starting from OpenTX 2.1 this function is **always called** no matter if the custom screen is visible or not. -* script run function is periodically called when custom telemetry screen is **visible** -* script is stopped and disabled if it misbehaves (too long runtime, error in code, low memory) -* all telemetry scripts are stopped while one-time script is running (see Lua One-time scripts) - -## Script interface definition - -Every script must include a return statement at the end, that defines its interface to the rest of OpenTX code. This statement defines: -* script **init** function *(optional)* -* script **background** function -* script **run** function - -### Example (interface only): - -```lua -local function init_func() - -- init_func is called once when model is loaded -end - -local function bg_func() - -- bg_func is called periodically (always, the screen visibility does not matter) -end - -local function run_func(event) - -- run_func is called periodically only when screen is visible -end - -return { run=run_func, background=bg_func, init=init_func } -``` - -### Notes: - -* `init_func()` function is called once when script is loaded and begins execution. - -* `bg_func()` is called periodically, the screen visibility does not matter. - -* `run_func(event)` function is called periodically when custom telemetry screen is visible. The `event` parameter indicates which transmitter button has been pressed (see [Key Events](key_events.md)). This is the time when the script has full control of the LCD screen and keys and should draw something on the screen. - - diff --git a/theme_scripts.md b/theme_scripts.md deleted file mode 100644 index d6b7cf3f2..000000000 --- a/theme_scripts.md +++ /dev/null @@ -1,3 +0,0 @@ -# Theme Scripts - -TODO: describe how theme scripts work on Horus type transmitters. \ No newline at end of file diff --git a/widget_scripts.md b/widget_scripts.md deleted file mode 100644 index 61d074e8f..000000000 --- a/widget_scripts.md +++ /dev/null @@ -1,110 +0,0 @@ - -# Widgets (HORUS ONLY) Scripts - -#### General description - -Widgets are small scripts that show some info in a 'zone' in one of the model specific user defined (telemetry) screens. You can define those screens within the telemetry menu on the HORUS. - -Each model can have up to five custom screens, with up to 8 widgets per screen, depending on their size and layout. Each instance of a widget has his own custom settings. - -#### File Location - -Widgets are located on the SD card, each in their specific folder /WIDGETS/<*name*>/main.lua (*name* must be in 8 characters or less). - -#### Lifetime of widgets - -Widgets need to be registered through the telemetry setup menu. - -* widget create function is called -* widget update function is called upon registration and at change of settings in the telemetry setup menu. -* widget background function is periodically called when custom telemetry screen is **not visible**. *Notice*: - * This is different from the way telemetry scripts are handled -* widget refresh function is periodically called when custom telemetry screen is **visible** -* widget is stopped and disabled if it misbehaves (too long runtime, error in code, low memory) -* all widgets are stopped while one-time script is running (see Lua One-time scripts) - -Once registered, widgets are started when the model is loaded. - -#### Script interface definition - -Every widget must include a return statement at the end, that defines its interface to the rest of OpenTX code. This statement defines: -* widget **name** (*name* must be a string of 10 characters or less) -* widget **options** array (maximum five options are allowed, 10 character names max, no spaces!) -* widget **create** function -* widget **update** function -* script **background** function -* script **refresh** function - -##### Example (draws a moving counter that counts only when not visible): - -```lua -local defaultOptions = { - { "ControlX", SOURCE, 1 }, - { "ScrollZ", BOOL, 1 }, -- BOOL is actually not a boolean, but toggles between 0 and 1 - { "StepZ", VALUE, 1, 0, 10}, - { "COLOR", COLOR, RED }, -} - -local function createWidget(zone, options) - lcd.setColor( CUSTOM_COLOR, options.COLOR ) - -- the CUSTOM_COLOR is foreseen to have one color that is not radio template related, but it can be used by other widgets as well! - local someVariable = 0 - local anotherVariable = {xWidget=0, yWidget = 0} - return { zone=zone, options=options , someVariable = someVariable, anotherVariable=anotherVariable } -end - -local function updateWidget(widgetToUpdate, newOptions) - widgetToUpdate.options = newOptions - lcd.setColor( CUSTOM_COLOR, widgetToUpdate.options.COLOR ) - -- the CUSTOM_COLOR is foreseen to have one color that is not radio template related, but it can be used by other widgets as well! -end - -local function backgroundProcessWidget(widgetToProcessInBackground) - local function process(...) - return ... + 1 - end - widgetToProcessInBackground.someVariable = process (widgetToProcessInBackground.someVariable) -end - -local function refreshWidget(widgetToRefresh) - local counterLength = 50 - local counterHeight = 30 - - --backgroundProcessWidget(widgetToRefresh) - --background is not called automatically in display mode, so do it here if you need it. - - local function anotherProcess(parameter,step,maxParameter) - return (parameter + step) % maxParameter - end - - widgetToRefresh.anotherVariable.xWidget - = anotherProcess ( widgetToRefresh.anotherVariable.xWidget - ,getValue(widgetToRefresh.options.ControlX)/10.24/20 - ,widgetToRefresh.zone.w-counterLength) - - widgetToRefresh.anotherVariable.yWidget - = anotherProcess ( widgetToRefresh.anotherVariable.yWidget - ,(widgetToRefresh.options.ScrollZ==1) and widgetToRefresh.options.StepZ or 0 - ,widgetToRefresh.zone.h-counterHeight) - - lcd.drawNumber(widgetToRefresh.anotherVariable.xWidget + widgetToRefresh.zone.x - , widgetToRefresh.anotherVariable.yWidget + widgetToRefresh.zone.y - , widgetToRefresh.someVariable - , LEFT + DBLSIZE + CUSTOM_COLOR); -end - -return { name="MovingCntr", options=defaultOptions, create=createWidget, update=updateWidget - , refresh=refreshWidget, background=backgroundProcessWidget } -``` - -#### Notes: - -* *options* are only passed through to OpenTX to be used on widget creation. Don't change them during operation, this has no effect. -* *create()* function is called once when widget is loaded and begins execution. -* *update()* function is called once when widget is loaded and begins execution. -* *background()* is called periodically when custom telemetry screen containing widget is not visible. -* *refresh()* function is called periodically when custom telemetry screen containing wodget is visible. - -* in the example given, you can see that no global variables or functions are needed to operate the widget. -* variables that are used throughout the widget, can best be declared *inside* the create function as local variables -* those local variablkes can then be passed through to the other functions as an element of the widget array that is returned diff --git a/wizard.md b/wizard.md deleted file mode 100644 index 04301eaeb..000000000 --- a/wizard.md +++ /dev/null @@ -1,5 +0,0 @@ -# Wizard - -
-TODO: Need to determine status of wizard in 2.2 -
\ No newline at end of file