2026-01-06 09:48:38 +08:00
|
|
|
#include "common/frequency.h"
|
2025-07-30 14:30:36 +08:00
|
|
|
|
|
|
|
|
bool ffFreqAppendNum(uint32_t mhz, FFstrbuf* result)
|
|
|
|
|
{
|
|
|
|
|
if (mhz == 0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
const FFOptionsDisplay* options = &instance.config.display;
|
2025-08-19 17:22:11 +08:00
|
|
|
bool spaceBeforeUnit = options->freqSpaceBeforeUnit != FF_SPACE_BEFORE_UNIT_NEVER;
|
2025-07-30 14:30:36 +08:00
|
|
|
int8_t ndigits = options->freqNdigits;
|
|
|
|
|
|
|
|
|
|
if (ndigits >= 0)
|
2025-08-19 17:22:11 +08:00
|
|
|
{
|
2025-09-02 14:12:58 +08:00
|
|
|
ffStrbufAppendDouble(result, mhz / 1000., ndigits, true);
|
2025-08-19 17:22:11 +08:00
|
|
|
if (spaceBeforeUnit) ffStrbufAppendC(result, ' ');
|
|
|
|
|
ffStrbufAppendS(result, "GHz");
|
|
|
|
|
}
|
2025-07-30 14:30:36 +08:00
|
|
|
else
|
2025-08-19 17:22:11 +08:00
|
|
|
{
|
|
|
|
|
ffStrbufAppendUInt(result, mhz);
|
|
|
|
|
if (spaceBeforeUnit) ffStrbufAppendC(result, ' ');
|
|
|
|
|
ffStrbufAppendS(result, "MHz");
|
|
|
|
|
}
|
2025-07-30 14:30:36 +08:00
|
|
|
return true;
|
|
|
|
|
}
|