f4exb / sdrangel

SDR Rx/Tx software for Airspy, Airspy HF+, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay and FunCube
GNU General Public License v3.0
2.91k stars 441 forks source link

Presets appear to be saved in alphabetical order, rather than order in which they are created #783

Closed srcejon closed 3 years ago

srcejon commented 3 years ago

It seems presets have the channels saved in alphabetical order, rather than the order in which they are created. For example:

While generally not a problem - where it can be a little confusing is if you are controlling the channels via the API, as channel indexes will change.

Should this behaviour be changed? Or is it just something that needs to considered when using the API?

f4exb commented 3 years ago

Maybe I need to double check but if I remember right in the presets channels are sorted by frequency shift then by alphabetical order of their identifers (i.e. AMDemod comes before NFMDemod) if frequencies are equal. When you create new channels in the session they are just appended. When importing channels from a preset there is the possibility to have prior knowledge of the order or make a GET query to list the channels and their respective indexes.

When retrieving channels from a preset I find it more natural to have them ordered this way than in the order they were created which is subjective somehow.

srcejon commented 3 years ago

Ok - I'll update my code to deal with it. Thanks.