Guards, beeper and lock display

pwm
erikkaashoek 3 years ago
parent 442a835c5b
commit 2a7785b5d4

@ -187,12 +187,13 @@ static THD_FUNCTION(Thread1, arg)
if (current_guard > GUARDS_MAX)
current_guard = 0;
}
if (setting.guards[current_guard].start - setting.guards[current_guard].end > 10000000) {
if (setting.guards[current_guard].end > setting.guards[current_guard].start) {
set_sweep_frequency(ST_START, setting.guards[current_guard].start);
set_sweep_frequency(ST_STOP, setting.guards[current_guard].end);
set_rbw(8000);
set_sweep_points((setting.guards[current_guard].end - setting.guards[current_guard].start) / 800000);
}
DAC->DHR12R1 = 0;
}
#endif
completed = sweep(true);
@ -1140,8 +1141,12 @@ void load_LCD_properties(void)
#endif
void set_sweep_points(uint16_t points){
if (points == sweep_points || points > POINTS_COUNT)
if (points == sweep_points)
return;
if (points > POINTS_COUNT)
points = POINTS_COUNT;
if (points < 10)
points = 10;
sweep_points = points;
update_frequencies();

@ -1200,7 +1200,9 @@ typedef struct setting
uint8_t fast_speedup; // 0 - 20
uint8_t _traces; // enabled traces flags
uint8_t draw_line; // uses the trigger level setting
#ifdef TINYSA4
uint8_t lock_display;
#endif
uint16_t repeat; // 1...100
uint16_t linearity_step; // range equal POINTS_COUNT
uint16_t _sweep_points;

@ -1116,7 +1116,16 @@ draw_cell(int m, int n)
if ((uint32_t)(x + x0 - CELLOFFSETX) <= WIDTH + CELLOFFSETX)
cell_buffer[tp * CELLWIDTH + x] = c;
}
#ifdef __GUARD__XX
if (setting.measurement == M_GUARD) {
int tp = get_guard_level() - y0;
if (tp>=0 && tp < h)
for (x = 0; x < w; x++)
if ((uint32_t)(x + x0 - CELLOFFSETX) <= WIDTH + CELLOFFSETX)
cell_buffer[tp * CELLWIDTH + x] = c;
}
#endif
#if 1
// Only right cells
if (m >= (GRID_X_TEXT)/CELLWIDTH)

@ -5190,7 +5190,7 @@ static volatile int dummy;
if (MODE_INPUT(setting.mode)) {
#ifdef __GUARD__
if (setting.measurement == M_GUARD && RSSI > setting.guards[current_guard].level) {
// guard_exceeded();
DAC->DHR12R1 = 4095;
}
#endif
for (int t=0; t<TRACES_MAX;t++) { // Calculate all traces

32
ui.c

@ -360,6 +360,10 @@ static void touch_init(void){
static int
touch_check(void)
{
#ifdef TINYSA4
if (setting.lock_display)
return EVT_TOUCH_NONE;
#endif
touch_stop_watchdog();
int stat = touch_status();
@ -2155,6 +2159,17 @@ static UI_FUNCTION_CALLBACK(menu_config_cb)
redraw_frame();
request_to_redraw_grid();
}
#ifdef TINYSA4
static UI_FUNCTION_CALLBACK(menu_lock_display_cb)
{
(void)item;
(void)data;
setting.lock_display = data;
ui_mode_normal();
}
#endif
#ifdef __HAS_DFU__
static UI_FUNCTION_CALLBACK(menu_dfu_cb)
{
@ -3180,7 +3195,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_guard_select_acb)
active_guard = data;
setting.guards[active_guard].enabled = true;
dirty = true;
guards_update();
// guards_update();
menu_push_submenu(menu_guard_modify);
}
@ -3324,7 +3339,7 @@ static UI_FUNCTION_CALLBACK(menu_guard_disable_cb)
if (active_guard<GUARDS_MAX){
setting.guards[active_guard].enabled = false;
dirty = true;
guards_update();
// guards_update();
menu_move_back(false);
}
}
@ -4561,6 +4576,14 @@ const menuitem_t menu_date_time[] = {
};
#endif
#ifdef TINYSA4
static const menuitem_t menu_lock_display[] = {
{ MT_CALLBACK, 1, "LOCK\nDISPLAY", menu_lock_display_cb },
{ MT_CALLBACK, 0, "UNLOCK\nDISPLAY", menu_lock_display_cb },
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#endif
static const menuitem_t menu_config2[] =
{
{ MT_ADV_CALLBACK, 0, "PULSE\nHIGH", menu_settings_pulse_acb},
@ -4660,6 +4683,9 @@ static const menuitem_t menu_display[] = {
{ MT_SUBMENU, 0, "SWEEP\nPOINTS", menu_sweep_points},
{ MT_SUBMENU, 0, "SWEEP\nACCURACY", menu_sweep_speed},
{ MT_ADV_CALLBACK,0, "ROTATE\nDISPLAY", menu_flip_acb},
#ifdef TINYSA4
{ MT_SUBMENU,0, "LOCK\nDISPLAY", menu_lock_display},
#endif
//#ifdef __REMOTE_DESKTOP__
// { MT_ADV_CALLBACK,0, "SEND\nDISPLAY", menu_send_display_acb},
//#endif
@ -4964,7 +4990,7 @@ static void fetch_numeric_target(uint8_t mode)
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value);
break;
case KM_GUARD_END:
uistat.freq_value = setting.guards[active_guard].start;
uistat.freq_value = setting.guards[active_guard].end;
plot_printf(uistat.text, sizeof uistat.text, "%.3QHz", uistat.freq_value);
break;
case KM_GUARD_LEVEL:

Loading…
Cancel
Save

Powered by TurnKey Linux.