diff --git a/nanovna.h b/nanovna.h index 858ed16..832587c 100644 --- a/nanovna.h +++ b/nanovna.h @@ -244,6 +244,7 @@ void set_marker_frequency(int m, freq_t f); void set_marker_time(int m, float f); void toggle_sweep(void); void toggle_mute(void); +void toggle_pulse(void); void load_default_properties(void); enum { @@ -977,6 +978,7 @@ typedef struct setting bool mute; // bool bool auto_IF; // bool bool sweep; // bool + bool pulse; // bool uint8_t mode; // enum uint8_t below_IF; // enum diff --git a/sa_core.c b/sa_core.c index 949bcd2..b831d79 100644 --- a/sa_core.c +++ b/sa_core.c @@ -513,6 +513,12 @@ void toggle_tracking_output(void) dirty = true; } +void toggle_pulse(void) +{ + setting.pulse = !setting.pulse; + dirty = true; +} + void toggle_debug_avoid(void) { debug_avoid = !debug_avoid; @@ -2589,18 +2595,28 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) / // --------------------------------- Pulse at start of low output sweep -------------------------- - #ifdef __SI4432__ - if (setting.mode == M_GENLOW && ( setting.frequency_step != 0 || setting.level_sweep != 0.0)) {// pulse high out - SI4432_Sel = SI4432_LO ; + if ((setting.mode == M_GENLOW || (setting.pulse && setting.mode == M_LOW)) && ( setting.frequency_step != 0 || setting.level_sweep != 0.0)) {// pulse high out +#ifdef __SI4432__ + SI4432_Sel = SI4432_LO ; +#endif if (i == 0) { // set_switch_transmit(); - SI4432_Write_Byte(SI4432_GPIO2_CONF, 0x1D) ; // Set GPIO2 output to ground +#ifdef __SI4432__ + SI4432_Write_Byte(SI4432_GPIO2_CONF, 0x1D) ; // Set GPIO2 output to high +#endif +#ifdef __SI4463__ + SI4463_set_gpio(0, SI446X_GPIO_MODE_DRIVE1); +#endif } else if (i == 1) { // set_switch_off(); +#ifdef __SI4432__ SI4432_Write_Byte(SI4432_GPIO2_CONF, 0x1F) ; // Set GPIO2 output to ground +#endif +#ifdef __SI4463__ + SI4463_set_gpio(0, SI446X_GPIO_MODE_DRIVE0); +#endif } } -#endif #ifdef TINYSA4 // ----------------------------- set mixer drive -------------------------------------------- if (setting.lo_drive & 0x04){ diff --git a/si4468.c b/si4468.c index 8a7ec13..9c57ff3 100644 --- a/si4468.c +++ b/si4468.c @@ -1548,7 +1548,7 @@ uint16_t set_rbw(uint16_t WISH) { freq_t SI4463_set_freq(freq_t freq) { -// SI4463_set_gpio(3,GPIO_HIGH); // For measuring duration of set_freq +// SI4463_set_gpio(3,SI446X_GPIO_MODE_DRIVE1); // For measuring duration of set_freq int S = 4 ; // Approx 100 Hz channels SI4463_channel = 0; if (freq >= 822000000 && freq <= 1130000000) { // 822 to 1130MHz @@ -1624,7 +1624,7 @@ freq_t SI4463_set_freq(freq_t freq) SI4463_do_api(data, sizeof(data), NULL, 0); } SI4463_frequency_changed = true; -// SI4463_set_gpio(3,GPIO_LOW); // For measuring duration of set_freq +// SI4463_set_gpio(3,SI446X_GPIO_MODE_DRIVE0); // For measuring duration of set_freq return actual_freq; } #endif @@ -1686,7 +1686,7 @@ freq_t SI4463_set_freq(freq_t freq) else { SI4463_start_rx(SI4463_channel); } -// SI4463_set_gpio(3,GPIO_LOW); // For measuring duration of set_freq +// SI4463_set_gpio(3,SI446X_GPIO_MODE_DRIVE0); // For measuring duration of set_freq SI4463_frequency_changed = true; return actual_freq; } diff --git a/ui_sa.c b/ui_sa.c index 133c187..ac5d26e 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -1689,6 +1689,16 @@ static UI_FUNCTION_ADV_CALLBACK(menu_settings_bpf_acb){ toggle_tracking(); } +static UI_FUNCTION_ADV_CALLBACK(menu_settings_pulse_acb){ + (void)item; + (void)data; + if(b){ + b->icon = setting.pulse ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK; + return; + } + toggle_pulse(); +} + #ifdef __HAM_BAND__ static UI_FUNCTION_ADV_CALLBACK(menu_settings_ham_bands){ (void)item; @@ -2302,6 +2312,7 @@ static const menuitem_t menu_settings3[] = #else { MT_KEYPAD, KM_10MHZ, "CORRECT\nFREQUENCY", "Enter actual l0MHz frequency"}, { MT_KEYPAD, KM_GRIDLINES, "MINIMUM\nGRIDLINES", "Enter minimum horizontal grid divisions"}, + { MT_ADV_CALLBACK, 0, "PULSE\nHIGH", menu_settings_pulse_acb}, #ifdef __USE_SERIAL_CONSOLE__ { MT_SUBMENU, 0, "CONNECTION", menu_connection}, #endif @@ -2422,7 +2433,11 @@ static const menuitem_t menu_settings[] = #endif #ifdef TINYSA4 { MT_SUBMENU | MT_LOW,0, "MIXER\nDRIVE", menu_mixer_drive}, -#else + { MT_ADV_CALLBACK, 0, "PULSE\nHIGH", menu_settings_pulse_acb}, +#ifdef __USE_SERIAL_CONSOLE__ + { MT_SUBMENU, 0, "CONNECTION", menu_connection}, +#endif + #else { MT_SUBMENU | MT_LOW,0, "MIXER\nDRIVE", menu_lo_drive}, #endif { MT_SUBMENU, 0, S_RARROW" MORE", menu_settings2},