Properly persist bluetooth mode changes

custom
jacqueline 1 year ago
parent 0f03efe868
commit e073309907
  1. 1
      src/audio/audio_fsm.cpp
  2. 7
      src/ui/ui_fsm.cpp

@ -113,7 +113,6 @@ void AudioState::react(const SetVolumeBalance& ev) {
}
void AudioState::react(const OutputModeChanged& ev) {
// TODO: handle SetInUse
ESP_LOGI(kTag, "output mode changed");
auto new_mode = sServices->nvs().OutputMode();
sOutput->SetMode(IAudioOutput::Modes::kOff);

@ -85,11 +85,16 @@ lua::Property UiState::sBluetoothEnabled{
if (std::get<bool>(val)) {
sServices->bluetooth().Enable();
sServices->bluetooth().SetDeviceDiscovery(true);
sServices->nvs().OutputMode(drivers::NvsStorage::Output::kBluetooth);
} else {
sServices->bluetooth().Disable();
sServices->nvs().OutputMode(drivers::NvsStorage::Output::kHeadphones);
}
events::Audio().Dispatch(audio::OutputModeChanged{});
return true;
}};
}
};
lua::Property UiState::sBluetoothConnected{false};
lua::Property UiState::sBluetoothPairedDevice{
std::monostate{}, [](const lua::LuaValue& val) {

Loading…
Cancel
Save