mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-14 22:37:54 +00:00
Prepare for display orientation part 1 (#2661)
This commit is contained in:
@@ -170,7 +170,7 @@ class BLECommView : public View {
|
||||
"-"};
|
||||
|
||||
Console console{
|
||||
{0, 4 * 16, 240, 240}};
|
||||
{0, 4 * 16, ui::screen_width, ui::screen_height - 80}};
|
||||
|
||||
std::string str_log{""};
|
||||
bool logging{false};
|
||||
|
@@ -341,18 +341,18 @@ class BLERxView : public View {
|
||||
true};
|
||||
|
||||
// Console console{
|
||||
// {0, 10 * 8, 240, 240}};
|
||||
// {0, 10 * 8, screen_height, screen_height-80}};
|
||||
|
||||
Button button_clear_list{
|
||||
{2 * 8, 320 - (16 + 32), 7 * 8, 32},
|
||||
{2 * 8, screen_height - (16 + 32), 7 * 8, 32},
|
||||
"Clear"};
|
||||
|
||||
Button button_save_list{
|
||||
{11 * 8, 320 - (16 + 32), 11 * 8, 32},
|
||||
{11 * 8, screen_height - (16 + 32), 11 * 8, 32},
|
||||
"Export CSV"};
|
||||
|
||||
Button button_switch{
|
||||
{240 - 6 * 8, 320 - (16 + 32), 4 * 8, 32},
|
||||
{screen_width - 6 * 8, screen_height - (16 + 32), 4 * 8, 32},
|
||||
"Tx"};
|
||||
|
||||
std::string str_log{""};
|
||||
|
@@ -288,10 +288,10 @@ class BLETxView : public View {
|
||||
{{0 * 8, 9 * 16}, "Packet Data:", Theme::getInstance()->fg_light->foreground}};
|
||||
|
||||
Console console{
|
||||
{0, 9 * 18, 240, 240}};
|
||||
{0, 9 * 18, screen_width, screen_height - 80}};
|
||||
|
||||
TextViewer dataEditView{
|
||||
{0, 9 * 18, 240, 240}};
|
||||
{0, 9 * 18, screen_width, screen_height - 80}};
|
||||
|
||||
Button button_clear_marked{
|
||||
{1 * 8, 14 * 16, 13 * 8, 3 * 8},
|
||||
|
@@ -110,7 +110,7 @@ class SoundBoardView : public View {
|
||||
{0, 29 * 8, 30 * 8, 16}};
|
||||
|
||||
MenuView menu_view{
|
||||
{0, 0, 240, 175},
|
||||
{0, 0, screen_width, 175},
|
||||
true};
|
||||
Text text_empty{
|
||||
{7 * 8, 12 * 8, 16 * 8, 16},
|
||||
|
@@ -6,6 +6,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/*
|
||||
TODO: Now it is dyn width. There should be an algorithm to fill the menu based on it's size.
|
||||
*/
|
||||
|
||||
namespace ui {
|
||||
class AboutView : public View {
|
||||
public:
|
||||
@@ -22,11 +26,11 @@ class AboutView : public View {
|
||||
uint16_t frame_sync_count{0};
|
||||
void on_frame_sync();
|
||||
MenuView menu_view{
|
||||
{0, 0, 240, 264},
|
||||
{0, 0, screen_width, screen_height - 56},
|
||||
true};
|
||||
|
||||
Button button_ok{
|
||||
{240 / 3, 270, 240 / 3, 24},
|
||||
{screen_width / 3, screen_height - 50, screen_width / 3, 24},
|
||||
"OK",
|
||||
};
|
||||
|
||||
|
@@ -409,7 +409,7 @@ ADSBRxView::ADSBRxView(NavigationView& nav) {
|
||||
&status_good_frame,
|
||||
&field_volume});
|
||||
|
||||
recent_entries_view.set_parent_rect({0, 16, 240, 272});
|
||||
recent_entries_view.set_parent_rect({0, 16, screen_width, 272});
|
||||
recent_entries_view.on_select = [this, &nav](const AircraftRecentEntry& entry) {
|
||||
detail_key = entry.key();
|
||||
details_view = nav.push<ADSBRxDetailsView>(entry);
|
||||
|
@@ -247,8 +247,8 @@ APRSTableView::APRSTableView(NavigationView& nav, Rect parent_rec)
|
||||
|
||||
details_view.hidden(true);
|
||||
|
||||
recent_entries_view.set_parent_rect({0, 0, 240, 280});
|
||||
details_view.set_parent_rect({0, 0, 240, 280});
|
||||
recent_entries_view.set_parent_rect({0, 0, screen_width, screen_width - 40});
|
||||
details_view.set_parent_rect({0, 0, screen_width, screen_width - 40});
|
||||
|
||||
recent_entries_view.on_select = [this](const APRSRecentEntry& entry) {
|
||||
this->on_show_detail(entry);
|
||||
|
@@ -134,7 +134,7 @@ class APRSDetailsView : public View {
|
||||
bool send_updates{false};
|
||||
|
||||
Console console{
|
||||
{0, 0 * 16, 240, 224}};
|
||||
{0, 0 * 16, screen_width, 224}};
|
||||
|
||||
Button button_done{
|
||||
{160, 14 * 16, 8 * 8, 3 * 16},
|
||||
@@ -249,7 +249,7 @@ class APRSRxView : public View {
|
||||
4};
|
||||
|
||||
Console console{
|
||||
{0, 2 * 16, 240, 240}};
|
||||
{0, 2 * 16, screen_width, screen_height - 80}};
|
||||
|
||||
std::unique_ptr<APRSLogger> logger{};
|
||||
};
|
||||
@@ -265,7 +265,7 @@ class APRSRXView : public View {
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
Rect view_rect = {0, 3 * 8, 240, 280};
|
||||
Rect view_rect = {0, 3 * 8, screen_width, screen_height - 40};
|
||||
|
||||
APRSRxView view_stream{nav_, view_rect};
|
||||
APRSTableView view_table{nav_, view_rect};
|
||||
|
@@ -189,7 +189,7 @@ class BHTView : public View {
|
||||
|
||||
tx_modes tx_mode = IDLE;
|
||||
|
||||
Rect view_rect = {0, 3 * 8, 240, 176};
|
||||
Rect view_rect = {0, 3 * 8, screen_width, 176};
|
||||
|
||||
XylosView view_xylos{view_rect};
|
||||
EPARView view_EPAR{view_rect};
|
||||
|
@@ -42,7 +42,7 @@ class BMPFileViewer : public View {
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
std::filesystem::path path_{};
|
||||
BMPViewer bmp{{0, 0, 240, 320}};
|
||||
BMPViewer bmp{{0, 0, screen_width, screen_height}};
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
@@ -78,11 +78,11 @@ class BTLERxView : public View {
|
||||
nav_};
|
||||
|
||||
Button button_modem_setup{
|
||||
{240 - 12 * 8, 1 * 16, 96, 24},
|
||||
{screen_width - 12 * 8, 1 * 16, 96, 24},
|
||||
"Modem setup"};
|
||||
|
||||
Console console{
|
||||
{0, 4 * 16, 240, 240}};
|
||||
{0, 4 * 16, screen_width, screen_height - 80}};
|
||||
|
||||
MessageHandlerRegistration message_handler_packet{
|
||||
Message::ID::AFSKData,
|
||||
|
@@ -202,10 +202,10 @@ RegistersView::RegistersView(
|
||||
};
|
||||
button_done.on_select = [&nav](Button&) { nav.pop(); };
|
||||
|
||||
registers_widget.set_parent_rect({0, 48, 240, 192});
|
||||
registers_widget.set_parent_rect({0, 48, screen_width, 192});
|
||||
registers_widget.set_page(0);
|
||||
|
||||
text_title.set_parent_rect({(240 - static_cast<int>(title.size()) * 8) / 2, 16,
|
||||
text_title.set_parent_rect({(screen_width - static_cast<int>(title.size()) * 8) / 2, 16,
|
||||
static_cast<int>(title.size()) * 8, 16});
|
||||
text_title.set(title);
|
||||
|
||||
@@ -482,7 +482,7 @@ DebugPmemView::DebugPmemView(NavigationView& nav)
|
||||
: registers_widget(RegistersWidgetConfig{CT_PMEM, PMEM_SIZE_BYTES, page_size, 8}) {
|
||||
add_children({®isters_widget, &text_checksum, &text_checksum2, &button_ok});
|
||||
|
||||
registers_widget.set_parent_rect({0, 32, 240, 192});
|
||||
registers_widget.set_parent_rect({0, 32, screen_width, 192});
|
||||
|
||||
text_checksum.set("Size: " + to_string_dec_uint(portapack::persistent_memory::data_size(), 3) + " CRC: " + to_string_hex(portapack::persistent_memory::pmem_stored_checksum(), 8));
|
||||
text_checksum2.set("Calculated CRC: " + to_string_hex(portapack::persistent_memory::pmem_calculated_checksum(), 8));
|
||||
|
@@ -283,7 +283,7 @@ class DebugMemoryDumpView : public View {
|
||||
"Write"};
|
||||
|
||||
Button button_done{
|
||||
{128, 240, 96, 24},
|
||||
{128, screen_height - 80, 96, 24},
|
||||
"Done"};
|
||||
|
||||
Labels labels{
|
||||
@@ -332,7 +332,7 @@ class DebugPmemView : public View {
|
||||
Text text_checksum2{{16, 248, 208, 16}};
|
||||
|
||||
Button button_ok{
|
||||
{240 / 3, 270, 240 / 3, 24},
|
||||
{screen_width / 3, 270, screen_width / 3, 24},
|
||||
"OK",
|
||||
};
|
||||
|
||||
@@ -364,7 +364,7 @@ public:
|
||||
|
||||
private:
|
||||
Console console {
|
||||
{ 8, 16, 224, 240 }
|
||||
{ 8, 16, 224, screen_height-80 }
|
||||
};
|
||||
|
||||
Button button_exit {
|
||||
|
@@ -124,7 +124,7 @@ class EncodersConfigView : public View {
|
||||
""};
|
||||
|
||||
Waveform waveform{
|
||||
{0, 17 * 8, 240, 32},
|
||||
{0, 17 * 8, screen_width, 32},
|
||||
waveform_buffer,
|
||||
0,
|
||||
0,
|
||||
@@ -201,7 +201,7 @@ class EncodersView : public View {
|
||||
void start_tx(const bool scan);
|
||||
void on_tx_progress(const uint32_t progress, const bool done);
|
||||
|
||||
Rect view_rect = {0, 4 * 8, 240, 168};
|
||||
Rect view_rect = {0, 4 * 8, screen_width, 168};
|
||||
|
||||
EncodersConfigView view_config{nav_, view_rect};
|
||||
EncodersScanView view_scan{nav_, view_rect};
|
||||
|
@@ -84,7 +84,7 @@ class ExternalModuleView : public View {
|
||||
Text text_app5_name{{24, 160, 200, 16}};
|
||||
|
||||
Button dummy{
|
||||
{240, 0, 0, 0},
|
||||
{screen_width, 0, 0, 0},
|
||||
""};
|
||||
|
||||
SignalToken signal_token_tick_second{};
|
||||
|
@@ -455,7 +455,7 @@ FileLoadView::FileLoadView(
|
||||
add_children({&menu_view});
|
||||
|
||||
// Resize menu view to fill screen
|
||||
menu_view.set_parent_rect({0, 3 * 8, 240, 29 * 8});
|
||||
menu_view.set_parent_rect({0, 3 * 8, screen_width, 29 * 8});
|
||||
|
||||
refresh_list();
|
||||
|
||||
|
@@ -125,7 +125,7 @@ class FileManBaseView : public View {
|
||||
};
|
||||
|
||||
MenuView menu_view{
|
||||
{0, 2 * 8, 240, 26 * 8},
|
||||
{0, 2 * 8, screen_width, 26 * 8},
|
||||
true};
|
||||
|
||||
Button button_exit{
|
||||
|
@@ -80,7 +80,7 @@ FlashUtilityView::FlashUtilityView(NavigationView& nav)
|
||||
add_children({&labels,
|
||||
&menu_view});
|
||||
|
||||
menu_view.set_parent_rect({0, 3 * 8, 240, 33 * 8});
|
||||
menu_view.set_parent_rect({0, 3 * 8, screen_width, 33 * 8});
|
||||
|
||||
ensure_directory(apps_dir);
|
||||
ensure_directory(firmware_dir);
|
||||
|
@@ -60,7 +60,7 @@ class FlashUtilityView : public View {
|
||||
{{4, 4}, "Select firmware to flash:", Theme::getInstance()->bg_darkest->foreground}};
|
||||
|
||||
MenuView menu_view{
|
||||
{0, 2 * 8, 240, 26 * 8},
|
||||
{0, 2 * 8, screen_width, 26 * 8},
|
||||
true};
|
||||
|
||||
std::filesystem::path extract_tar(std::filesystem::path::string_type path, ui::Painter& painter); // extracts the tar file, and returns the firmware.bin path from it. empty string if no fw
|
||||
|
@@ -34,6 +34,7 @@ namespace ui {
|
||||
|
||||
IQTrimView::IQTrimView(NavigationView& nav)
|
||||
: nav_{nav} {
|
||||
power_buckets_.resize(screen_width);
|
||||
add_children({
|
||||
&labels,
|
||||
&field_path,
|
||||
|
@@ -96,7 +96,7 @@ class IQTrimView : public View {
|
||||
|
||||
std::filesystem::path path_{};
|
||||
Optional<iq::CaptureInfo> info_{};
|
||||
std::array<iq::PowerBuckets::Bucket, screen_width> power_buckets_{};
|
||||
std::vector<iq::PowerBuckets::Bucket> power_buckets_{};
|
||||
TrimProgressUI progress_ui{};
|
||||
|
||||
Labels labels{
|
||||
|
@@ -94,10 +94,10 @@ void GlassView::get_max_power(const ChannelSpectrum& spectrum, uint8_t bin, uint
|
||||
rf::Frequency GlassView::get_freq_from_bin_pos(uint8_t pos) {
|
||||
rf::Frequency freq_at_pos = 0;
|
||||
if (mode == LOOKING_GLASS_SINGLEPASS) {
|
||||
// starting from the middle, minus 8 ignored bin on each side. Since pos is [-120,120] after the (pos - 120), it's divided by SCREEN_W(240)/2 => 120
|
||||
freq_at_pos = f_center_ini + ((pos - 120) * ((looking_glass_range - ((16 * looking_glass_range) / SPEC_NB_BINS)) / 2)) / (SCREEN_W / 2);
|
||||
// starting from the middle, minus 8 ignored bin on each side. Since pos is [-120,120] after the (pos - 120), it's divided by screen_width(240)/2 => 120
|
||||
freq_at_pos = f_center_ini + ((pos - 120) * ((looking_glass_range - ((16 * looking_glass_range) / SPEC_NB_BINS)) / 2)) / (screen_width / 2);
|
||||
} else
|
||||
freq_at_pos = f_min + (2 * offset * each_bin_size) + (pos * looking_glass_range) / SCREEN_W;
|
||||
freq_at_pos = f_min + (2 * offset * each_bin_size) + (pos * looking_glass_range) / screen_width;
|
||||
return freq_at_pos;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ void GlassView::reset_live_view() {
|
||||
|
||||
// Clear screen in peak mode.
|
||||
if (live_frequency_view == 2)
|
||||
display.fill_rectangle({{0, 108 + 16}, {SCREEN_W, SCREEN_H - (108 + 16)}}, {0, 0, 0});
|
||||
display.fill_rectangle({{0, 108 + 16}, {screen_width, screen_height - (108 + 16)}}, {0, 0, 0});
|
||||
}
|
||||
|
||||
void GlassView::add_spectrum_pixel(uint8_t power) {
|
||||
@@ -130,7 +130,7 @@ void GlassView::add_spectrum_pixel(uint8_t power) {
|
||||
spectrum_data[pixel_index] = (live_frequency_integrate * spectrum_data[pixel_index] + power) / (live_frequency_integrate + 1); // smoothing
|
||||
pixel_index++;
|
||||
|
||||
if (pixel_index == SCREEN_W) // got an entire waterfall line
|
||||
if (pixel_index == screen_width) // got an entire waterfall line
|
||||
{
|
||||
if (live_frequency_view > 0) {
|
||||
constexpr int rssi_sample_range = SPEC_NB_BINS;
|
||||
@@ -140,22 +140,22 @@ void GlassView::add_spectrum_pixel(uint8_t power) {
|
||||
constexpr int raw_min = rssi_sample_range * rssi_voltage_min / adc_voltage_max;
|
||||
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 + 16)};
|
||||
const range_t<int> y_max_range{0, screen_height - (108 + 16)};
|
||||
|
||||
// drawing and keeping track of max freq
|
||||
for (uint16_t xpos = 0; xpos < SCREEN_W; xpos++) {
|
||||
for (uint16_t xpos = 0; xpos < screen_width; xpos++) {
|
||||
// save max powerwull freq
|
||||
if (spectrum_data[xpos] > max_freq_power) {
|
||||
max_freq_power = spectrum_data[xpos];
|
||||
max_freq_hold = get_freq_from_bin_pos(xpos);
|
||||
}
|
||||
int16_t point = y_max_range.clip(((spectrum_data[xpos] - raw_min) * (320 - (108 + 16))) / raw_delta);
|
||||
int16_t point = y_max_range.clip(((spectrum_data[xpos] - raw_min) * (screen_height - (108 + 16))) / raw_delta);
|
||||
uint8_t color_gradient = (point * 255) / 212;
|
||||
// clear if not in peak view
|
||||
if (live_frequency_view != 2) {
|
||||
display.fill_rectangle({{xpos, 108 + 16}, {1, SCREEN_H - point}}, {0, 0, 0});
|
||||
display.fill_rectangle({{xpos, 108 + 16}, {1, screen_height - point}}, {0, 0, 0});
|
||||
}
|
||||
display.fill_rectangle({{xpos, SCREEN_H - point}, {1, point}}, {color_gradient, 0, uint8_t(255 - color_gradient)});
|
||||
display.fill_rectangle({{xpos, screen_height - point}, {1, point}}, {color_gradient, 0, uint8_t(255 - color_gradient)});
|
||||
}
|
||||
if (last_max_freq != max_freq_hold) {
|
||||
last_max_freq = max_freq_hold;
|
||||
@@ -163,7 +163,7 @@ void GlassView::add_spectrum_pixel(uint8_t power) {
|
||||
}
|
||||
plot_marker(marker_pixel_index);
|
||||
} else {
|
||||
display.draw_pixels({{0, display.scroll(1)}, {SCREEN_W, 1}}, spectrum_row); // new line at top, one less var, speedier
|
||||
display.draw_pixels({{0, display.scroll(1)}, {screen_width, 1}}, spectrum_row); // new line at top, one less var, speedier
|
||||
}
|
||||
pixel_index = 0; // Start New cascade line
|
||||
}
|
||||
@@ -199,7 +199,7 @@ bool GlassView::process_bins(uint8_t* powerlevel) {
|
||||
void GlassView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
|
||||
baseband::spectrum_streaming_stop();
|
||||
// Convert bins of this spectrum slice into a representative max_power and when enough, into pixels
|
||||
// we actually need SCREEN_W (240) of those bins
|
||||
// we actually need screen_width (240) of those bins
|
||||
for (uint8_t bin = 0; bin < bin_length; bin++) {
|
||||
get_max_power(spectrum, bin, max_power);
|
||||
if (max_power > range_max_power)
|
||||
@@ -238,7 +238,7 @@ void GlassView::on_hide() {
|
||||
}
|
||||
|
||||
void GlassView::on_show() {
|
||||
display.scroll_set_area(109, 319); // Restart scroll on the correct coordinates
|
||||
display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates
|
||||
baseband::spectrum_streaming_start();
|
||||
}
|
||||
|
||||
@@ -253,11 +253,11 @@ void GlassView::on_range_changed() {
|
||||
// if the view is done in one pass, show it like in analog_audio_app
|
||||
mode = LOOKING_GLASS_SINGLEPASS;
|
||||
offset = 2;
|
||||
bin_length = SCREEN_W;
|
||||
bin_length = screen_width;
|
||||
ignore_dc = 0;
|
||||
looking_glass_bandwidth = looking_glass_range;
|
||||
looking_glass_sampling_rate = looking_glass_range;
|
||||
each_bin_size = looking_glass_bandwidth / SCREEN_W;
|
||||
each_bin_size = looking_glass_bandwidth / screen_width;
|
||||
looking_glass_step = looking_glass_bandwidth;
|
||||
f_center_ini = f_min + (looking_glass_bandwidth / 2); // Initial center frequency for sweep
|
||||
} else {
|
||||
@@ -269,7 +269,7 @@ void GlassView::on_range_changed() {
|
||||
if (mode == LOOKING_GLASS_FASTSCAN) {
|
||||
offset = 2;
|
||||
ignore_dc = 4;
|
||||
bin_length = SCREEN_W;
|
||||
bin_length = screen_width;
|
||||
} else { // if( mode == LOOKING_GLASS_SLOWSCAN )
|
||||
offset = 2;
|
||||
bin_length = 80;
|
||||
@@ -279,7 +279,7 @@ void GlassView::on_range_changed() {
|
||||
f_center_ini = f_min - (offset * each_bin_size) + (looking_glass_bandwidth / 2); // Initial center frequency for sweep
|
||||
}
|
||||
search_span = looking_glass_range / MHZ_DIV;
|
||||
marker_pixel_step = looking_glass_range / SCREEN_W; // Each pixel value in Hz
|
||||
marker_pixel_step = looking_glass_range / screen_width; // Each pixel value in Hz
|
||||
|
||||
pixel_index = 0;
|
||||
max_power = 0;
|
||||
@@ -304,10 +304,10 @@ void GlassView::plot_marker(uint8_t pos) {
|
||||
{
|
||||
shift_y = 16;
|
||||
}
|
||||
portapack::display.fill_rectangle({0, 100 + shift_y, SCREEN_W, 8}, Theme::getInstance()->bg_darkest->background); // Clear old marker and whole marker rectangle btw
|
||||
portapack::display.fill_rectangle({pos - 2, 100 + shift_y, 5, 3}, Theme::getInstance()->fg_red->foreground); // Red marker top
|
||||
portapack::display.fill_rectangle({pos - 1, 103 + shift_y, 3, 3}, Theme::getInstance()->fg_red->foreground); // Red marker middle
|
||||
portapack::display.fill_rectangle({pos, 106 + shift_y, 1, 2}, Theme::getInstance()->fg_red->foreground); // Red marker bottom
|
||||
portapack::display.fill_rectangle({0, 100 + shift_y, screen_width, 8}, Theme::getInstance()->bg_darkest->background); // Clear old marker and whole marker rectangle btw
|
||||
portapack::display.fill_rectangle({pos - 2, 100 + shift_y, 5, 3}, Theme::getInstance()->fg_red->foreground); // Red marker top
|
||||
portapack::display.fill_rectangle({pos - 1, 103 + shift_y, 3, 3}, Theme::getInstance()->fg_red->foreground); // Red marker middle
|
||||
portapack::display.fill_rectangle({pos, 106 + shift_y, 1, 2}, Theme::getInstance()->fg_red->foreground); // Red marker bottom
|
||||
}
|
||||
|
||||
void GlassView::update_min(int32_t v) {
|
||||
@@ -358,7 +358,8 @@ GlassView::GlassView(
|
||||
NavigationView& nav)
|
||||
: nav_(nav) {
|
||||
baseband::run_image(portapack::spi_flash::image_tag_wideband_spectrum);
|
||||
|
||||
spectrum_row.resize(screen_width);
|
||||
spectrum_data.resize(screen_width);
|
||||
if (!gradient.load_file(default_gradient_file)) {
|
||||
gradient.set_default();
|
||||
}
|
||||
@@ -437,11 +438,11 @@ GlassView::GlassView(
|
||||
freq_stats.hidden(true);
|
||||
button_jump.hidden(true);
|
||||
button_rst.hidden(true);
|
||||
display.scroll_set_area(109, 319); // Restart scroll on the correct coordinates.
|
||||
display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates.
|
||||
break;
|
||||
|
||||
case 1: // LEVEL
|
||||
display.fill_rectangle({{0, 108}, {SCREEN_W, 24}}, {0, 0, 0});
|
||||
display.fill_rectangle({{0, 108}, {screen_width, 24}}, {0, 0, 0});
|
||||
display.scroll_disable();
|
||||
level_integration.hidden(false);
|
||||
freq_stats.hidden(false);
|
||||
@@ -451,7 +452,7 @@ GlassView::GlassView(
|
||||
|
||||
case 2: // PEAK
|
||||
default:
|
||||
display.fill_rectangle({{0, 108}, {SCREEN_W, 24}}, {0, 0, 0});
|
||||
display.fill_rectangle({{0, 108}, {screen_width, 24}}, {0, 0, 0});
|
||||
display.scroll_disable();
|
||||
level_integration.hidden(false);
|
||||
freq_stats.hidden(false);
|
||||
@@ -491,9 +492,9 @@ GlassView::GlassView(
|
||||
|
||||
field_marker.on_encoder_change = [this](TextField&, EncoderEvent delta) {
|
||||
if ((marker_pixel_index + delta) < 0)
|
||||
marker_pixel_index = marker_pixel_index + delta + SCREEN_W;
|
||||
else if ((marker_pixel_index + delta) > SCREEN_W)
|
||||
marker_pixel_index = marker_pixel_index + delta - SCREEN_W;
|
||||
marker_pixel_index = marker_pixel_index + delta + screen_width;
|
||||
else if ((marker_pixel_index + delta) > screen_width)
|
||||
marker_pixel_index = marker_pixel_index + delta - screen_width;
|
||||
else
|
||||
marker_pixel_index = marker_pixel_index + delta;
|
||||
on_marker_change();
|
||||
@@ -531,7 +532,7 @@ GlassView::GlassView(
|
||||
};
|
||||
set_spec_iq_phase_calibration_value(get_spec_iq_phase_calibration_value()); // initialize iq_phase_calibration in radio
|
||||
|
||||
display.scroll_set_area(109, 319);
|
||||
display.scroll_set_area(109, screen_height - 1); // Restart scroll on the correct coordinates
|
||||
|
||||
// trigger:
|
||||
// Discord User jteich: WidebandSpectrum::on_message to set the trigger value. In WidebandSpectrum::execute,
|
||||
@@ -539,7 +540,7 @@ GlassView::GlassView(
|
||||
// at which time it pushes the buffer up with channel_spectrum.feed
|
||||
baseband::set_spectrum(looking_glass_bandwidth, trigger);
|
||||
|
||||
marker_pixel_index = SCREEN_W / 2;
|
||||
marker_pixel_index = screen_width / 2;
|
||||
on_range_changed(); // Force a UI update.
|
||||
|
||||
receiver_model.set_sampling_rate(looking_glass_sampling_rate); // 20mhz
|
||||
|
@@ -51,9 +51,6 @@ namespace ui {
|
||||
#define LOOKING_GLASS_SINGLEPASS 2
|
||||
// one spectrum line number of bins
|
||||
#define SPEC_NB_BINS 256
|
||||
// screen dimensions
|
||||
#define SCREEN_W 240
|
||||
#define SCREEN_H 320
|
||||
|
||||
class GlassView : public View {
|
||||
public:
|
||||
@@ -155,8 +152,8 @@ class GlassView : public View {
|
||||
uint8_t min_color_power{0}; // Filter cutoff level.
|
||||
uint32_t pixel_index{0};
|
||||
|
||||
std::array<Color, SCREEN_W> spectrum_row{};
|
||||
std::array<uint8_t, SCREEN_W> spectrum_data{};
|
||||
std::vector<Color> spectrum_row{};
|
||||
std::vector<uint8_t> spectrum_data{};
|
||||
ChannelSpectrumFIFO* fifo{};
|
||||
|
||||
int32_t steps = 1;
|
||||
@@ -168,7 +165,7 @@ class GlassView : public View {
|
||||
rf::Frequency max_freq_hold = 0;
|
||||
rf::Frequency last_max_freq = 0;
|
||||
int16_t max_freq_power = -1000;
|
||||
uint8_t bin_length = SCREEN_W;
|
||||
uint8_t bin_length = screen_width;
|
||||
uint8_t offset = 0;
|
||||
uint8_t ignore_dc = 0;
|
||||
|
||||
@@ -222,7 +219,7 @@ class GlassView : public View {
|
||||
{}};
|
||||
|
||||
ButtonWithEncoder button_beep_squelch{
|
||||
{240 - 8 * 8, 2 * 16 + 4, 8 * 8, 1 * 8},
|
||||
{screen_width - 8 * 8, 2 * 16 + 4, 8 * 8, 1 * 8},
|
||||
""};
|
||||
|
||||
TextField field_marker{
|
||||
@@ -293,15 +290,15 @@ class GlassView : public View {
|
||||
}};
|
||||
|
||||
Button button_jump{
|
||||
{SCREEN_W - 4 * 8, 5 * 16, 4 * 8, 16},
|
||||
{screen_width - 4 * 8, 5 * 16, 4 * 8, 16},
|
||||
"JMP"};
|
||||
|
||||
Button button_rst{
|
||||
{SCREEN_W - 9 * 8, 5 * 16, 4 * 8, 16},
|
||||
{screen_width - 9 * 8, 5 * 16, 4 * 8, 16},
|
||||
"RST"};
|
||||
|
||||
Text freq_stats{
|
||||
{0 * 8, 5 * 16, SCREEN_W - 10 * 8, 8},
|
||||
{0 * 8, 5 * 16, screen_width - 10 * 8, 8},
|
||||
""};
|
||||
|
||||
MessageHandlerRegistration message_handler_spectrum_config{
|
||||
|
@@ -160,7 +160,7 @@ class RDSView : public View {
|
||||
|
||||
void start_tx();
|
||||
|
||||
Rect view_rect = {0, 8 * 8, 240, 192};
|
||||
Rect view_rect = {0, 8 * 8, screen_width, 192};
|
||||
|
||||
RDSPSNView view_PSN{nav_, view_rect};
|
||||
RDSRadioTextView view_radiotext{nav_, view_rect};
|
||||
|
@@ -1404,8 +1404,8 @@ void ReconView::start_repeat() {
|
||||
std::string delay_message = "TX DELAY: " + to_string_dec_uint(delay) + "s";
|
||||
|
||||
// update display information
|
||||
p.fill_rectangle({0, (SCREEN_H / 2) - 16, SCREEN_W, 64}, Theme::getInstance()->fg_light->foreground);
|
||||
p.draw_string({(SCREEN_W / 2) - 7 * 8, SCREEN_H / 2}, *Theme::getInstance()->fg_red, delay_message);
|
||||
p.fill_rectangle({0, (screen_height / 2) - 16, screen_width, 64}, Theme::getInstance()->fg_light->foreground);
|
||||
p.draw_string({(screen_width / 2) - 7 * 8, screen_height / 2}, *Theme::getInstance()->fg_red, delay_message);
|
||||
|
||||
// sleep 1 second
|
||||
chThdSleepMilliseconds(1000);
|
||||
|
@@ -237,15 +237,15 @@ class ReconView : public View {
|
||||
|
||||
Text file_name{
|
||||
// show file used
|
||||
{0, 1 * 16, SCREEN_W, 16},
|
||||
{0, 1 * 16, screen_width, 16},
|
||||
};
|
||||
|
||||
Text desc_cycle{
|
||||
{0, 2 * 16, SCREEN_W, 16},
|
||||
{0, 2 * 16, screen_width, 16},
|
||||
};
|
||||
|
||||
RSSI rssi{
|
||||
{0 * 16, 3 * 16 + 2, SCREEN_W - 8 * 8 + 4, 12},
|
||||
{0 * 16, 3 * 16 + 2, screen_width - 8 * 8 + 4, 12},
|
||||
};
|
||||
|
||||
ButtonWithEncoder text_cycle{
|
||||
@@ -285,15 +285,15 @@ class ReconView : public View {
|
||||
|
||||
// Button can be RECON or SCANNER
|
||||
Button button_scanner_mode{
|
||||
{SCREEN_W - 7 * 8, 3 * 16, 7 * 8, 28},
|
||||
{screen_width - 7 * 8, 3 * 16, 7 * 8, 28},
|
||||
"RECON"};
|
||||
|
||||
Button button_loop_config{
|
||||
{SCREEN_W - 7 * 8, 5 * 16, 7 * 8, 28},
|
||||
{screen_width - 7 * 8, 5 * 16, 7 * 8, 28},
|
||||
"[LOOP]"};
|
||||
|
||||
Button button_config{
|
||||
{SCREEN_W - 7 * 8, 7 * 16, 7 * 8, 28},
|
||||
{screen_width - 7 * 8, 7 * 16, 7 * 8, 28},
|
||||
"CONFIG"};
|
||||
|
||||
ButtonWithEncoder button_manual_start{
|
||||
@@ -391,7 +391,7 @@ class ReconView : public View {
|
||||
"<REMOVE>"};
|
||||
|
||||
ProgressBar progressbar{
|
||||
{0 * 8, SCREEN_H / 2 - 16, SCREEN_W, 32}};
|
||||
{0 * 8, screen_height / 2 - 16, screen_width, 32}};
|
||||
|
||||
TransmitterView2 tx_view{
|
||||
{11 * 8, 2 * 16},
|
||||
|
@@ -57,10 +57,6 @@
|
||||
#define RECON_MIN_LOCK_DURATION 100 // have to be >= and a multiple of STATS_UPDATE_INTERVAL
|
||||
#define RECON_DEF_WAIT_DURATION 1000 // will be incremented/decremented by STATS_UPDATE_INTERVAL steps
|
||||
|
||||
// screen size helper
|
||||
#define SCREEN_W 240
|
||||
// #define SCREEN_H 320
|
||||
|
||||
// recon settings nb params
|
||||
#define RECON_SETTINGS_NB_PARAMS 7
|
||||
|
||||
@@ -219,7 +215,7 @@ class ReconSetupView : public View {
|
||||
std::string input_file{"RECON"};
|
||||
std::string output_file{"RECON_RESULTS"};
|
||||
|
||||
Rect view_rect{0, 3 * 8, SCREEN_W, 230};
|
||||
Rect view_rect{0, 3 * 8, screen_width, 230};
|
||||
|
||||
ReconSetupViewMain viewMain{nav_, view_rect, input_file, output_file};
|
||||
ReconSetupViewMore viewMore{nav_, view_rect};
|
||||
|
@@ -759,7 +759,7 @@ AppSettingsView::AppSettingsView(
|
||||
add_children({&labels,
|
||||
&menu_view});
|
||||
|
||||
menu_view.set_parent_rect({0, 3 * 8, 240, 33 * 8});
|
||||
menu_view.set_parent_rect({0, 3 * 8, screen_width, 33 * 8});
|
||||
|
||||
ensure_directory(settings_dir);
|
||||
|
||||
|
@@ -713,7 +713,7 @@ class AppSettingsView : public View {
|
||||
{{0, 4}, "Select file to edit:", Theme::getInstance()->bg_darkest->foreground}};
|
||||
|
||||
MenuView menu_view{
|
||||
{0, 2 * 8, 240, 26 * 8},
|
||||
{0, 2 * 8, screen_width, 26 * 8},
|
||||
true};
|
||||
};
|
||||
|
||||
@@ -947,7 +947,7 @@ class SetThemeView : public View {
|
||||
|
||||
OptionsField options{
|
||||
{0 * 8, 4 * 16},
|
||||
screen_width / 8,
|
||||
(size_t)(screen_width / 8),
|
||||
{
|
||||
{"Default - Grey", 0},
|
||||
{"Yellow", 1},
|
||||
|
@@ -57,7 +57,7 @@ void SIGFRXView::paint(Painter& painter) {
|
||||
uint8_t i, xp;
|
||||
|
||||
// portapack::display.draw_bmp_from_bmp_hex_arr({0, 302-160}, fox_bmp);
|
||||
portapack::display.fill_rectangle({0, 16, 240, 160 - 16}, Theme::getInstance()->bg_darkest->foreground);
|
||||
portapack::display.fill_rectangle({0, 16, screen_width, 160 - 16}, Theme::getInstance()->bg_darkest->foreground);
|
||||
for (i = 0; i < 6; i++) {
|
||||
xp = sigfrx_marks[i * 3];
|
||||
painter.draw_string({(ui::Coord)sigfrx_marks[(i * 3) + 1], 144 - 20}, style_white, to_string_dec_uint(sigfrx_marks[(i * 3) + 2]));
|
||||
@@ -66,7 +66,7 @@ void SIGFRXView::paint(Painter& painter) {
|
||||
}
|
||||
|
||||
void SIGFRXView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
|
||||
portapack::display.fill_rectangle({0, 144, 240, 4}, Theme::getInstance()->bg_darkest->foreground);
|
||||
portapack::display.fill_rectangle({0, 144, screen_width, 4}, Theme::getInstance()->bg_darkest->foreground);
|
||||
|
||||
uint8_t xmax = 0, imax = 0;
|
||||
size_t i;
|
||||
|
@@ -66,7 +66,7 @@ void ScreenshotViewer::paint(Painter& painter) {
|
||||
constexpr size_t read_chunk = 80; // NB: must be a factor of pixel_width.
|
||||
constexpr size_t buffer_size = sizeof(ColorRGB888) * read_chunk;
|
||||
uint8_t buffer[buffer_size];
|
||||
std::array<Color, screen_width> pixel_data;
|
||||
std::vector<Color> pixel_data(screen_width);
|
||||
|
||||
// Seek past all the headers.
|
||||
file.seek(43);
|
||||
|
@@ -192,7 +192,7 @@ class SubGhzDRecentEntryDetailView : public View {
|
||||
Text text_id{{6 * 8, 2 * 16, 10 * 8, 16}, "?"};
|
||||
|
||||
Console console{
|
||||
{0, 4 * 16, 240, screen_height - (4 * 16) - 36}};
|
||||
{0, 4 * 16, screen_width, screen_height - (4 * 16) - 36}};
|
||||
|
||||
Labels labels{
|
||||
{{0 * 8, 0 * 16}, "Type:", Theme::getInstance()->fg_light->foreground},
|
||||
|
@@ -99,8 +99,8 @@ void TestView::on_packet(const testapp::Packet& packet) {
|
||||
display.draw_pixel(Point(cur_x, 4 * 16 + (256 - ((raw_alt - cal_value) / 4))), Color::white());
|
||||
|
||||
cur_x++;
|
||||
if (cur_x >= 240) {
|
||||
display.fill_rectangle(Rect(0, 5 * 16, 240, 256), Color::black());
|
||||
if (cur_x >= screen_width) {
|
||||
display.fill_rectangle(Rect(0, 5 * 16, screen_width, 256), Color::black());
|
||||
cur_x = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user