mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-12 15:59:49 -05:00
More application of range_t methods.
This commit is contained in:
parent
7519b83379
commit
87dc5a055b
@ -40,7 +40,7 @@ constexpr std::array<uint8_t, 8> lookup_8db_steps {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static uint_fast8_t gain_ordinal(const int8_t db) {
|
static uint_fast8_t gain_ordinal(const int8_t db) {
|
||||||
int8_t db_sat = std::min(std::max(gain_db_min, db), gain_db_max);
|
const auto db_sat = gain_db_range.clip(db);
|
||||||
return lna::lookup_8db_steps[(db_sat >> 3) & 7];
|
return lna::lookup_8db_steps[(db_sat >> 3) & 7];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ static uint_fast8_t gain_ordinal(const int8_t db) {
|
|||||||
namespace vga {
|
namespace vga {
|
||||||
|
|
||||||
static uint_fast8_t gain_ordinal(const int8_t db) {
|
static uint_fast8_t gain_ordinal(const int8_t db) {
|
||||||
int8_t db_sat = std::min(std::max(gain_db_min, db), gain_db_max);
|
const auto db_sat = gain_db_range.clip(db);
|
||||||
return ((db_sat >> 1) & 0b11111) ^ 0b11111;
|
return ((db_sat >> 1) & 0b11111) ^ 0b11111;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,8 +62,7 @@ constexpr std::array<rf::FrequencyRange, 4> band { {
|
|||||||
|
|
||||||
namespace lna {
|
namespace lna {
|
||||||
|
|
||||||
constexpr int8_t gain_db_min = 0;
|
constexpr range_t<int8_t> gain_db_range { 0, 40 };
|
||||||
constexpr int8_t gain_db_max = 40;
|
|
||||||
constexpr int8_t gain_db_step = 8;
|
constexpr int8_t gain_db_step = 8;
|
||||||
|
|
||||||
constexpr std::array<rf::FrequencyRange, 2> band { {
|
constexpr std::array<rf::FrequencyRange, 2> band { {
|
||||||
@ -77,8 +76,7 @@ constexpr std::array<rf::FrequencyRange, 2> band { {
|
|||||||
|
|
||||||
namespace vga {
|
namespace vga {
|
||||||
|
|
||||||
constexpr int8_t gain_db_min = 0;
|
constexpr range_t<int8_t> gain_db_range { 0, 62 };
|
||||||
constexpr int8_t gain_db_max = 62;
|
|
||||||
constexpr int8_t gain_db_step = 2;
|
constexpr int8_t gain_db_step = 2;
|
||||||
|
|
||||||
} /* namespace vga */
|
} /* namespace vga */
|
||||||
|
@ -309,7 +309,7 @@ LNAGainField::LNAGainField(
|
|||||||
Point parent_pos
|
Point parent_pos
|
||||||
) : NumberField {
|
) : NumberField {
|
||||||
parent_pos, 2,
|
parent_pos, 2,
|
||||||
{ max2837::lna::gain_db_min, max2837::lna::gain_db_max },
|
{ max2837::lna::gain_db_range.minimum, max2837::lna::gain_db_range.maximum },
|
||||||
max2837::lna::gain_db_step,
|
max2837::lna::gain_db_step,
|
||||||
' ',
|
' ',
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ private:
|
|||||||
NumberField field_vga {
|
NumberField field_vga {
|
||||||
{ 18 * 8, 0 * 16},
|
{ 18 * 8, 0 * 16},
|
||||||
2,
|
2,
|
||||||
{ max2837::vga::gain_db_min, max2837::vga::gain_db_max },
|
{ max2837::vga::gain_db_range.minimum, max2837::vga::gain_db_range.maximum },
|
||||||
max2837::vga::gain_db_step,
|
max2837::vga::gain_db_step,
|
||||||
' ',
|
' ',
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user