ohmu
·
2026-10-15
1#include "common/frequency.h"
2
3bool ffFreqAppendNum(uint32_t mhz, FFstrbuf* result) {
4 if (mhz == 0) {
5 return false;
6 }
7
8 const FFOptionsDisplay* options = &instance.config.display;
9 bool spaceBeforeUnit = options->freqSpaceBeforeUnit != FF_SPACE_BEFORE_UNIT_NEVER;
10 int8_t ndigits = options->freqNdigits;
11
12 if (ndigits >= 0) {
13 ffStrbufAppendDouble(result, mhz / 1000., ndigits, true);
14 if (spaceBeforeUnit) {
15 ffStrbufAppendC(result, ' ');
16 }
17 ffStrbufAppendS(result, "GHz");
18 } else {
19 ffStrbufAppendUInt(result, mhz);
20 if (spaceBeforeUnit) {
21 ffStrbufAppendC(result, ' ');
22 }
23 ffStrbufAppendS(result, "MHz");
24 }
25 return true;
26}