INVERS + INVERS = VCENTER
. If you want to add a flag to a value where it may already be set, then use flags = bit32.bor(flags, INVERS)
.lcd.setColor
. The advantage of this system is that the color changes everywhere that this indexed color is used, and this is how different color themes are created. Notice that changing the theme colors affects the entire user interface of your radio!!lcd.setColor
must have an indexed color as its first argument, because this will be the index of the color in the table being changed. Giving another color, e.g. ORANGE, as the first argument will result in nothing.lcd.setColor(0, color)
.lcd.getColor
always returns a RGB color. This can be used to "save" an indexed color before you change it.lcd.setColor
to change e.g. CUSTOM_COLOR, and then call the LCD drawing function with that indexed color. In EdgeTX, you can use either type of color for drawing functions, so you are no longer forced to constantly call lcd.setColor
. You can also store any color in local variables, and then use these when drawing, thus effectively creating your own color theme.lcd.RGB
returns a 16 bit RGB565 value, but in EdgeTX it returns a 32 bit flags value with the 16 bit RGB565 value in the upper half (bits 17-32). Therefore, colors in EdgeTX are not binary compatible with colors in OpenTX. But if you use the functions lcd.RGB
, lcd.setColor
, and lcd.getColor
, then your code should work the same way in EdgeTX as in OpenTX.lcd.RGB
when the screen is not available for drawing, so it can only be called successfully from the refresh
function in widgets and from the run
function in One-Time scripts. Therefore, some existing widget scripts set up colors with hard coded constants instead of calling lcd.RGB
during initialization, and this is not going to work with EdgeTX, because of the different binary format.lcd.RGB
to work also during widget script initialization, and hopefully, it will be merged into OpenTX 2.3.15. If that happens, then the obvious way to solve the problem is to use lcd.RGB
values instead of hard coded color constants. But in the meantime, the following RGB function can be used for setting up colors in a way that works for both EdgeTX and OpenTX.lcd.RGB
, and if it gets a nil value (because we are running a widget script under OpenTX, and it is not called from the refresh
function) then it creates the 16-bit RGB565 value that OpenTX wants.