mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-25 07:19:28 -05:00
Merge pull request #880 from gullradriel/looking-test
Looking glass minor upgrade
This commit is contained in:
commit
27f70cb9fe
@ -49,12 +49,40 @@ namespace ui
|
||||
receiver_model.set_vga(v_db);
|
||||
}
|
||||
|
||||
void GlassView::add_spectrum_pixel(Color color)
|
||||
void GlassView::add_spectrum_pixel(int16_t color)
|
||||
{
|
||||
spectrum_row[pixel_index++] = color;
|
||||
spectrum_row[pixel_index] = spectrum_rgb3_lut[color] ;
|
||||
spectrum_data[pixel_index] = ( 3 * spectrum_data[pixel_index] + color ) / 4 ; // smoothing
|
||||
pixel_index ++ ;
|
||||
|
||||
if (pixel_index == 240) // got an entire waterfall line
|
||||
{
|
||||
display.draw_pixels({{0, display.scroll(1)}, {240, 1}}, spectrum_row); // new line at top, one less var, speedier
|
||||
if( live_frequency_view )
|
||||
{
|
||||
constexpr int rssi_sample_range = 256;
|
||||
//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 = 0 ;
|
||||
constexpr int raw_max = rssi_sample_range * rssi_voltage_max / adc_voltage_max;
|
||||
constexpr int raw_delta = raw_max - raw_min;
|
||||
const range_t<int> y_max_range { 0 , 320 - 108 };
|
||||
|
||||
//drawing
|
||||
//display.fill_rectangle( { { 0 , 108 } , { 240 , 320 - 108 } } , { 0 , 0 , 0 } );
|
||||
for( uint16_t xpos = 0 ; xpos < 240 ; xpos ++ )
|
||||
{
|
||||
int16_t point = y_max_range.clip( ( ( spectrum_data[ xpos ] - raw_min ) * ( 320 - 108 ) ) / raw_delta );
|
||||
uint8_t color_gradient = (point * 255) / 212 ;
|
||||
display.fill_rectangle( { { xpos , 108 } , { 1 , 320 - point } } , { 0 , 0 , 0 } );
|
||||
display.fill_rectangle( { { xpos , 320 - point } , { 1 , point } } , { color_gradient , 0 , uint8_t( 255 - color_gradient ) } );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
display.draw_pixels({{0, display.scroll(1)}, {240, 1}}, spectrum_row); // new line at top, one less var, speedier
|
||||
}
|
||||
pixel_index = 0; // Start New cascade line
|
||||
}
|
||||
}
|
||||
@ -86,7 +114,7 @@ namespace ui
|
||||
if (bins_Hz_size >= marker_pixel_step) // new pixel fullfilled
|
||||
{
|
||||
if (min_color_power < max_power)
|
||||
add_spectrum_pixel(spectrum_rgb3_lut[max_power]); // Pixel will represent max_power
|
||||
add_spectrum_pixel(max_power); // Pixel will represent max_power
|
||||
else
|
||||
add_spectrum_pixel(0); // Filtered out, show black
|
||||
|
||||
@ -185,6 +213,7 @@ namespace ui
|
||||
&field_vga,
|
||||
&text_range,
|
||||
&steps_config,
|
||||
&view_config,
|
||||
&filter_config,
|
||||
&field_rf_amp,
|
||||
&range_presets,
|
||||
@ -281,6 +310,24 @@ namespace ui
|
||||
steps = v ;
|
||||
};
|
||||
|
||||
view_config.set_selected_index(0); //default spectrum
|
||||
view_config.on_change = [this](size_t n, OptionsField::value_t v)
|
||||
{
|
||||
(void)n;
|
||||
live_frequency_view = v ;
|
||||
if( v )
|
||||
{
|
||||
display.scroll_disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
display.scroll_set_area(109, 319); // Restart scroll on the correct coordinates
|
||||
}
|
||||
// clear between changes
|
||||
display.fill_rectangle( { { 0 , 108 } , { 240 , 320 - 108 } } , { 0 , 0 , 0 } );
|
||||
};
|
||||
|
||||
|
||||
range_presets.on_change = [this](size_t n, OptionsField::value_t v)
|
||||
{
|
||||
(void)n;
|
||||
|
@ -72,7 +72,7 @@ namespace ui
|
||||
void on_range_changed();
|
||||
void on_lna_changed(int32_t v_db);
|
||||
void on_vga_changed(int32_t v_db);
|
||||
void add_spectrum_pixel(Color color);
|
||||
void add_spectrum_pixel(int16_t color);
|
||||
void PlotMarker(rf::Frequency pos);
|
||||
void load_Presets();
|
||||
void txtline_process(std::string& line);
|
||||
@ -89,16 +89,18 @@ namespace ui
|
||||
uint8_t min_color_power { 0 };
|
||||
uint32_t pixel_index { 0 };
|
||||
std::array<Color, 240> spectrum_row = { 0 };
|
||||
std::array<int16_t, 240> spectrum_data = { 0 };
|
||||
ChannelSpectrumFIFO* fifo { nullptr };
|
||||
uint8_t max_power = 0;
|
||||
int32_t steps = 250 ; // default of 250 Mhz steps
|
||||
bool live_frequency_view = false ;
|
||||
|
||||
Labels labels{
|
||||
{{0, 0}, "MIN: MAX: LNA VGA ", Color::light_grey()},
|
||||
{{0, 1 * 16}, " RANGE: FILTER: AMP:", Color::light_grey()},
|
||||
{{0, 2 * 16}, "PRESET:", Color::light_grey()},
|
||||
{{0, 3 * 16}, "MARKER: MHz +/- MHz", Color::light_grey()},
|
||||
{{0, 4 * 16}, "RESOLUTION: STEPS:", Color::light_grey()}
|
||||
{{0, 4 * 16}, "RESOLUTION: STEPS:", Color::light_grey()}
|
||||
};
|
||||
|
||||
NumberField field_frequency_min {
|
||||
@ -130,7 +132,7 @@ namespace ui
|
||||
""};
|
||||
|
||||
OptionsField steps_config{
|
||||
{ 22 * 8, 4 * 16},
|
||||
{ 21 * 8, 4 * 16},
|
||||
4,
|
||||
{
|
||||
{"1", 1},
|
||||
@ -138,7 +140,14 @@ namespace ui
|
||||
{"100", 100},
|
||||
{"250", 250},
|
||||
{"500", 500},
|
||||
{"1000", 1000},
|
||||
}};
|
||||
|
||||
OptionsField view_config{
|
||||
{25 * 8, 4 * 16},
|
||||
5,
|
||||
{
|
||||
{"SPCTR", false },
|
||||
{"LVL-V", true },
|
||||
}};
|
||||
|
||||
OptionsField filter_config{
|
||||
|
2
hackrf
2
hackrf
@ -1 +1 @@
|
||||
Subproject commit ae71cb5b7ae29eb9bddf359896a66aaa88b9dfac
|
||||
Subproject commit ebe1ca003a4a04ead06407a4bca6a4f7e6b6c1f3
|
Loading…
Reference in New Issue
Block a user