diff --git a/sa_core.c b/sa_core.c index cd2631c..83bf53d 100644 --- a/sa_core.c +++ b/sa_core.c @@ -71,8 +71,13 @@ void update_min_max_freq(void) maxFreq = HIGH_MAX_FREQ_MHZ * 1000000; break; case M_GENHIGH: +#if 0 minFreq = 135000000; maxFreq = 4290000000U; +#else + minFreq = 850000000; + maxFreq = 1150000000U; +#endif break; } } @@ -174,7 +179,7 @@ void reset_settings(int m) break; case M_GENHIGH: setting.lo_drive=1; - set_sweep_frequency(ST_CENTER, 300000000); + set_sweep_frequency(ST_CENTER, (minFreq + maxFreq)/2 ); set_sweep_frequency(ST_SPAN, 0); setting.sweep_time_us = 10*ONE_SECOND_TIME; break; @@ -1459,7 +1464,7 @@ case M_GENHIGH: // Direct output from 1 SI4432_Transmit(setting.drive); #endif #ifdef __SI4468__ - SI4463_init_rx(); + SI4463_init_tx(); #endif ADF4351_enable(true); #ifndef TINYSA4_PROTO @@ -1481,6 +1486,10 @@ case M_GENHIGH: // Direct output from 1 void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# steps in between needed if frequency step is largen than maximum rbw) { + if (!MODE_INPUT(setting.mode)) { + vbwSteps = 1; + return; + } if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) { setting.vbw_x10 = (setting.frequency_step)/100; } else { @@ -2079,8 +2088,13 @@ modulation_again: } else if (setting.mode == M_HIGH) { set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode } else if (setting.mode == M_GENHIGH) { - set_freq (ADF4351_LO, lf); // sweep LO, local_IF = 0 in high mode - } +#if 1 // Let SI TX only + set_freq (SI4463_RX, lf); // sweep RX, local_IF = 0 in high mode + local_IF = 0; +#else + set_freq (ADF4351_LO, lf); // sweep LO, local_IF = 0 in high mode +#endif + } // STOP_PROFILE; #endif } diff --git a/si4432.c b/si4432.c index b671a17..4ce4a9d 100644 --- a/si4432.c +++ b/si4432.c @@ -2145,7 +2145,7 @@ uint16_t force_rbw(int f) SI4463_short_start_rx(); // This can cause recalibration SI4463_wait_for_cts(); set_RSSI_comp(); - prev_band = -1; +// prev_band = -1; SI4463_RSSI_correction = float_TO_PURE_RSSI(RBW_choices[f].RSSI_correction_x_10 - 1200)/10; // Set RSSI correction return RBW_choices[f].RBWx10; // RBW achieved by SI4463 in kHz * 10 } @@ -2210,16 +2210,34 @@ void SI4463_set_freq(uint32_t freq) my_microsecond_delay(10); } if ((SI4463_band == prev_band)) { - uint8_t data[] = { + int vco = 2091 + (((freq - 850000000)/1000) * 492) / 200000; + + if (SI4463_in_tx_mode) { + uint8_t data[] = { + 0x37, + (uint8_t) R, // R data[4] + (uint8_t) ((F>>16) & 255), // F2,F1,F0 data[5] .. data[7] + (uint8_t) ((F>> 8) & 255), // F2,F1,F0 data[5] .. data[7] + (uint8_t) ((F ) & 255), // F2,F1,F0 data[5] .. data[7] + (vco>>8) & 0xff, + vco & 0xff, + 0x00, + 0x32 + }; + SI4463_do_api(data, sizeof(data), NULL, 0); + } else { + + uint8_t data[] = { 0x36, (uint8_t) R, // R data[4] (uint8_t) ((F>>16) & 255), // F2,F1,F0 data[5] .. data[7] (uint8_t) ((F>> 8) & 255), // F2,F1,F0 data[5] .. data[7] (uint8_t) ((F ) & 255), // F2,F1,F0 data[5] .. data[7] - 0x09, - 0x66 - }; - SI4463_do_api(data, sizeof(data), NULL, 0); + (vco>>8) & 0xff, + vco & 0xff + }; + SI4463_do_api(data, sizeof(data), NULL, 0); + } SI4463_frequency_changed = true; // SI4463_set_gpio(3,GPIO_LOW); return; @@ -2275,7 +2293,6 @@ void SI4463_set_freq(uint32_t freq) }; SI4463_do_api(data2, sizeof(data2), NULL, 0); // my_microsecond_delay(30000); - prev_band = SI4463_band; } @@ -2305,6 +2322,7 @@ void SI4463_set_freq(uint32_t freq) SI4463_wait_for_cts(); // SI4463_set_gpio(3,GPIO_LOW); SI4463_frequency_changed = true; + prev_band = SI4463_band; } void SI4463_init_rx(void)