diff --git a/sa_core.c b/sa_core.c index b835e54..16121bc 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1239,14 +1239,16 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (# actual_rbw_x10 = 8500; #endif - if (setting.spur && actual_rbw_x10 > 3000) - actual_rbw_x10 = 2500; // if spur suppression reduce max rbw to fit within BPF #ifdef __SI4432__ + if (setting.spur && actual_rbw_x10 > 3000) + actual_rbw_x10 = 2500; // if spur suppression reduce max rbw to fit within BPF SI4432_Sel = MODE_SELECT(setting.mode); actual_rbw_x10 = SI4432_SET_RBW(actual_rbw_x10); // see what rbw the SI4432 can realize #endif #ifdef __SI4463__ +// if (setting.spur && actual_rbw_x10 > 3000) // Will depend on BPF width <------------------ TODO ------------------------- +// actual_rbw_x10 = 2500; // if spur suppression reduce max rbw to fit within BPF actual_rbw_x10 = SI4463_SET_RBW(actual_rbw_x10); // see what rbw the SI4432 can realize #endif if (setting.frequency_step > 0 && MODE_INPUT(setting.mode)) { // When doing frequency scanning in input mode @@ -1628,7 +1630,7 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking) local_IF = spur_alternate_IF; #ifdef __SPUR__ } else if (setting.mode== M_LOW && setting.spur){ // If in low input mode and spur reduction is on - if (S_IS_AUTO(setting.below_IF) && lf < 150000000) // if below 150MHz and auto_below_IF + if (S_IS_AUTO(setting.below_IF) /* && lf < 150000000 */ ) // if below 150MHz and auto_below_IF <-------------------TODO --------------------- { // else low/above IF if (setting.spur == 1) setting.below_IF = S_AUTO_ON; // use below IF in first pass @@ -1636,7 +1638,12 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking) setting.below_IF = S_AUTO_OFF; // and above IF in second pass } else { +#ifdef __SI4432__ int32_t spur_offset = actual_rbw_x10 * 100; // Can not use below IF so calculate IF shift that hopefully will kill the spur. +#endif +#ifdef __SI4463__ + int32_t spur_offset = 4* actual_rbw_x10 * 100; // Can not use below IF so calculate IF shift that hopefully will kill the spur. +#endif if (setting.spur == -1) // If second spur pass spur_offset = - spur_offset; // IF shift in the other direction local_IF = local_IF + spur_offset; // apply IF spur shift diff --git a/si4432.c b/si4432.c index 555b2f8..0669f58 100644 --- a/si4432.c +++ b/si4432.c @@ -123,8 +123,7 @@ static void shiftOut(uint8_t val) SI4432_log(val); uint8_t i = 0; do { - if (val & 0x80) - SPI1_SDI_HIGH; + SPI1_SDI_HIGH; SPI1_CLK_HIGH; SPI1_RESET; val<<=1; @@ -987,7 +986,7 @@ void ADF4351_enable_output(void) void ADF4351_set_frequency(int channel, unsigned long freq, int drive) // freq / 10Hz { - freq -= 76000; + freq -= 71000; ADF4351_prep_frequency(channel,freq, drive); //START_PROFILE; ADF4351_Set(channel); @@ -1479,10 +1478,18 @@ int16_t Si446x_RSSI(void) if (SI4432_step_delay) my_microsecond_delay(SI4432_step_delay); again: - SI4463_do_api(data, 2, data, 3); + data[0] = SI446X_CMD_GET_MODEM_STATUS; + data[1] = 0xFF; + +SI4463_do_api(data, 2, data, 3); if (data[2] == 255) goto again; - int16_t rssi = data[2] - 120 * 2; + if (data[2] == 0) + goto again; + volatile int16_t rssi = data[2] - 120 * 2; + if (rssi < -238) + while(1) + rssi = rssi; //STOP_PROFILE; return DEVICE_TO_PURE_RSSI(rssi); }