| 99 | } |
| 100 | |
| 101 | float agcThresholdToControllerValue(const SliceModel* slice) |
| 102 | { |
| 103 | if (!slice) { |
| 104 | return 0.0f; |
| 105 | } |
| 106 | if (!usesExternalReceiveControls(slice)) { |
| 107 | return static_cast<float>(slice->agcThreshold()); |
| 108 | } |
| 109 | constexpr float kUiSpan = 100.0f; |
| 110 | const float agcSpan = |
| 111 | static_cast<float>(KiwiSdrProtocol::kAgcThresholdMaxDb |
| 112 | - KiwiSdrProtocol::kAgcThresholdMinDb); |
| 113 | return std::clamp( |
| 114 | static_cast<float>(slice->receiveAgcThreshold() |
| 115 | - KiwiSdrProtocol::kAgcThresholdMinDb) |
| 116 | * kUiSpan / agcSpan, |
| 117 | 0.0f, kUiSpan); |
| 118 | } |
| 119 | |
| 120 | int agcThresholdOverlayValue(const SliceModel* slice, int threshold) |
| 121 | { |
no test coverage detected