Skip to content

Commit

Permalink
change power work but config.commit crashes?
Browse files Browse the repository at this point in the history
  • Loading branch information
StonedDawg committed Feb 2, 2022
1 parent 9a51be3 commit 54fd64c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/CONFIG/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ RxConfig::SetModelId(uint8_t modelId)
void
RxConfig::SetPower(uint8_t power)
{
if (GetPower() != power)
if (m_config.power != power)
{
m_config.power = power;
m_modified = true;
Expand All @@ -534,7 +534,7 @@ RxConfig::SetDefaults()
SetIsBound(false);
SetPowerOnCounter(0);
SetModelId(0xFF);
SetPower(POWERMGNT::getDefaultPower());
SetPower(MaxPower);
#if defined(GPIO_PIN_ANTENNA_SELECT) && defined(USE_DIVERSITY)
SetAntennaMode(2); //2 is diversity
#else
Expand Down
5 changes: 3 additions & 2 deletions src/lib/LUA/rx_devLUA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ static void registerLuaParameters()

registerLUAParameter(&luaTlmPower, [](uint8_t id, uint8_t arg){
config.SetPower(arg);
//config.Commit();
if(arg == 0){
POWERMGNT.setPower(MinPower);
} else {
POWERMGNT.setPower(MaxPower);
}
config.Commit();
devicesTriggerEvent();
devicesTriggerEvent();
});

#if defined(PLATFORM_ESP32) || defined(PLATFORM_ESP8266)
Expand All @@ -99,6 +99,7 @@ static int event()
#if defined(GPIO_PIN_ANTENNA_SELECT) && defined(USE_DIVERSITY)
setLuaTextSelectionValue(&luaAntennaMode, config.GetAntennaMode());
#endif
setLuaTextSelectionValue(&luaTlmPower, config.GetPower());
return DURATION_IMMEDIATELY;
}

Expand Down

0 comments on commit 54fd64c

Please sign in to comment.