Single sweep and draw line added

pull/34/head
erikkaashoek 3 years ago
parent 9a8200c410
commit 3626be445d

@ -268,7 +268,7 @@ resume_sweep(void)
sweep_mode |= SWEEP_ENABLE; sweep_mode |= SWEEP_ENABLE;
} }
static inline void void
resume_once(uint16_t c) resume_once(uint16_t c)
{ {
sweep_once_count = c; sweep_once_count = c;

@ -58,6 +58,7 @@
//#define __SIMULATION__ //#define __SIMULATION__
#define __SCROLL__ // Add waterfall option #define __SCROLL__ // Add waterfall option
#define __LEVEL_METER__ #define __LEVEL_METER__
#define __DRAW_LINE__
#define __ICONS__ #define __ICONS__
#define __MEASURE__ #define __MEASURE__
#define __LINEARITY__ // Not available #define __LINEARITY__ // Not available
@ -264,8 +265,10 @@ void set_marker_frequency(int m, freq_t f);
void set_marker_time(int m, float f); void set_marker_time(int m, float f);
void set_marker_index(int m, int16_t idx); void set_marker_index(int m, int16_t idx);
void toggle_sweep(void); void toggle_sweep(void);
void resume_once(uint16_t c);
void toggle_mute(void); void toggle_mute(void);
void toggle_pulse(void); void toggle_pulse(void);
void toggle_draw_line(void);
void load_default_properties(void); void load_default_properties(void);
enum { enum {
@ -1128,6 +1131,7 @@ typedef struct setting
uint8_t harmonic; // used harmonic number 1...5 uint8_t harmonic; // used harmonic number 1...5
uint8_t fast_speedup; // 0 - 20 uint8_t fast_speedup; // 0 - 20
uint8_t _traces; // enabled traces flags uint8_t _traces; // enabled traces flags
uint8_t draw_line; // uses the trigger level setting
uint16_t linearity_step; // range equal POINTS_COUNT uint16_t linearity_step; // range equal POINTS_COUNT
uint16_t _sweep_points; uint16_t _sweep_points;

@ -1100,7 +1100,11 @@ draw_cell(int m, int n)
// PULSE; // PULSE;
#endif #endif
// Draw trigger line // Draw trigger line
if (setting.trigger != T_AUTO) { if (setting.trigger != T_AUTO
#ifdef __DRAW_LINE__
|| setting.draw_line
#endif
) {
c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR); c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR);
int tp = get_trigger_level() - y0; int tp = get_trigger_level() - y0;
if (tp>=0 && tp < h) if (tp>=0 && tp < h)

@ -576,6 +576,9 @@ void reset_settings(int m)
#else #else
setting.harmonic = 0; setting.harmonic = 0;
#endif #endif
#endif
#ifdef __DRAW_LINE__
setting.draw_line = false;
#endif #endif
setting.show_stored = 0; setting.show_stored = 0;
setting.auto_attenuation = false; setting.auto_attenuation = false;
@ -895,6 +898,14 @@ void toggle_pulse(void)
dirty = true; dirty = true;
} }
#ifdef __DRAW_LINE__
void toggle_draw_line(void)
{
setting.draw_line = !setting.draw_line;
dirty = true;
}
#endif
void toggle_debug_avoid(void) void toggle_debug_avoid(void)
{ {
debug_avoid = !debug_avoid; debug_avoid = !debug_avoid;

@ -474,7 +474,7 @@ static const struct {
#endif #endif
[KM_REPEAT] = {keypads_positive , "SAMPLE\nREPEAT"}, // KM_REPEA #15 [KM_REPEAT] = {keypads_positive , "SAMPLE\nREPEAT"}, // KM_REPEA #15
[KM_EXT_GAIN] = {keypads_plusmin , "EXT\nGAIN"}, // KM_EXT_GAIN [KM_EXT_GAIN] = {keypads_plusmin , "EXT\nGAIN"}, // KM_EXT_GAIN
[KM_TRIGGER] = {keypads_plusmin_unit, "TRIGGER\nLEVEL"}, // KM_TRIGGER [KM_TRIGGER] = {keypads_plusmin_unit, "LEVEL"}, // KM_TRIGGER
[KM_LEVELSWEEP] = {keypads_plusmin , "LEVEL\nSWEEP"}, // KM_LEVELSWEEP [KM_LEVELSWEEP] = {keypads_plusmin , "LEVEL\nSWEEP"}, // KM_LEVELSWEEP
[KM_SWEEP_TIME] = {keypads_time , "SWEEP\nSECONDS"}, // KM_SWEEP_TIME [KM_SWEEP_TIME] = {keypads_time , "SWEEP\nSECONDS"}, // KM_SWEEP_TIME
[KM_OFFSET_DELAY] = {keypads_positive , "OFFSET\nDELAY"}, // KM_OFFSET_DELAY #20 [KM_OFFSET_DELAY] = {keypads_positive , "OFFSET\nDELAY"}, // KM_OFFSET_DELAY #20
@ -1783,10 +1783,13 @@ static UI_FUNCTION_ADV_CALLBACK(menu_traces_acb)
else if (data == 2) // freeze else if (data == 2) // freeze
b->icon = setting.stored[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; b->icon = setting.stored[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
else if (data == 5) { else if (data == 5) {
if (setting.subtract[current_trace]) if (setting.subtract[current_trace]) {
plot_printf(b->text, sizeof(b->text), "SUBTRACT\nTRACE %d", setting.subtract[current_trace]); plot_printf(b->text, sizeof(b->text), "SUBTRACT\nTRACE %d", setting.subtract[current_trace]);
else b->icon = BUTTON_ICON_CHECK;
} else {
plot_printf(b->text, sizeof(b->text), "SUBTRACT\nOFF"); plot_printf(b->text, sizeof(b->text), "SUBTRACT\nOFF");
b->icon = BUTTON_ICON_NOCHECK;
}
// b->icon = setting.subtract[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; // icon not needed // b->icon = setting.subtract[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; // icon not needed
} else if (data == 4) { } else if (data == 4) {
if (current_trace == TRACES_MAX-1) if (current_trace == TRACES_MAX-1)
@ -1794,6 +1797,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_traces_acb)
else else
b->icon = setting.normalized[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; b->icon = setting.normalized[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
} else if (data == 3) { } else if (data == 3) {
b->icon = setting.average[current_trace] != AV_OFF ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
plot_printf(b->text, sizeof(b->text), "CALC\n%s", averageText[setting.average[current_trace]]); plot_printf(b->text, sizeof(b->text), "CALC\n%s", averageText[setting.average[current_trace]]);
// b->icon = setting.average[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; // icon not needed // b->icon = setting.average[current_trace] ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; // icon not needed
} }
@ -1903,14 +1907,31 @@ static UI_FUNCTION_ADV_CALLBACK(menu_waterfall_acb){
(void)item; (void)item;
(void)data; (void)data;
if (b){ if (b){
#ifdef TINYSA4
if (!(sweep_mode & SWEEP_ENABLE)){
plot_printf(b->text, sizeof(b->text), "SINGLE\nSWEEP");
b->icon = (sweep_mode & SWEEP_ONCE) ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
} else {
plot_printf(b->text, sizeof(b->text), "WATER\nFALL");
b->icon = setting.waterfall ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
}
#else
b->icon = setting.waterfall ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; b->icon = setting.waterfall ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
#endif
return; return;
} }
setting.waterfall++; if (setting.waterfall>W_BIG)setting.waterfall = W_OFF; #ifdef TINYSA4
if (setting.waterfall != W_OFF) if (is_paused()) {
setting.level_meter = false; resume_once(1);
set_waterfall(); } else
ui_mode_normal(); #endif
{
setting.waterfall++; if (setting.waterfall>W_BIG)setting.waterfall = W_OFF;
if (setting.waterfall != W_OFF)
setting.level_meter = false;
set_waterfall();
ui_mode_normal();
}
} }
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
@ -2278,6 +2299,22 @@ static UI_FUNCTION_ADV_CALLBACK(menu_settings_pulse_acb){
toggle_pulse(); toggle_pulse();
} }
#ifdef __DRAW_LINE__
static UI_FUNCTION_ADV_CALLBACK(menu_settings_draw_line_acb){
(void)item;
(void)data;
if(b){
b->icon = setting.draw_line ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
return;
}
toggle_draw_line();
if (setting.draw_line) {
kp_help_text = "Level";
ui_mode_keypad(KM_TRIGGER);
set_trigger(T_AUTO);
}
}
#endif
#ifdef __HAM_BAND__ #ifdef __HAM_BAND__
static UI_FUNCTION_ADV_CALLBACK(menu_settings_ham_bands){ static UI_FUNCTION_ADV_CALLBACK(menu_settings_ham_bands){
(void)item; (void)item;
@ -2333,7 +2370,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_pause_acb)
(void) data; (void) data;
(void) item; (void) item;
if (b){ if (b){
b->icon = is_paused() ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; b->icon = !(sweep_mode & SWEEP_ENABLE) ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
return; return;
} }
toggle_sweep(); toggle_sweep();
@ -3112,10 +3149,13 @@ static const menuitem_t menu_traces[] =
static const menuitem_t menu_display[] = { static const menuitem_t menu_display[] = {
{ MT_ADV_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_acb}, { MT_ADV_CALLBACK,0, "PAUSE\nSWEEP", menu_pause_acb},
{ MT_ADV_CALLBACK,1, "WATER\nFALL", menu_waterfall_acb}, { MT_ADV_CALLBACK,1, MT_CUSTOM_LABEL, menu_waterfall_acb},
#ifdef __LEVEL_METER__ #ifdef __LEVEL_METER__
{ MT_ADV_CALLBACK,1, "BIG\nNUMBER", menu_level_meter_acb}, { MT_ADV_CALLBACK,1, "BIG\nNUMBER", menu_level_meter_acb},
#endif #endif
#ifdef __DRAW_LINE__
{ MT_ADV_CALLBACK,1, "DRAW\nLINE", menu_settings_draw_line_acb},
#endif
#ifdef __VBW__ #ifdef __VBW__
{ MT_SUBMENU, 0, "VBW", menu_vbw}, { MT_SUBMENU, 0, "VBW", menu_vbw},
#endif #endif
@ -3628,7 +3668,6 @@ set_numeric_value(void)
set_trigger(T_NORMAL); set_trigger(T_NORMAL);
set_trigger_level(to_dBm(uistat.value)); set_trigger_level(to_dBm(uistat.value));
completed = true; completed = true;
break; break;
case KM_GRIDLINES: case KM_GRIDLINES:
set_gridlines(uistat.value); set_gridlines(uistat.value);

Loading…
Cancel
Save

Powered by TurnKey Linux.