From f87f94e65a34a9450caa4e88e3d18c33a99ba416 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Tue, 7 Jul 2020 22:47:48 +0300 Subject: [PATCH] getSI4432_RSSI_correction now integer --- sa_core.c | 5 +++-- si4432.c | 6 +++--- si4432.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sa_core.c b/sa_core.c index 5efd722..7ff3620 100644 --- a/sa_core.c +++ b/sa_core.c @@ -1437,7 +1437,8 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking) // Calculate the RSSI correction for later use if (MODE_INPUT(setting.mode)){ // only cases where the value can change on 0 point of sweep if (i == 0) - correct_RSSI_sweep = float_TO_PURE_RSSI(getSI4432_RSSI_correction() + correct_RSSI_sweep = getSI4432_RSSI_correction() + + float_TO_PURE_RSSI( + get_level_offset() + get_attenuation() - get_signal_path_loss() @@ -1447,7 +1448,7 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking) } // -------------------------------- Acquisition loop for one requested frequency covering spur avoidance and vbwsteps ------------------------ - pureRSSI_t RSSI = float_TO_PURE_RSSI(-150.0); + pureRSSI_t RSSI = float_TO_PURE_RSSI(-150); int t = 0; do { int offs = 0,sm; diff --git a/si4432.c b/si4432.c index c7e5893..fd8bf92 100644 --- a/si4432.c +++ b/si4432.c @@ -302,12 +302,12 @@ static RBW_t RBW_choices[] = { {IF_BW(1,0,14), -10, 6207} }; -static float SI4432_RSSI_correction = -120.0; +static pureRSSI_t SI4432_RSSI_correction = float_TO_PURE_RSSI(-120); uint16_t SI4432_force_RBW(int i) { SI4432_Write_Byte(SI4432_IF_FILTER_BW, RBW_choices[i].reg); // Write RBW settings to Si4432 - SI4432_RSSI_correction = ((int)RBW_choices[i].RSSI_correction_x_10-1200)/10.0; // Set RSSI correction + SI4432_RSSI_correction = float_TO_PURE_RSSI(RBW_choices[i].RSSI_correction_x_10)/10 - 120; // Set RSSI correction return RBW_choices[i].RBWx10; // RBW achieved by Si4432 in kHz * 10 } @@ -444,7 +444,7 @@ void SI4432_Fill(int s, int start) #define MINIMUM_WAIT_FOR_RSSI 280 int SI4432_offset_delay = 300; -float getSI4432_RSSI_correction(void){ +pureRSSI_t getSI4432_RSSI_correction(void){ return SI4432_RSSI_correction; }; diff --git a/si4432.h b/si4432.h index ff0367c..1f04ed9 100644 --- a/si4432.h +++ b/si4432.h @@ -114,7 +114,7 @@ void SI4432_Receive(void); void SI4432_Init(void); void SI4432_Drive(int); -float getSI4432_RSSI_correction(void); +pureRSSI_t getSI4432_RSSI_correction(void); pureRSSI_t SI4432_RSSI(uint32_t i, int s); #ifdef __SIMULATION__ float Simulated_SI4432_RSSI(uint32_t i, int s);