From f42812c6b4f29fa9656fd56ad7e913289e91d8ec Mon Sep 17 00:00:00 2001 From: GullCode Date: Mon, 13 Mar 2023 14:03:37 +0100 Subject: [PATCH] Added rssi get_delta, better rssi min graph view --- firmware/application/ui/ui_rssi.cpp | 19 ++++++++++++++----- firmware/application/ui/ui_rssi.hpp | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/firmware/application/ui/ui_rssi.cpp b/firmware/application/ui/ui_rssi.cpp index 674279da..8c4f483a 100644 --- a/firmware/application/ui/ui_rssi.cpp +++ b/firmware/application/ui/ui_rssi.cpp @@ -36,10 +36,11 @@ namespace ui { const auto r = screen_rect(); constexpr int rssi_sample_range = 256; - constexpr float rssi_voltage_min = 0.4; + //constexpr float rssi_voltage_min = 0.4; constexpr float rssi_voltage_max = 2.2; constexpr float adc_voltage_max = 3.3; - constexpr int raw_min = rssi_sample_range * rssi_voltage_min / adc_voltage_max; + //constexpr int raw_min = rssi_sample_range * rssi_voltage_min / adc_voltage_max; + constexpr int raw_min = 0 ; constexpr int raw_max = rssi_sample_range * rssi_voltage_max / adc_voltage_max; constexpr int raw_delta = raw_max - raw_min; @@ -178,6 +179,12 @@ namespace ui { return max_ ; } + int32_t RSSI::get_delta() + { + return max_ - min_ ; + } + + void RSSI::set_pitch_rssi(bool enabled) { pitch_rssi_enabled = enabled; if (!enabled) baseband::set_pitch_rssi(0, false); @@ -272,7 +279,7 @@ namespace ui { painter.draw_vline( p4, width_y, - Color::green()); + Color::green() ); } } @@ -281,10 +288,11 @@ namespace ui { const auto r = screen_rect(); constexpr int rssi_sample_range = 256; - constexpr float rssi_voltage_min = 0.4; + //constexpr float rssi_voltage_min = 0.4; constexpr float rssi_voltage_max = 2.2; constexpr float adc_voltage_max = 3.3; - constexpr int raw_min = rssi_sample_range * rssi_voltage_min / adc_voltage_max; + //constexpr int raw_min = rssi_sample_range * rssi_voltage_min / adc_voltage_max; + constexpr int raw_min = 0 ; constexpr int raw_max = rssi_sample_range * rssi_voltage_max / adc_voltage_max; constexpr int raw_delta = raw_max - raw_min; @@ -308,4 +316,5 @@ namespace ui { } set_dirty(); } + } /* namespace ui */ diff --git a/firmware/application/ui/ui_rssi.hpp b/firmware/application/ui/ui_rssi.hpp index f7783529..f3062e44 100644 --- a/firmware/application/ui/ui_rssi.hpp +++ b/firmware/application/ui/ui_rssi.hpp @@ -49,6 +49,7 @@ public: int32_t get_min(); int32_t get_avg(); int32_t get_max(); + int32_t get_delta(); void set_vertical_rssi(bool enabled); void set_peak(bool enabled, size_t duration);