0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-06-19 14:48:03 +03:00

Added freq cal menu option (hidden) + 8.33kHz step bug fix

This commit is contained in:
OneOfEleven
2023-09-15 21:58:59 +01:00
parent 43b9c0944a
commit eb7dcceaab
16 changed files with 233 additions and 113 deletions

View File

@ -148,7 +148,22 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
{
const uint32_t Index = (Upper - Lower) / Step;
uint32_t Index;
if (Step == 833)
{
const uint32_t Delta = Upper - Lower;
uint32_t Base = (Delta / 2500) * 2500;
const uint32_t Index = ((Delta - Base) % 2500) / 833;
if (Index == 2)
Base++;
return Lower + Base + (Index * 833);
}
Index = (Upper - Lower) / Step;
return Lower + (Step * Index);
}