| 53 | constexpr int kTMate2DefaultOverlayDurationMs = 1500; |
| 54 | |
| 55 | QString formatTMate2PowerSmallText(float watts) |
| 56 | { |
| 57 | // std::lround(NaN) is unspecified; clamp to 0 first, mirroring powerBars(). |
| 58 | if (!std::isfinite(watts)) |
| 59 | watts = 0.0f; |
| 60 | const int roundedWatts = std::clamp(static_cast<int>(std::lround(watts)), 0, 9999); |
| 61 | if (roundedWatts <= 999) |
| 62 | return QString::number(roundedWatts); |
| 63 | |
| 64 | const int tenthsKw = std::clamp(static_cast<int>(std::lround(watts / 100.0f)), 10, 99); |
| 65 | return QStringLiteral("%1k%2").arg(tenthsKw / 10).arg(tenthsKw % 10); |
| 66 | } |
| 67 | |
| 68 | bool usesExternalReceiveControls(const SliceModel* slice) |
| 69 | { |