mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-07-26 10:38:52 +00:00
fix looking glass frequency cast error (#3253)
* fix looking glass frequency cast error * add useless protecter back
This commit is contained in:
@@ -328,8 +328,8 @@ void GlassView::update_min(int32_t v) {
|
|||||||
min_size = search_span;
|
min_size = search_span;
|
||||||
if (min_size < 1)
|
if (min_size < 1)
|
||||||
min_size = 1;
|
min_size = 1;
|
||||||
if (v > 7200 - min_size) {
|
if (v > LOOKING_GLASS_MAX_FREQ_MHZ - min_size) {
|
||||||
v = 7200 - min_size;
|
v = LOOKING_GLASS_MAX_FREQ_MHZ - min_size;
|
||||||
}
|
}
|
||||||
if (v > (field_frequency_max.value() - min_size))
|
if (v > (field_frequency_max.value() - min_size))
|
||||||
field_frequency_max.set_value(v + min_size, false);
|
field_frequency_max.set_value(v + min_size, false);
|
||||||
@@ -348,6 +348,9 @@ void GlassView::update_max(int32_t v) {
|
|||||||
if (v < min_size) {
|
if (v < min_size) {
|
||||||
v = min_size;
|
v = min_size;
|
||||||
}
|
}
|
||||||
|
if (v > LOOKING_GLASS_MAX_FREQ_MHZ) {
|
||||||
|
v = LOOKING_GLASS_MAX_FREQ_MHZ;
|
||||||
|
}
|
||||||
if (v < (field_frequency_min.value() + min_size))
|
if (v < (field_frequency_min.value() + min_size))
|
||||||
field_frequency_min.set_value(v - min_size, false);
|
field_frequency_min.set_value(v - min_size, false);
|
||||||
if (locked_range)
|
if (locked_range)
|
||||||
@@ -630,7 +633,7 @@ void GlassView::load_presets() {
|
|||||||
parse_int(cols[1], entry.max);
|
parse_int(cols[1], entry.max);
|
||||||
entry.label = trimr(cols[2]);
|
entry.label = trimr(cols[2]);
|
||||||
|
|
||||||
if (entry.min == 0 || entry.max == 0 || entry.min >= entry.max)
|
if (entry.max == 0 || entry.min >= entry.max)
|
||||||
continue; // Invalid line.
|
continue; // Invalid line.
|
||||||
|
|
||||||
presets_db.emplace_back(std::move(entry));
|
presets_db.emplace_back(std::move(entry));
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace ui {
|
|||||||
#define LOOKING_GLASS_SLICE_WIDTH_MAX 20000000
|
#define LOOKING_GLASS_SLICE_WIDTH_MAX 20000000
|
||||||
#define LOOKING_GLASS_MAX_SAMPLERATE 20000000
|
#define LOOKING_GLASS_MAX_SAMPLERATE 20000000
|
||||||
#define MHZ_DIV 1000000
|
#define MHZ_DIV 1000000
|
||||||
|
#define LOOKING_GLASS_MAX_FREQ_MHZ 7250 // HackRF upper tuning limit (band_high top), in MHz
|
||||||
|
|
||||||
// blanked DC (16 centered bins ignored ) and top left and right (2 bins ignored on each side )
|
// blanked DC (16 centered bins ignored ) and top left and right (2 bins ignored on each side )
|
||||||
#define LOOKING_GLASS_FASTSCAN 0
|
#define LOOKING_GLASS_FASTSCAN 0
|
||||||
@@ -179,14 +180,14 @@ class GlassView : public View {
|
|||||||
NumberField field_frequency_min{
|
NumberField field_frequency_min{
|
||||||
{UI_POS_X(4), UI_POS_Y(0)},
|
{UI_POS_X(4), UI_POS_Y(0)},
|
||||||
4,
|
4,
|
||||||
{0, 7199},
|
{0, LOOKING_GLASS_MAX_FREQ_MHZ - 1},
|
||||||
1, // number of steps by encoder delta
|
1, // number of steps by encoder delta
|
||||||
' '};
|
' '};
|
||||||
|
|
||||||
NumberField field_frequency_max{
|
NumberField field_frequency_max{
|
||||||
{UI_POS_X(13), UI_POS_Y(0)},
|
{UI_POS_X(13), UI_POS_Y(0)},
|
||||||
4,
|
4,
|
||||||
{1, 7200},
|
{1, LOOKING_GLASS_MAX_FREQ_MHZ},
|
||||||
1, // number of steps by encoder delta
|
1, // number of steps by encoder delta
|
||||||
' '};
|
' '};
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ Build options:
|
|||||||
-G, --generator <name> CMake generator (default: Ninja)
|
-G, --generator <name> CMake generator (default: Ninja)
|
||||||
-j, --jobs <n> Build parallelism (default: host CPU count)
|
-j, --jobs <n> Build parallelism (default: host CPU count)
|
||||||
--target <name> Build a specific target
|
--target <name> Build a specific target
|
||||||
--clean Remove build directory, run libopencm3 clean, and exit
|
--clean Remove build directory, run libopencm3 clean, and exit
|
||||||
--cmake-arg <arg> Extra CMake configure arg (repeatable)
|
--cmake-arg <arg> Extra CMake configure arg (repeatable)
|
||||||
--build-arg <arg> Extra cmake --build arg (repeatable)
|
--build-arg <arg> Extra cmake --build arg (repeatable)
|
||||||
-y, --non-interactive Fail instead of prompting when required input is missing
|
-y, --non-interactive Fail instead of prompting when required input is missing
|
||||||
|
|||||||
Reference in New Issue
Block a user