Merge pull request #831 from gullradriel/level-app-updates

Level app updates
This commit is contained in:
gullradriel 2023-03-13 15:59:24 +01:00 committed by GitHub
commit 6a61b9528e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 16 deletions

View File

@ -215,7 +215,7 @@ namespace ui {
last_min_rssi = rssi.get_min(); last_min_rssi = rssi.get_min();
last_avg_rssi = rssi.get_avg(); last_avg_rssi = rssi.get_avg();
last_max_rssi = rssi.get_max(); last_max_rssi = rssi.get_max();
freq_stats_rssi.set( "RSSI: "+to_string_dec_int( rssi.get_min() )+"/"+to_string_dec_int( rssi.get_avg() )+"/"+to_string_dec_int( rssi.get_max() )+" db" ); freq_stats_rssi.set( "RSSI: "+to_string_dec_int( rssi.get_min() )+"/"+to_string_dec_int( rssi.get_avg() )+"/"+to_string_dec_int( rssi.get_max() )+" db, dt: "+to_string_dec_int( rssi.get_delta() )+" db" );
} }
} /* on_statistic_updates */ } /* on_statistic_updates */

View File

@ -47,10 +47,8 @@ namespace ui {
~LevelView(); ~LevelView();
void focus() override; void focus() override;
void big_display_freq( int64_t f );
void on_audio_spectrum(const AudioSpectrum* spectrum); void big_display_freq( int64_t f );
const Style style_grey { // level const Style style_grey { // level
.font = font::fixed_8x16, .font = font::fixed_8x16,
@ -143,18 +141,18 @@ namespace ui {
}; };
OptionsField step_mode { OptionsField step_mode {
{ 21 * 8, 1 * 16 }, { 16 * 8, 2 * 16 + 4 },
12, 12,
{ {
} }
}; };
RSSIGraph rssi_graph { // 240x320 => RSSIGraph rssi_graph { // 240x320 =>
{ 0 , 5 * 16 + 4 , 240 - 5 * 8 , 320 - 5 * 16 - 4 }, { 0 , 5 * 16 + 4 , 240 - 5 * 8 , 216 },
}; };
RSSI rssi { // 240x320 => RSSI rssi { // 240x320 =>
{ 240 - 5 * 8 , 5 * 16 + 4 , 5 * 8 , 320 - 5 * 16 - 4 }, { 240 - 5 * 8 , 5 * 16 + 4 , 5 * 8 , 216 },
}; };
@ -164,7 +162,7 @@ namespace ui {
}; };
OptionsField audio_mode { OptionsField audio_mode {
{ 16 * 8, 2 * 16 + 4 }, { 21 * 8, 1 * 16 },
9, 9,
{ {
{"audio off", 0}, {"audio off", 0},
@ -188,7 +186,7 @@ namespace ui {
{ 0 * 8 , 4 * 16 + 4 , 15 * 8, 16 }, { 0 * 8 , 4 * 16 + 4 , 15 * 8, 16 },
}; };
OptionsField peak_mode { OptionsField peak_mode {
{ 44 + 10 * 8, 4 * 16 + 4 }, { 44 + 10 * 8, 4 * 16 + 4 },
10, 10,

View File

@ -51,6 +51,8 @@ options_t freqman_entry_bandwidths[ 4 ] = {
}; };
options_t freqman_entry_steps = { options_t freqman_entry_steps = {
{ "0.1KHz " , 100 },
{ "1KHz " , 1000 },
{ "5KHz (SA AM)" , 5000 }, { "5KHz (SA AM)" , 5000 },
{ "6.25KHz(NFM)" , 6250 }, { "6.25KHz(NFM)" , 6250 },
{ "8.33KHz(AIR)" , 8330 }, { "8.33KHz(AIR)" , 8330 },
@ -68,6 +70,8 @@ options_t freqman_entry_steps = {
}; };
options_t freqman_entry_steps_short = { options_t freqman_entry_steps_short = {
{ "0.1KHz" , 100 },
{ "1KHz" , 1000 },
{ "5KHz" , 5000 }, { "5KHz" , 5000 },
{ "6.25KHz" , 6250 }, { "6.25KHz" , 6250 },
{ "8.33KHz" , 8330 }, { "8.33KHz" , 8330 },

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);