From 84572dec562ffea74523878f2b18fc8da09bedc3 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Wed, 8 Jul 2020 10:56:54 +0300 Subject: [PATCH] get_signal_path_loss correction use integer values --- nanovna.h | 2 +- sa_core.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nanovna.h b/nanovna.h index 64f265c..4e11dfc 100644 --- a/nanovna.h +++ b/nanovna.h @@ -887,7 +887,7 @@ typedef int16_t pureRSSI_t; // External programm zero level settings (need decrease on this value -) #define EXT_ZERO_LEVEL (128) #define DEVICE_TO_PURE_RSSI(rssi) ((rssi)<<4) -#define float_TO_PURE_RSSI(rssi) ((rssi)*32.0) +#define float_TO_PURE_RSSI(rssi) ((rssi)*32) #define PURE_TO_float(rssi) ((rssi)/32.0) extern uint16_t actual_rbw_x10; diff --git a/sa_core.c b/sa_core.c index 7642d4e..78dfdbb 100644 --- a/sa_core.c +++ b/sa_core.c @@ -350,14 +350,14 @@ float get_attenuation(void) return(setting.attenuate); } -static float get_signal_path_loss(void){ +static pureRSSI_t get_signal_path_loss(void){ #ifdef __ULTRA__ if (setting.mode == M_ULTRA) - return -15; // Loss in dB, -9.5 for v0.1, -12.5 for v0.2 + return float_TO_PURE_RSSI(-15); // Loss in dB, -9.5 for v0.1, -12.5 for v0.2 #endif if (setting.mode == M_LOW) - return -5.5; // Loss in dB, -9.5 for v0.1, -12.5 for v0.2 - return +7; // Loss in dB (+ is gain) + return float_TO_PURE_RSSI(-5.5); // Loss in dB, -9.5 for v0.1, -12.5 for v0.2 + return float_TO_PURE_RSSI(+7); // Loss in dB (+ is gain) } static const int drive_dBm [16] = {-38,-35,-33,-30,-27,-24,-21,-19,-7,-4,-2, 1, 4, 7, 10, 13}; @@ -1438,10 +1438,10 @@ pureRSSI_t perform(bool break_on_operation, int i, uint32_t f, int tracking) if (MODE_INPUT(setting.mode)){ // only cases where the value can change on 0 point of sweep if (i == 0){ correct_RSSI = getSI4432_RSSI_correction() + - get_signal_path_loss() + float_TO_PURE_RSSI( + get_level_offset() + get_attenuation() - - get_signal_path_loss() - setting.offset); } if (i == 0 || setting.frequency_step != 0)