trigger trace + ham band

save_scan
erikkaashoek 3 years ago
parent 13d1e65576
commit 25b71ed70c

@ -1098,6 +1098,9 @@ void load_LCD_properties(void)
setting.waterfall = W_OFF; setting.waterfall = W_OFF;
setting.level_meter = false; setting.level_meter = false;
setting._traces = TRACE_ACTUAL_FLAG; setting._traces = TRACE_ACTUAL_FLAG;
#ifdef __TRIGGER_TRACE__
setting.trigger_trace = 255;
#endif
memcpy(setting._markers, def_markers, sizeof(def_markers)); memcpy(setting._markers, def_markers, sizeof(def_markers));
#ifdef __LIMITS__ #ifdef __LIMITS__
memset(setting.limits, 0, sizeof(setting.limits)); memset(setting.limits, 0, sizeof(setting.limits));

@ -67,7 +67,6 @@
#define __CALIBRATE__ // Add calibration menu and functions #define __CALIBRATE__ // Add calibration menu and functions
#define __FAST_SWEEP__ // Pre-fill SI4432 RSSI buffer to get fastest sweep in zero span mode #define __FAST_SWEEP__ // Pre-fill SI4432 RSSI buffer to get fastest sweep in zero span mode
// #define __AUDIO__ // #define __AUDIO__
//#define __HAM_BAND__
#define __SPUR__ // Does spur reduction by shifting IF #define __SPUR__ // Does spur reduction by shifting IF
#define __USE_SERIAL_CONSOLE__ // Enable serial I/O connection (need enable HAL_USE_SERIAL as TRUE in halconf.h) #define __USE_SERIAL_CONSOLE__ // Enable serial I/O connection (need enable HAL_USE_SERIAL as TRUE in halconf.h)
#ifdef __USE_SERIAL_CONSOLE__ #ifdef __USE_SERIAL_CONSOLE__
@ -91,6 +90,8 @@
#define __BANDS__ #define __BANDS__
#define __BEEP__ #define __BEEP__
#define __MULTI_BAND__ #define __MULTI_BAND__
#define __HAM_BAND__
#define __TRIGGER_TRACE__
#define __MCU_CLOCK_SHIFT__ #define __MCU_CLOCK_SHIFT__
#define __ULTRA__ #define __ULTRA__
#define __USE_RTC__ // Enable RTC clock #define __USE_RTC__ // Enable RTC clock
@ -1094,7 +1095,7 @@ typedef uint16_t pixel_t;
[LCD_BRIGHT_COLOR_GREEN]= RGB565( 0,255, 0), \ [LCD_BRIGHT_COLOR_GREEN]= RGB565( 0,255, 0), \
[LCD_DARK_GREY ] = RGB565(140,140,140), \ [LCD_DARK_GREY ] = RGB565(140,140,140), \
[LCD_LIGHT_GREY ] = RGB565(220,220,220), \ [LCD_LIGHT_GREY ] = RGB565(220,220,220), \
[LCD_HAM_COLOR ] = RGB565( 80, 80, 80), \ [LCD_HAM_COLOR ] = RGB565( 40, 40, 40), \
[LCD_GRID_VALUE_COLOR ] = RGB565(196,196,196), \ [LCD_GRID_VALUE_COLOR ] = RGB565(196,196,196), \
[LCD_M_REFERENCE ] = RGB565(255,255,255), \ [LCD_M_REFERENCE ] = RGB565(255,255,255), \
[LCD_M_DELTA ] = RGB565( 0,255, 0), \ [LCD_M_DELTA ] = RGB565( 0,255, 0), \
@ -1234,6 +1235,9 @@ typedef struct setting
#ifdef __BANDS__ #ifdef __BANDS__
uint8_t multi_band; uint8_t multi_band;
uint8_t multi_trace; uint8_t multi_trace;
#endif
#ifdef __TRIGGER_TRACE__
uint8_t trigger_trace;
#endif #endif
uint16_t repeat; // 1...100 uint16_t repeat; // 1...100
uint16_t linearity_step; // range equal POINTS_COUNT uint16_t linearity_step; // range equal POINTS_COUNT
@ -1441,7 +1445,7 @@ typedef struct properties {
//sizeof(properties_t) == 0x1200 //sizeof(properties_t) == 0x1200
#define CONFIG_MAGIC 0x434f4e60 /* 'CONF' */ #define CONFIG_MAGIC 0x434f4e60 /* 'CONF' */
#define SETTING_MAGIC 0x434f4e62 #define SETTING_MAGIC 0x434f4e63
extern int16_t lastsaveid; extern int16_t lastsaveid;
//extern properties_t *active_props; //extern properties_t *active_props;
@ -1780,7 +1784,7 @@ void calibrate_modulation(int modulation, int8_t *correction);
enum { enum {
M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE, M_SNR, M_PASS_BAND, M_LINEARITY, M_AM, M_FM, M_THD, M_CP, M_NF_TINYSA, M_NF_STORE, M_NF_VALIDATE, M_NF_AMPLIFIER, M_DECONV,M_MAX M_OFF, M_IMD, M_OIP3, M_PHASE_NOISE, M_SNR, M_PASS_BAND, M_LINEARITY, M_AM, M_FM, M_THD, M_CP, M_NF_TINYSA, M_NF_STORE, M_NF_VALIDATE, M_NF_AMPLIFIER, M_DECONV,M_MAX
}; };
#define MEASUREMENT_TEXT "OFF","IMD","OIP3","PN","SNR","PASS","LIN","AM","FM","THD","CP","NF T","NF S","NF V","NF A", "DECONF" #define MEASUREMENT_TEXT "OFF","HARM","OIP3","PN","SNR","PASS","LIN","AM","FM","THD","CP","NF T","NF S","NF V","NF A", "DECONF"
enum { enum {
T_AUTO, T_NORMAL, T_SINGLE, T_DONE, T_UP, T_DOWN, T_MODE, T_PRE, T_POST, T_MID, T_BEEP, T_AUTO, T_NORMAL, T_SINGLE, T_DONE, T_UP, T_DOWN, T_MODE, T_PRE, T_POST, T_MID, T_BEEP,

@ -195,14 +195,26 @@ const ham_bands_t ham_bands[] =
{28000000, 29700000}, {28000000, 29700000},
{50000000, 52000000}, {50000000, 52000000},
{70000000, 70500000}, {70000000, 70500000},
{144000000, 146000000} {144000000, 148000000},
{222000000, 225000000},
{420000000, 450000000},
{902000000, 928000000},
{1240000000,1300000000},
{2300000000, 2310000000},
{2390000000, 2450000000},
{3300000000, 3500000000},
{5650000000, 5925000000},
{10000000000, 10500000000}
}; };
const int ham_band_max = 24;
int ham_band(int x) // Search which index in the frequency tabled matches with frequency f using actual_rbw int ham_band(int x) // Search which index in the frequency tabled matches with frequency f using actual_rbw
{ {
freq_t f = frequencies[x] + (setting.frequency_offset - FREQUENCY_SHIFT); freq_t f = getFrequency(x) + (setting.frequency_offset - FREQUENCY_SHIFT);
int L = 0; int L = 0;
int R = (sizeof ham_bands)/sizeof(freq_t) - 1; int R = ham_band_max - 1;
while (L <= R) { while (L <= R) {
int m = (L + R) / 2; int m = (L + R) / 2;
if (ham_bands[m].stop < f) if (ham_bands[m].stop < f)
@ -1062,13 +1074,22 @@ draw_cell(int m, int n)
// Draw grid // Draw grid
#if 1 #if 1
c = GET_PALTETTE_COLOR(LCD_GRID_COLOR);
// Generate grid type list // Generate grid type list
uint32_t trace_type = 0; uint32_t trace_type = 0;
if (IS_TRACES_ENABLED(TRACE_ACTUAL_FLAG|TRACE_STORED_FLAG|TRACE_TEMP_FLAG)) if (IS_TRACES_ENABLED(TRACE_ACTUAL_FLAG|TRACE_STORED_FLAG|TRACE_TEMP_FLAG))
trace_type |= RECTANGULAR_GRID_MASK; trace_type |= RECTANGULAR_GRID_MASK;
#ifdef __HAM_BAND__
if (config.hambands){
c = GET_PALTETTE_COLOR(LCD_HAM_COLOR);
for (x = 0; x < w; x++)
if (ham_band(x+x0))
for (y = 0; y < h; y++) cell_buffer[y * CELLWIDTH + x] = c;
}
#endif
c = GET_PALTETTE_COLOR(LCD_GRID_COLOR);
// Draw rectangular plot (40 system ticks for all screen calls) // Draw rectangular plot (40 system ticks for all screen calls)
if (trace_type & RECTANGULAR_GRID_MASK) { if (trace_type & RECTANGULAR_GRID_MASK) {
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
@ -1084,14 +1105,6 @@ draw_cell(int m, int n)
} }
} }
} }
#ifdef __HAM_BAND__
if (config.hambands){
c = GET_PALTETTE_COLOR(LCD_HAM_COLOR);
for (x = 0; x < w; x++)
if (ham_band(x+x0))
for (y = 0; y < h; y++) cell_buffer[y * CELLWIDTH + x] = c;
}
#endif
#ifdef __CHANNEL_POWER__ #ifdef __CHANNEL_POWER__
if (setting.measurement == M_CP||setting.measurement == M_SNR) { if (setting.measurement == M_CP||setting.measurement == M_SNR) {
c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR); c = GET_PALTETTE_COLOR(LCD_TRIGGER_COLOR);
@ -1116,7 +1129,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 __TRIGGER_TRACE__
&& setting.trigger_trace == 255
#endif
)
#ifdef __DRAW_LINE__ #ifdef __DRAW_LINE__
|| setting.draw_line || setting.draw_line
#endif #endif

@ -671,6 +671,7 @@ void reset_settings(int m)
setting.trigger_mode = T_MID; setting.trigger_mode = T_MID;
setting.fast_speedup = 0; setting.fast_speedup = 0;
setting.trigger_level = -150.0; setting.trigger_level = -150.0;
setting.trigger_trace = 255;
setting.linearity_step = 0; setting.linearity_step = 0;
// setting.refer = -1; // do not reset reffer when switching modes // setting.refer = -1; // do not reset reffer when switching modes
setting.mute = true; setting.mute = true;
@ -1965,6 +1966,7 @@ void set_external_gain(float external_gain)
void set_trigger_level(float trigger_level) void set_trigger_level(float trigger_level)
{ {
setting.trigger_level = trigger_level; setting.trigger_level = trigger_level;
setting.trigger_trace = 255;
redraw_request |= REDRAW_TRIGGER | REDRAW_CAL_STATUS | REDRAW_AREA; redraw_request |= REDRAW_TRIGGER | REDRAW_CAL_STATUS | REDRAW_AREA;
//dirty = true; // No HW update required, only status panel refresh //dirty = true; // No HW update required, only status panel refresh
} }
@ -5266,7 +5268,9 @@ static volatile int dummy;
#endif #endif
if (MODE_INPUT(setting.mode)) { if (MODE_INPUT(setting.mode)) {
if (RSSI >= setting.trigger_level) { if ((setting.trigger_trace == 255 && RSSI >= setting.trigger_level) ||
( setting.trigger_trace != 255 && RSSI >= measured[setting.trigger_trace][i]))
{
triggered = true; triggered = true;
#ifdef __BEEP__ #ifdef __BEEP__
if (setting.trigger_beep) pwm_start(4000); if (setting.trigger_beep) pwm_start(4000);

70
ui.c

@ -1460,6 +1460,9 @@ const menuitem_t menu_highoutputmode[];
const menuitem_t menu_mode[]; const menuitem_t menu_mode[];
static const menuitem_t menu_modulation[]; static const menuitem_t menu_modulation[];
static const menuitem_t menu_top[]; static const menuitem_t menu_top[];
#ifdef __TRIGGER_TRACE__
static const menuitem_t menu_trigger_level[];
#endif
static const menuitem_t menu_trace[]; static const menuitem_t menu_trace[];
static const menuitem_t menu_marker_trace[]; static const menuitem_t menu_marker_trace[];
static const menuitem_t menu_subtract_trace[]; static const menuitem_t menu_subtract_trace[];
@ -2981,6 +2984,47 @@ static UI_FUNCTION_ADV_CALLBACK(menu_average_acb)
// menu_move_back(true); // menu_move_back(true);
} }
#ifdef __TRIGGER_TRACE__
static UI_FUNCTION_ADV_CALLBACK(menu_trigger_level_acb)
{
(void)item;
if(b){
if (data == 254) {
if (setting.trigger_trace == 255) {
char *format;
if (UNIT_IS_LINEAR(setting.unit))
format = "LEVEL\n\b%.3F%s"; // 5 characters incl u, m, etc...
else
format = "LEVEL\n\b%.1f%s";
plot_printf(b->text, sizeof(b->text), format, setting.trigger_level,unit_string[setting.unit]);
} else
plot_printf(b->text, sizeof(b->text), "LEVEL\n\bTRACE %d", setting.trigger_trace);
return;
}
b->param_1.i = data;
b->icon = (data == setting.trigger_trace) ? BUTTON_ICON_GROUP_CHECKED : BUTTON_ICON_GROUP;
return;
}
if (data == 254) {
menu_push_submenu(menu_trigger_level);
return;
}
setting.trigger_trace = data;
if (data == 255) {
ui_mode_keypad(KM_TRIGGER);
return;
} else {
current_trace = data;
setting.stored[current_trace] = true;
TRACE_ENABLE(1<<current_trace);
set_average(current_trace,AV_TABLE);
menu_push_submenu(menu_limit_select);
return;
}
menu_move_back(false);
}
#endif
static UI_FUNCTION_ADV_CALLBACK(menu_trace_acb) static UI_FUNCTION_ADV_CALLBACK(menu_trace_acb)
{ {
(void)item; (void)item;
@ -3676,6 +3720,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_settings_ham_bands){
return; return;
} }
toggle_hambands(); toggle_hambands();
redraw_request|= REDRAW_AREA;
} }
#endif #endif
@ -4189,6 +4234,16 @@ const menuitem_t menu_marker_modify[] = {
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
#ifdef __TRIGGER_TRACE__
static const menuitem_t menu_trigger_level[] =
{
{ MT_ADV_CALLBACK, 255, "TRIGGER\nLEVEL", menu_trigger_level_acb},
{ MT_ADV_CALLBACK|MT_REPEATS,DATA_STARTS_REPEATS(0,TRACES_MAX),"TRIGGER\nTRACE %d", menu_trigger_level_acb},
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back
};
#endif
#ifdef __LIMITS__ #ifdef __LIMITS__
static const menuitem_t menu_limit_modify[] = static const menuitem_t menu_limit_modify[] =
{ {
@ -4222,7 +4277,7 @@ static const menuitem_t menu_band_modify[] =
static const menuitem_t menu_band_select[] = { static const menuitem_t menu_band_select[] = {
{ MT_ADV_CALLBACK | MT_REPEATS, DATA_STARTS_REPEATS(0,BANDS_MAX), MT_CUSTOM_LABEL, menu_band_select_acb }, { MT_ADV_CALLBACK | MT_REPEATS, DATA_STARTS_REPEATS(0,BANDS_MAX), MT_CUSTOM_LABEL, menu_band_select_acb },
{ MT_ADV_CALLBACK, 0 , "ALTERNATE", menu_multi_trace_acb }, { MT_ADV_CALLBACK, 0 , "ALTERN", menu_multi_trace_acb },
#ifdef __USE_SD_CARD__ #ifdef __USE_SD_CARD__
{ MT_CALLBACK, FMT_BND_FILE, "BANDS"S_RARROW"\nSD", menu_sdcard_cb}, { MT_CALLBACK, FMT_BND_FILE, "BANDS"S_RARROW"\nSD", menu_sdcard_cb},
#ifdef __SD_FILE_BROWSER__ #ifdef __SD_FILE_BROWSER__
@ -4467,9 +4522,6 @@ static const menuitem_t menu_settings3[] =
{ MT_SUBMENU ,0, "HARMONIC", menu_harmonic}, { MT_SUBMENU ,0, "HARMONIC", menu_harmonic},
#endif #endif
// { MT_ADV_CALLBACK | MT_LOW, 0, "ULTRA\nMODE", menu_settings_ultra_acb}, // { MT_ADV_CALLBACK | MT_LOW, 0, "ULTRA\nMODE", menu_settings_ultra_acb},
#ifdef __HAM_BAND__
{ MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands},
#endif
{ MT_SUBMENU, 0, S_RARROW" MORE", menu_settings4}, { MT_SUBMENU, 0, S_RARROW" MORE", menu_settings4},
#else #else
#ifdef __ULTRA__ #ifdef __ULTRA__
@ -4481,9 +4533,6 @@ static const menuitem_t menu_settings3[] =
{ MT_SUBMENU | MT_HIGH,0, "HARMONIC", menu_harmonic}, { MT_SUBMENU | MT_HIGH,0, "HARMONIC", menu_harmonic},
// { MT_ADV_CALLBACK,0, "SPUR\nREMOVAL", menu_harmonic_spur_acb}, // { MT_ADV_CALLBACK,0, "SPUR\nREMOVAL", menu_harmonic_spur_acb},
#endif #endif
#ifdef __HAM_BAND__
{ MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands},
#endif
#endif // TINYSA4 #endif // TINYSA4
{ MT_NONE, 0, NULL, menu_back} // next-> menu_back { MT_NONE, 0, NULL, menu_back} // next-> menu_back
}; };
@ -4530,6 +4579,9 @@ static const menuitem_t menu_settings[] =
#ifdef __SD_CARD_DUMP_FIRMWARE__ #ifdef __SD_CARD_DUMP_FIRMWARE__
{ MT_CALLBACK, FMT_BIN_FILE, "DUMP\nFIRMWARE", menu_sdcard_cb}, { MT_CALLBACK, FMT_BIN_FILE, "DUMP\nFIRMWARE", menu_sdcard_cb},
#endif #endif
#ifdef __HAM_BAND__
{ MT_ADV_CALLBACK, 0, "HAM\nBANDS", menu_settings_ham_bands},
#endif
#ifdef __SD_CARD_LOAD__ #ifdef __SD_CARD_LOAD__
{ MT_CALLBACK, 0 , "LOAD\nCONFIG.INI", menu_load_config_cb}, { MT_CALLBACK, 0 , "LOAD\nCONFIG.INI", menu_load_config_cb},
// { MT_CALLBACK, 1 , "LOAD\nSETTING.INI", menu_load_config_cb}, // { MT_CALLBACK, 1 , "LOAD\nSETTING.INI", menu_load_config_cb},
@ -4788,7 +4840,11 @@ static const menuitem_t menu_trigger[] = {
{ MT_ADV_CALLBACK, T_NORMAL, "NORMAL", menu_trigger_acb}, { MT_ADV_CALLBACK, T_NORMAL, "NORMAL", menu_trigger_acb},
{ MT_ADV_CALLBACK, T_SINGLE, "SINGLE", menu_trigger_acb}, { MT_ADV_CALLBACK, T_SINGLE, "SINGLE", menu_trigger_acb},
// { MT_ADV_CALLBACK, T_DONE, "READY", menu_trigger_acb}, // { MT_ADV_CALLBACK, T_DONE, "READY", menu_trigger_acb},
#ifdef __TRIGGER_TRACE__
{ MT_ADV_CALLBACK, 254, MT_CUSTOM_LABEL, menu_trigger_level_acb},
#else
{ MT_KEYPAD, KM_TRIGGER, "LEVEL\n\b%s", NULL}, { MT_KEYPAD, KM_TRIGGER, "LEVEL\n\b%s", NULL},
#endif
#if 0 #if 0
{ MT_ADV_CALLBACK, T_UP, "EDGE\nUP", menu_trigger_acb}, { MT_ADV_CALLBACK, T_UP, "EDGE\nUP", menu_trigger_acb},
{ MT_ADV_CALLBACK, T_DOWN, "EDGE\nDOWN", menu_trigger_acb}, { MT_ADV_CALLBACK, T_DOWN, "EDGE\nDOWN", menu_trigger_acb},

Loading…
Cancel
Save

Powered by TurnKey Linux.