Open richard9999999999 opened 2 months ago
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step) { if(step == 833) { uint32_t base = freq/2500*2500;
int chno = (freq - base) / 700; // convert entered aviation 8.33Khz channel number scheme to actual frequency.
return base + (chno * 833) + (chno == 3);
}
I will speak about 8.33 spacing mode only now: that code only finds the nearest airband channel frequency to the given frequency.
In Airband, e.g. 118.025 and 118.030 means the same frequency 118.025MHz (first in 25 khz spacing, second in 8.33kHz spacing)
Code above returns: 118.025 for 118.025 but: 118.03333 for 118.030
In 8.33 spaced airband numbers set don’t correlate simply mathematically with frequency. For the current firmware you need to know on which real frequency the given airport is however controllers, pilots and published documents do not use/state the frequency but the number which needs to be set to get desired frequency. I think could be a good idea to implement airband mode to just need to set published numbers on radio and get the same functionality like airband radios have
..If somebody asks why 8.33 air band is so "illogical", it is because historically 6 digit frequencies were reported/published/set on radios. After transfer to 8.33kHz channel spacing they wanted to save this plus also to have the possibility to distinguish between 25KHz and 8.33kHz spaced channels bu just setting the different number (despite the frequency is the same). Radio knows which spacing mode it is that way so it can switch the mode automatically. And yes, some service still use 25kHz spacing in Europe: those are services which needs repeaters to have big coverage.. Those repeaters works on a bit shifted frequency from the base (each repeater on a bit different one) otherwise they would interfere badly each other in the range areas. Thus old wider band (25KHz spacing) is needed here..
BTW I have communicated also directly with QuanSheng support on this topic but I was not successful. Their firmware has the 8.33 airband solved much worse: they simply added 8.33 (so not 8.33333333 :-) ) to the base frequency 118MHZ :-) So the errors accumulated badly with increasing frequency and even correct frequencies could not be set. What I was wondering was I never found any complaint on that topic on Net from any user. I simply put the radio on shelf for some year but now I tried to look if Quansheng have made some improvement. I didn't find the firmware on their site anymore but instead I found your work. Great!!!
It is maybe rather a feature request than a bug. Probably you are aware that in aircraft communication, the published frequency number (number to dial on aircraft radio) is (can) be different from target frequency. More info e.g. here: https://833radio.com/news/show/7 so e.g.:
I think it can be very convenient to implement this airband frequency dial mode in the K-5 firmware. You usually have some published "frequency" for airfield or aircraft service which in fact is not a frequency but a number to set on the airband radio..