Added rssi get_delta, better rssi min graph view

This commit is contained in:
GullCode 2023-03-13 14:03:37 +01:00
parent a7acb37a56
commit f42812c6b4
2 changed files with 15 additions and 5 deletions

View File

@ -36,10 +36,11 @@ namespace ui {
const auto r = screen_rect(); const auto r = screen_rect();
constexpr int rssi_sample_range = 256; 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 rssi_voltage_max = 2.2;
constexpr float adc_voltage_max = 3.3; 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_max = rssi_sample_range * rssi_voltage_max / adc_voltage_max;
constexpr int raw_delta = raw_max - raw_min; constexpr int raw_delta = raw_max - raw_min;
@ -178,6 +179,12 @@ namespace ui {
return max_ ; return max_ ;
} }
int32_t RSSI::get_delta()
{
return max_ - min_ ;
}
void RSSI::set_pitch_rssi(bool enabled) { void RSSI::set_pitch_rssi(bool enabled) {
pitch_rssi_enabled = enabled; pitch_rssi_enabled = enabled;
if (!enabled) baseband::set_pitch_rssi(0, false); if (!enabled) baseband::set_pitch_rssi(0, false);
@ -272,7 +279,7 @@ namespace ui {
painter.draw_vline( painter.draw_vline(
p4, p4,
width_y, width_y,
Color::green()); Color::green() );
} }
} }
@ -281,10 +288,11 @@ namespace ui {
const auto r = screen_rect(); const auto r = screen_rect();
constexpr int rssi_sample_range = 256; 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 rssi_voltage_max = 2.2;
constexpr float adc_voltage_max = 3.3; 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_max = rssi_sample_range * rssi_voltage_max / adc_voltage_max;
constexpr int raw_delta = raw_max - raw_min; constexpr int raw_delta = raw_max - raw_min;
@ -308,4 +316,5 @@ namespace ui {
} }
set_dirty(); set_dirty();
} }
} /* namespace ui */ } /* namespace ui */

View File

@ -49,6 +49,7 @@ public:
int32_t get_min(); int32_t get_min();
int32_t get_avg(); int32_t get_avg();
int32_t get_max(); int32_t get_max();
int32_t get_delta();
void set_vertical_rssi(bool enabled); void set_vertical_rssi(bool enabled);
void set_peak(bool enabled, size_t duration); void set_peak(bool enabled, size_t duration);