rad1o: Don't update the UI during sweeps

Updating the UI during sweeps significantly increases the time needed to
complete a sweep. Instead simply show "SWEEP" on the display.
This commit is contained in:
schneider
2022-01-10 23:22:39 +01:00
parent 9404226c6a
commit 7bf55dc983
5 changed files with 31 additions and 3 deletions

View File

@ -43,6 +43,7 @@ void hackrf_ui_set_first_if_frequency_null(const uint64_t frequency) { UNUSED(fr
void hackrf_ui_set_filter_null(const rf_path_filter_t filter) { UNUSED(filter); }
void hackrf_ui_set_antenna_bias_null(bool antenna_bias) { UNUSED(antenna_bias); }
void hackrf_ui_set_clock_source_null(clock_source_t source) { UNUSED(source); }
void hackrf_ui_set_transceiver_mode_null(transceiver_mode_t mode) { UNUSED(mode); }
bool hackrf_ui_operacake_gpio_compatible_null(void) { return true; }
/* Null UI function table, used if there's no hardware UI detected. Eliminates the
@ -63,6 +64,7 @@ static const hackrf_ui_t hackrf_ui_null = {
&hackrf_ui_set_filter_null,
&hackrf_ui_set_antenna_bias_null,
&hackrf_ui_set_clock_source_null,
&hackrf_ui_set_transceiver_mode_null,
&hackrf_ui_operacake_gpio_compatible_null
};

View File

@ -39,6 +39,7 @@ typedef void (*hackrf_ui_set_first_if_frequency_fn)(const uint64_t frequency);
typedef void (*hackrf_ui_set_filter_fn)(const rf_path_filter_t filter);
typedef void (*hackrf_ui_set_antenna_bias_fn)(bool antenna_bias);
typedef void (*hackrf_ui_set_clock_source_fn)(clock_source_t source);
typedef void (*hackrf_ui_set_transceiver_mode_fn)(transceiver_mode_t mode);
typedef bool (*hackrf_ui_operacake_gpio_compatible_fn)(void);
typedef struct {
@ -56,6 +57,7 @@ typedef struct {
hackrf_ui_set_filter_fn set_filter;
hackrf_ui_set_antenna_bias_fn set_antenna_bias;
hackrf_ui_set_clock_source_fn set_clock_source;
hackrf_ui_set_transceiver_mode_fn set_transceiver_mode;
hackrf_ui_operacake_gpio_compatible_fn operacake_gpio_compatible;
} hackrf_ui_t;

View File

@ -554,6 +554,10 @@ static void portapack_ui_set_clock_source(clock_source_t source) {
portapack_lcd_draw_string(label_point, s);
}
static void portapack_ui_set_transceiver_mode(transceiver_mode_t mode) {
(void)mode;
}
static bool portapack_ui_operacake_gpio_compatible(void) {
return false;
}
@ -573,6 +577,7 @@ const hackrf_ui_t portapack_hackrf_ui = {
&portapack_ui_set_filter,
&portapack_ui_set_antenna_bias,
&portapack_ui_set_clock_source,
&portapack_ui_set_transceiver_mode,
&portapack_ui_operacake_gpio_compatible,
};

View File

@ -38,6 +38,7 @@ static uint32_t bblna_gain = 0;
static uint32_t bbvga_gain = 0;
static uint32_t bbtxvga_gain = 0;
static bool lna_on = false;
static transceiver_mode_t trx_mode;
static bool enabled = false;
#define BLACK 0b00000000
@ -129,7 +130,12 @@ static void ui_update(void)
rad1o_drawHLine(11, 0, RESX - 1, WHITE);
rad1o_lcdSetCrsr(2, 12);
if(trx_mode == TRANSCEIVER_MODE_RX_SWEEP) {
rad1o_setIntFont(&Font_Ubuntu18pt);
rad1o_lcdPrint("SWEEP");
} else {
draw_frequency();
}
rad1o_drawHLine(40, 0, RESX - 1, WHITE);
@ -216,8 +222,12 @@ static void rad1o_ui_deinit(void)
static void rad1o_ui_set_frequency(uint64_t frequency)
{
freq = frequency;
if(TRANSCEIVER_MODE_RX_SWEEP == trx_mode) {
} else {
ui_update();
}
}
static void rad1o_ui_set_sample_rate(uint32_t _sample_rate)
{
@ -281,6 +291,12 @@ static void rad1o_ui_set_clock_source(clock_source_t source __attribute__((unuse
// Not implemented
}
static void rad1o_ui_set_transceiver_mode(transceiver_mode_t mode)
{
trx_mode = mode;
ui_update();
}
static bool rad1o_ui_operacake_gpio_compatible(void)
{
return true;
@ -301,6 +317,7 @@ static const hackrf_ui_t rad1o_ui = {
&rad1o_ui_set_filter,
&rad1o_ui_set_antenna_bias,
&rad1o_ui_set_clock_source,
&rad1o_ui_set_transceiver_mode,
&rad1o_ui_operacake_gpio_compatible,
};

View File

@ -256,6 +256,8 @@ void set_transceiver_mode(const transceiver_mode_t new_transceiver_mode) {
_transceiver_mode = new_transceiver_mode;
hackrf_ui()->set_transceiver_mode(_transceiver_mode);
switch (_transceiver_mode) {
case TRANSCEIVER_MODE_RX_SWEEP:
case TRANSCEIVER_MODE_RX: