uint8_t channel_resolver_get_frequency(uint8_t channel)
{
// ...
freq = channel + (channel < 11 ? 2 : 3) * 2; // Spec Vol. 6, Part B, 1.4.1
return freq;
}
I think this is missing braces. The function returns different results from the referenced table in 6.B.1.4.1.
For example: channel 36 should be 2478MHz. The above equation returns 36 + 3*2 = 42 (which becomes 2042MHz not 2478MHz in the radio peripheral).
I suspect the issue is simply the slight thinko of a missing pair of parenthises:
freq = (channel + (channel < 11 ? 2 : 3)) * 2; // Spec Vol. 6, Part B, 1.4.1
Some test points:
- channel 0 maps to (0+2)*2 = 4. Correct.
- channel 10 maps to (10+2)*2 = 24. Correct.
- channel 11 maps to (11+3)*2 = 28. Correct.
- channel 36 maps to (36+3)*2 = 78. Correct.
I think this is missing braces. The function returns different results from the referenced table in 6.B.1.4.1.
For example: channel 36 should be 2478MHz. The above equation returns 36 + 3*2 = 42 (which becomes 2042MHz not 2478MHz in the radio peripheral).
I suspect the issue is simply the slight thinko of a missing pair of parenthises:
Some test points: