mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Added live frequency view mode
This commit is contained in:
parent
f7c2dde79f
commit
c3971cae32
@ -49,12 +49,39 @@ namespace ui
|
|||||||
receiver_model.set_vga(v_db);
|
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 ;
|
||||||
|
pixel_index ++ ;
|
||||||
|
|
||||||
if (pixel_index == 240) // got an entire waterfall line
|
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 );
|
||||||
|
display.fill_rectangle( { { xpos , 108 } , { 1 , 320 - point } } , { 0 , 0 , 0 } );
|
||||||
|
display.fill_rectangle( { { xpos , 320 - point } , { 1 , point } } , { 0 , 0 , 255 } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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
|
pixel_index = 0; // Start New cascade line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +113,7 @@ namespace ui
|
|||||||
if (bins_Hz_size >= marker_pixel_step) // new pixel fullfilled
|
if (bins_Hz_size >= marker_pixel_step) // new pixel fullfilled
|
||||||
{
|
{
|
||||||
if (min_color_power < max_power)
|
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
|
else
|
||||||
add_spectrum_pixel(0); // Filtered out, show black
|
add_spectrum_pixel(0); // Filtered out, show black
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ namespace ui
|
|||||||
void on_range_changed();
|
void on_range_changed();
|
||||||
void on_lna_changed(int32_t v_db);
|
void on_lna_changed(int32_t v_db);
|
||||||
void on_vga_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 PlotMarker(rf::Frequency pos);
|
||||||
void load_Presets();
|
void load_Presets();
|
||||||
void txtline_process(std::string& line);
|
void txtline_process(std::string& line);
|
||||||
@ -89,9 +89,11 @@ namespace ui
|
|||||||
uint8_t min_color_power { 0 };
|
uint8_t min_color_power { 0 };
|
||||||
uint32_t pixel_index { 0 };
|
uint32_t pixel_index { 0 };
|
||||||
std::array<Color, 240> spectrum_row = { 0 };
|
std::array<Color, 240> spectrum_row = { 0 };
|
||||||
|
std::array<int16_t, 240> spectrum_data = { 0 };
|
||||||
ChannelSpectrumFIFO* fifo { nullptr };
|
ChannelSpectrumFIFO* fifo { nullptr };
|
||||||
uint8_t max_power = 0;
|
uint8_t max_power = 0;
|
||||||
int32_t steps = 250 ; // default of 250 Mhz steps
|
int32_t steps = 250 ; // default of 250 Mhz steps
|
||||||
|
bool live_frequency_view = true ;
|
||||||
|
|
||||||
Labels labels{
|
Labels labels{
|
||||||
{{0, 0}, "MIN: MAX: LNA VGA ", Color::light_grey()},
|
{{0, 0}, "MIN: MAX: LNA VGA ", Color::light_grey()},
|
||||||
|
2
hackrf
2
hackrf
@ -1 +1 @@
|
|||||||
Subproject commit ae71cb5b7ae29eb9bddf359896a66aaa88b9dfac
|
Subproject commit ebe1ca003a4a04ead06407a4bca6a4f7e6b6c1f3
|
Loading…
Reference in New Issue
Block a user