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

ix dual-watch wrong TX VFO - hopefully

This commit is contained in:
OneOfEleven
2023-10-06 22:58:21 +01:00
parent 2790873d87
commit d1e9ec2626
4 changed files with 34 additions and 25 deletions

View File

@ -83,21 +83,20 @@ FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
{
uint8_t pwr = TxpMid;
if (Frequency <= LowerLimit)
return TxpLow;
if (UpperLimit <= Frequency)
if (Frequency >= UpperLimit)
return TxpHigh;
// linear interpolation
if (Frequency <= Middle)
{
TxpMid += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
return TxpMid;
}
TxpMid += ((TxpHigh - TxpMid) * (Frequency - Middle)) / (UpperLimit - Middle);
return TxpMid;
pwr += ((TxpMid - TxpLow) * (Frequency - LowerLimit)) / (Middle - LowerLimit);
else
pwr += ((TxpHigh - TxpMid) * (Frequency - Middle)) / (UpperLimit - Middle);
return pwr;
}
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)