From 0ff73ccafad063fcc65ea64e7dca35e7f00011a1 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Fri, 1 Sep 2023 18:01:47 +1000 Subject: [PATCH] feat(color): enable LUA_MIXER, hidden by default (#3973) --- radio/src/CMakeLists.txt | 9 +++++---- radio/src/model_init.cpp | 5 +---- radio/src/opentx.cpp | 3 +++ radio/src/storage/sdcard_common.cpp | 4 ++++ radio/src/targets/horus/CMakeLists.txt | 1 + radio/src/targets/nv14/CMakeLists.txt | 1 + 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 2a789937e44..4f3c08d7cdb 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -36,7 +36,6 @@ if(SDL2_FOUND) option(SIMU_AUDIO "Enable simulator audio." ON) endif() option(LUA "Enable LUA support" ON) -option(LUA_MIXER "Enable LUA mixer/model scripts support" OFF) option(SIMU_DISKIO "Enable disk IO simulation in simulator. Simulator will use FatFs module and simulated IO layer that uses \"./sdcard.image\" file as image of SD card. This file must contain whole SD card from first to last sector" OFF) option(SIMU_LUA_COMPILER "Pre-compile and save Lua scripts in simulator." ON) option(FAS_PROTOTYPE "Support of old FAS prototypes (different resistors)" OFF) @@ -188,14 +187,16 @@ if(RTC_BACKUP_RAM) add_custom_target(datacopy DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/datacopy.cpp) endif() -if(LUA) - include(lua/CMakeLists.txt) -endif() +option(LUA_MIXER "Enable LUA mixer/model scripts support" OFF) if (LUA_MIXER AND NOT LUA) message(FATAL_ERROR "LUA_MIXER requires LUA!!") endif() +if(LUA) + include(lua/CMakeLists.txt) +endif() + if(HELI) add_definitions(-DHELI) endif() diff --git a/radio/src/model_init.cpp b/radio/src/model_init.cpp index 8eaabb8f024..7f61d2c4bd9 100644 --- a/radio/src/model_init.cpp +++ b/radio/src/model_init.cpp @@ -137,11 +137,8 @@ void applyDefaultTemplate() g_model.switchWarningState |= (1 << (3*i)); } #endif - - // TODO: what about switch warnings in non-color LCD radios? } - void setModelDefaults(uint8_t id) { memset(&g_model, 0, sizeof(g_model)); @@ -155,7 +152,7 @@ void setModelDefaults(uint8_t id) #endif strAppendUnsigned(strAppend(g_model.header.name, STR_MODEL), id, 2); -#if defined(LUA) && defined(PCBTARANIS) // Horus uses menuModelWizard() for wizard +#if defined(LUA) && defined(PCBTARANIS) if (isFileAvailable(WIZARD_PATH "/" WIZARD_NAME)) { f_chdir(WIZARD_PATH); luaExec(WIZARD_NAME); diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 329dd405601..304cdb34791 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -439,6 +439,9 @@ void generalDefault() g_eeGeneral.audioMuteEnable = 1; #endif + // disable Custom Script + g_eeGeneral.modelCustomScriptsDisabled = true; + g_eeGeneral.chkSum = 0xFFFF; } diff --git a/radio/src/storage/sdcard_common.cpp b/radio/src/storage/sdcard_common.cpp index 6586d6d8af0..a23fca2912c 100644 --- a/radio/src/storage/sdcard_common.cpp +++ b/radio/src/storage/sdcard_common.cpp @@ -180,6 +180,10 @@ void storageReadAll() modelslist.clear(); #endif + // Some radio defaults overriden by config loading: + // - screens disabled by default: + g_eeGeneral.modelCustomScriptsDisabled = true; + if (loadRadioSettings() != nullptr) { storageEraseAll(true); } diff --git a/radio/src/targets/horus/CMakeLists.txt b/radio/src/targets/horus/CMakeLists.txt index 52ffddd9078..3738f839f33 100644 --- a/radio/src/targets/horus/CMakeLists.txt +++ b/radio/src/targets/horus/CMakeLists.txt @@ -7,6 +7,7 @@ option(AFHDS3 "AFHDS3 TX Module" ON) option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" ON) option(GHOST "Ghost TX Module" ON) option(SPACEMOUSE "Support for SpaceMouse" OFF) +option(LUA_MIXER "Enable LUA mixer/model scripts support" ON) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F4) diff --git a/radio/src/targets/nv14/CMakeLists.txt b/radio/src/targets/nv14/CMakeLists.txt index 54e62e950df..182272703ba 100644 --- a/radio/src/targets/nv14/CMakeLists.txt +++ b/radio/src/targets/nv14/CMakeLists.txt @@ -6,6 +6,7 @@ option(AFHDS2 "Support for AFHDS2" ON) option(GHOST "Ghost TX Module" ON) option(PXX1 "PXX1 protocol support" ON) option(PXX2 "PXX2 protocol support" OFF) +option(LUA_MIXER "Enable LUA mixer/model scripts support" ON) set(PWR_BUTTON "PRESS" CACHE STRING "Pwr button type (PRESS/SWITCH)") set(CPU_TYPE STM32F4)