Do not reload bitmps during theme update, unless reload argument is true (#661)
* Do not reload bitmps during theme update, unless reload argument is true Trying to optimize speed for theme color changes. FlySky is not optimized yet. * Do not update theme from Lua lcd.setColor(CUSTOM_COLOR, x) Some widgets like e.g. Timer2 constantly change CUSTOM_COLOR, and this seems to slow down things * Lua function lcd.setColor() only updates if color is changed To avoid that scripts calling lcd.setColor() repeatedly trash performance
This commit is contained in:
@@ -726,11 +726,12 @@ Please notice that changing theme colors affects not only other Lua widgets, but
|
||||
static int luaLcdSetColor(lua_State *L)
|
||||
{
|
||||
unsigned int index = COLOR_VAL(luaL_checkunsigned(L, 1));
|
||||
LcdFlags flags = luaL_checkunsigned(L, 2);
|
||||
uint16_t color = COLOR_VAL(flagsRGB(luaL_checkunsigned(L, 2)));
|
||||
|
||||
if (index < LCD_COLOR_COUNT) {
|
||||
lcdColorTable[index] = COLOR_VAL(flagsRGB(flags));
|
||||
OpenTxTheme::instance()->update();
|
||||
if (index < LCD_COLOR_COUNT && lcdColorTable[index] != color) {
|
||||
lcdColorTable[index] = color;
|
||||
if (index != CUSTOM_COLOR_INDEX)
|
||||
OpenTxTheme::instance()->update(false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user