String in LUA widget options

openTx has introduced a range of new features, ideas and bling. It is fast becoming the firmware of choice for many users. openTx will run on ALL current hardware platforms, including the gruvin9x and sky9x boards. Work has already started to support the new FrSky X9D radio!
Post Reply
azaz44
Posts: 16
Joined: Mon Oct 01, 2018 8:48 am
Country: -

String in LUA widget options

Post by azaz44 »

Is it possible to have a parameter of type string for a widget in LUA?

It seems there is no proper constant. By digging the source code I figured out this hack to force a string:

Code: Select all

local defaultOptions = {
  { "Title", BOOL + 1, "" },    -- << the hack is here
  { "Source", SOURCE, 1 },
  { "Color", COLOR, WHITE },
  { "Shadow", BOOL, 0 }, -- BOOL is actually not a boolean, but toggles between 0 and 1
}
and this makes OpenTX show proper editor for strings:
Capture.PNG
Capture.PNG (7.65 KiB) Viewed 2305 times

But the widget gets some weird number instead. It looks like number is the only type which can come from options.

Possible? If not, could this be done? Shell I add a ticket?

What I wanted is to make improved "Value" widget where you could select a title instead of using short 4-chars telemetry name.

User avatar
3djc
Posts: 77
Joined: Mon Feb 22, 2016 7:15 am
Country: -

Re: String in LUA widget options

Post by 3djc »

Fix for that incoming
Post Reply

Return to “openTx”