VK3KYY wrote: ↑Fri Feb 21, 2020 11:26 pm
Sometimes the beep volume gets set back to 3dB
It's not that it doesn't get saved, but it gets reset to 3dB as soon as the menu option displays. Like change it to -3dB or something and exit the menu. It will get saved. but go back to the menu to change something else and as soon as that option is displayed it will reset to default. It's like whatever draws the menu option is fetching the value from the wrong place.
So It's like this executes:
Code: Select all
case OPTIONS_MENU_BEEP_VOLUME:// Beep volume reduction
snprintf(buf, bufferLen, "%s:%ddB", currentLanguage->beep_volume, (2 - nonVolatileSettings.beepVolumeDivider) * 3);
soundBeepVolumeDivider = nonVolatileSettings.beepVolumeDivider;
break;
And something is up with that soundBeepVolumeDivider = nonVolatileSettings.beepVolumeDivider; like nonVolatileSettings.beepVolumeDivider no longer contains the correct value or something, and soundBeepVolumeDivider gets reset as soon as it displays.
Hmm... I just tinkered with it again and maybe it was only happening because I hadn't turned the power off yet so the settings had not gotten saved yet. perhaps the fix is to change (2 - nonVolatileSettings.beepVolumeDivider) * 3 to (2 - soundBeepVolumeDivider) * 3 and save/update the nonVolatileSettings elsewhere?
Not sure of the right solution since I'm not familiar enough with the code.....
Anyway it's not doing it anymore after I power cycled, though I'd sware I had power cycled it at least once before.
Edit:
Ok maybe I figured out what I was doing wrong. Maybe I hit the red key not the green key and this happened:
Code: Select all
else if (KEYCHECK_SHORTUP(ev->keys,KEY_RED))
{
// Restore original settings.
memcpy(&nonVolatileSettings, &originalNonVolatileSettings, sizeof(settingsStruct_t));
setMicGainDMR(nonVolatileSettings.micGainDMR);
menuSystemPopPreviousMenu();
return;
}
So the settings got restored to their previous values, but soundBeepVolumeDivider was left the same. I think maybe the only thing missing is to reset soundBeepVolumeDivider = nonVolatileSettings.beepVolumeDivider after the memcpy()