DeviationTX / deviation

Custom firmware for RC Transmitters
http://www.deviationtx.com
GNU General Public License v3.0
251 stars 155 forks source link

Save proper external voice IDs in model files #1000

Open somewhatlurker opened 4 years ago

somewhatlurker commented 4 years ago

This is one possible fix for #999.

If merged, model files will now save the alert IDs from voice.ini/mp3 file names for custom alerts, instead of the internal index in voice_map.

To ensure old models are loaded correctly, an "mp3-" prefix is added to alert values saved in the new way (all models will be saved with new IDs).
This does have a side effect of making new model files incompatible with old firmware though. Alternatives would be to either not use a prefix and make it possible for old models to load with incorrect IDs when used with a poorly formatted voice.ini (probably not desirable) or use a prefix/suffix that atoi won't error out on (eg, "+" prefix), although that would make the file less readable without writing an explanation comment.

TheRealMoeder commented 4 years ago

From a quick glance this looks good. I actually like the idea of using the mp3-prefix.

This could also be the way to enhance functionality by adding a "beep" prefix to set certain alerts to the beeps defined in sound.ini and making that somehow configurable in the voice config menu. Maybe also an option to integrate vibration setting per alert? Or a combination of them? We at least should be discussing things so we're not losing backwards compatibility in the future.