Skip to content

Commit

Permalink
Merge pull request #267 from moshe-braner/audio_restart
Browse files Browse the repository at this point in the history
re-do audio::setup when some settings are changed
  • Loading branch information
iltis42 authored Dec 11, 2023
2 parents 81c0dce + 4655416 commit 749bd26
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions main/SetupMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@ int vario_setup(SetupMenuValFloat * p)
return 0;
}

int audio_setup(SetupMenuValFloat * p)
int audio_setup_s(SetupMenuSelect * p)
{
Audio::setup();
return 0;
}

int audio_setup_f(SetupMenuValFloat * p)
{
Audio::setup();
return 0;
Expand Down Expand Up @@ -793,7 +799,7 @@ void SetupMenu::vario_menu_create_ec( MenuEntry *top ){
void SetupMenu::vario_menu_create( MenuEntry *vae ){
ESP_LOGI(FNAME,"SetupMenu::vario_menu_create( %p )", vae );

SetupMenuValFloat * vga = new SetupMenuValFloat( PROGMEM"Range", "", 1.0, 30.0, 1, 0, true, &range );
SetupMenuValFloat * vga = new SetupMenuValFloat( PROGMEM"Range", "", 1.0, 30.0, 1, audio_setup_f, true, &range );
vga->setHelp(PROGMEM"Upper and lower value for Vario graphic display region");
vga->setPrecision( 0 );
vae->addEntry( vga );
Expand Down Expand Up @@ -855,21 +861,21 @@ void SetupMenu::vario_menu_create( MenuEntry *vae ){
}

void SetupMenu::audio_menu_create_tonestyles( MenuEntry *top ){
SetupMenuValFloat * cf = new SetupMenuValFloat( PROGMEM"CenterFreq", "Hz", 200.0, 2000.0, 10.0, 0, false, &center_freq );
SetupMenuValFloat * cf = new SetupMenuValFloat( PROGMEM"CenterFreq", "Hz", 200.0, 2000.0, 10.0, audio_setup_f, false, &center_freq );
cf->setHelp(PROGMEM"Center frequency for Audio at zero Vario or zero S2F delta");
top->addEntry( cf );

SetupMenuValFloat * oc = new SetupMenuValFloat( "Octaves", "fold", 1.2, 4, 0.05, audio_setup, false, &tone_var, RST_ON_EXIT );
SetupMenuValFloat * oc = new SetupMenuValFloat( "Octaves", "fold", 1.2, 4, 0.05, audio_setup_f, false, &tone_var );
oc->setHelp(PROGMEM"Maximum tone frequency variation");
top->addEntry( oc );

SetupMenuSelect * dt = new SetupMenuSelect( PROGMEM"Dual Tone", RST_ON_EXIT, 0 , true, &dual_tone );
SetupMenuSelect * dt = new SetupMenuSelect( PROGMEM"Dual Tone", RST_NONE, audio_setup_s, true, &dual_tone );
dt->setHelp(PROGMEM"Select dual tone modue aka ilec sound, (di/da/di) or single tone (di/di/di) mode (reboots)");
dt->addEntry( PROGMEM"Disable"); // 0
dt->addEntry( PROGMEM"Enable"); // 1
top->addEntry( dt );

SetupMenuValFloat * htv = new SetupMenuValFloat( PROGMEM"Dual Tone Pich", "%", 0, 50, 1.0, 0, false, &high_tone_var, RST_ON_EXIT );
SetupMenuValFloat * htv = new SetupMenuValFloat( PROGMEM"Dual Tone Pich", "%", 0, 50, 1.0, audio_setup_f, false, &high_tone_var );
htv->setHelp(PROGMEM"Tone variation in Dual Tone mode, percent of frequency pitch up for second tone (reboots)");
top->addEntry( htv );

Expand Down Expand Up @@ -947,7 +953,7 @@ void SetupMenu::audio_menu_create( MenuEntry *audio ){
audios->addCreator(audio_menu_create_tonestyles);

update_rentry(0);
audio_range_sm = new SetupMenuSelect( PROGMEM"Range", RST_NONE, 0 , true, &audio_range );
audio_range_sm = new SetupMenuSelect( PROGMEM"Range", RST_NONE, audio_setup_s, true, &audio_range );
audio_range_sm->addEntry( rentry0 );
audio_range_sm->addEntry( rentry1 );
audio_range_sm->addEntry( rentry2 );
Expand Down

0 comments on commit 749bd26

Please sign in to comment.