From 3ff96c88c7c6155e029f5cf9bbbc9fbbffe09446 Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 30 Aug 2020 17:03:11 +0200 Subject: [PATCH] Removed lowest RBW due to side skirts --- sa_core.c | 2 +- si4432.c | 11 ++++++----- si4432.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sa_core.c b/sa_core.c index 77272fb..9f94394 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3215,7 +3215,7 @@ void self_test(int test) int i = 15; // calibrate low mode power on 30 MHz; test_prepare(i); setting.step_delay = 8000; - for (int j= 0; j < 57; j++ ) { + for (int j= 0; j < SI4432_RBW_count; j++ ) { if (setting.test_argument != 0) j = setting.test_argument; // do_again: diff --git a/si4432.c b/si4432.c index 38193a9..e7e7da1 100644 --- a/si4432.c +++ b/si4432.c @@ -251,11 +251,10 @@ typedef struct { int8_t RSSI_correction_x_10; // Correction * 10 uint16_t RBWx10; // RBW * 10 in kHz }RBW_t; // sizeof(RBW_t) = 4 bytes - -static RBW_t RBW_choices[] = { +RBW_t RBW_choices[] = { // BW register corr freq - {IF_BW(0,5,1),0,26}, - {IF_BW(0,5,2),0,28}, +// {IF_BW(0,5,1),0,26}, +// {IF_BW(0,5,2),0,28}, {IF_BW(0,5,3),3,31}, {IF_BW(0,5,4),-3,32}, {IF_BW(0,5,5),6,37}, @@ -315,6 +314,8 @@ static RBW_t RBW_choices[] = { }; +const int SI4432_RBW_count = ((int)(sizeof(RBW_choices)/sizeof(RBW_t))); + static pureRSSI_t SI4432_RSSI_correction = float_TO_PURE_RSSI(-120); uint16_t SI4432_force_RBW(int i) @@ -327,7 +328,7 @@ uint16_t SI4432_force_RBW(int i) uint16_t SI4432_SET_RBW(uint16_t WISH) { int i; - for (i=0; i < (int)(sizeof(RBW_choices)/sizeof(RBW_t)) - 1; i++) + for (i=0; i < SI4432_RBW_count - 1; i++) if (WISH <= RBW_choices[i].RBWx10) break; return SI4432_force_RBW(i); diff --git a/si4432.h b/si4432.h index 50c9655..6baebb1 100644 --- a/si4432.h +++ b/si4432.h @@ -130,6 +130,7 @@ void SI4432_Set_Frequency ( uint32_t Freq ); uint16_t SI4432_force_RBW(int i); uint16_t SI4432_SET_RBW(uint16_t WISH); +extern const int SI4432_RBW_count; void SI4432_SetReference(int freq); #ifdef __FAST_SWEEP__ void SI4432_Fill(int s, int start);