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.setColorto 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.RGBreturns 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.getColor, then your code should work the same way in EdgeTX as in OpenTX.
lcd.RGBwhen the screen is not available for drawing, so it can only be called successfully from the
refreshfunction in widgets and from the
runfunction in One-Time scripts. Therefore, some existing widget scripts set up colors with hard coded constants instead of calling
lcd.RGBduring initialization, and this is not going to work with EdgeTX, because of the different binary format.
lcd.RGBto 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.RGBvalues 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
refreshfunction) then it creates the 16-bit RGB565 value that OpenTX wants.