waveform fix 3 and trivial change (#2540)

This commit is contained in:
sommermorgentraum 2025-03-06 00:53:41 +08:00 committed by GitHub
parent e933c8b498
commit ee472e1ed2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 21 deletions

View File

@ -175,7 +175,8 @@ void SoundBoardView::refresh_list() {
for (auto& c : entry_extension) for (auto& c : entry_extension)
c = toupper(c); c = toupper(c);
if (entry_extension == ".WAV") { if (entry_extension == ".WAV" && entry.path().string().find("shopping_cart") == std::string::npos) {
/* ^ because the shopping cart lock app using the speaker to send the LF signal, it's meaningless to be here */
if (reader->open(wav_dir / entry.path())) { if (reader->open(wav_dir / entry.path())) {
if ((reader->channels() == 1) && ((reader->bits_per_sample() == 8) || (reader->bits_per_sample() == 16))) { if ((reader->channels() == 1) && ((reader->bits_per_sample() == 8) || (reader->bits_per_sample() == 16))) {
// sounds[c].ms_duration = reader->ms_duration(); // sounds[c].ms_duration = reader->ms_duration();

View File

@ -74,7 +74,7 @@ __attribute__((section(".external_app.app_random_password.application_informatio
0x01, 0x01,
}, },
/*.icon_color = */ ui::Color::yellow().v, /*.icon_color = */ ui::Color::yellow().v,
/*.menu_location = */ app_location_t::UTILITIES, /*.menu_location = */ app_location_t::RX,
/*.desired_menu_position = */ -1, /*.desired_menu_position = */ -1,
/*.m4_app_tag = portapack::spi_flash::image_tag_afsk_rx */ {'P', 'A', 'F', 'R'}, /*.m4_app_tag = portapack::spi_flash::image_tag_afsk_rx */ {'P', 'A', 'F', 'R'},

View File

@ -158,13 +158,13 @@ const NavigationView::AppList NavigationView::appList = {
{"rdstx", "RDS", TX, ui::Color::green(), &bitmap_icon_rds, new ViewFactory<RDSView>()}, {"rdstx", "RDS", TX, ui::Color::green(), &bitmap_icon_rds, new ViewFactory<RDSView>()},
{"soundbrd", "Soundbrd", TX, ui::Color::green(), &bitmap_icon_soundboard, new ViewFactory<SoundBoardView>()}, {"soundbrd", "Soundbrd", TX, ui::Color::green(), &bitmap_icon_soundboard, new ViewFactory<SoundBoardView>()},
{"touchtune", "TouchTune", TX, ui::Color::green(), &bitmap_icon_touchtunes, new ViewFactory<TouchTunesView>()}, {"touchtune", "TouchTune", TX, ui::Color::green(), &bitmap_icon_touchtunes, new ViewFactory<TouchTunesView>()},
{"signalgen", "Signal Gen", TX, Color::green(), &bitmap_icon_cwgen, new ViewFactory<SigGenView>()},
/* UTILITIES *************************************************************/ /* UTILITIES *************************************************************/
{"filemanager", "File Manager", UTILITIES, Color::green(), &bitmap_icon_dir, new ViewFactory<FileManagerView>()}, {"filemanager", "File Manager", UTILITIES, Color::green(), &bitmap_icon_dir, new ViewFactory<FileManagerView>()},
{"freqman", "Freq. Manager", UTILITIES, Color::green(), &bitmap_icon_freqman, new ViewFactory<FrequencyManagerView>()}, {"freqman", "Freq. Manager", UTILITIES, Color::green(), &bitmap_icon_freqman, new ViewFactory<FrequencyManagerView>()},
{"iqtrim", "IQ Trim", UTILITIES, Color::orange(), &bitmap_icon_trim, new ViewFactory<IQTrimView>()}, {"iqtrim", "IQ Trim", UTILITIES, Color::orange(), &bitmap_icon_trim, new ViewFactory<IQTrimView>()},
{"notepad", "Notepad", UTILITIES, Color::dark_cyan(), &bitmap_icon_notepad, new ViewFactory<TextEditorView>()}, {"notepad", "Notepad", UTILITIES, Color::dark_cyan(), &bitmap_icon_notepad, new ViewFactory<TextEditorView>()},
{nullptr, "SD Over USB", UTILITIES, Color::yellow(), &bitmap_icon_hackrf, new ViewFactory<SdOverUsbView>()}, {nullptr, "SD Over USB", UTILITIES, Color::yellow(), &bitmap_icon_hackrf, new ViewFactory<SdOverUsbView>()},
{"signalgen", "Signal Gen", UTILITIES, Color::green(), &bitmap_icon_cwgen, new ViewFactory<SigGenView>()},
//{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory<TestView>()}, //{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory<TestView>()},
// Dangerous apps. // Dangerous apps.
{nullptr, "Flash Utility", UTILITIES, Color::red(), &bitmap_icon_peripherals_details, new ViewFactory<FlashUtilityView>()}, {nullptr, "Flash Utility", UTILITIES, Color::red(), &bitmap_icon_peripherals_details, new ViewFactory<FlashUtilityView>()},

View File

@ -2651,6 +2651,9 @@ bool Waveform::is_paused() const {
void Waveform::set_paused(bool paused) { void Waveform::set_paused(bool paused) {
paused_ = paused; paused_ = paused;
if (!paused) {
if_ever_painted_pause = false;
}
set_dirty(); set_dirty();
} }
@ -2722,26 +2725,28 @@ void Waveform::paint(Painter& painter) {
// TODO: this is bad: that it still enter this func and still consume resources. // TODO: this is bad: that it still enter this func and still consume resources.
// even do a if(paused_) return; comsume too, but not that much. // even do a if(paused_) return; comsume too, but not that much.
// if (dirty()) { if (dirty() && !if_ever_painted_pause) {
// clear // clear
// painter.fill_rectangle_unrolled8(screen_rect(), Theme::getInstance()->bg_darkest->background); painter.fill_rectangle_unrolled8(screen_rect(), Theme::getInstance()->bg_darkest->background);
// // draw "PAUSED" text // draw "WF HIDDEN" text
// const auto r = screen_rect(); const auto r = screen_rect();
// painter.draw_string( painter.draw_string(
// {r.center().x() - 24, r.center().y() - 8}, {r.center().x() - 24, r.center().y() - 8},
// style(), style(),
// "PAUSED"); "WF HIDDEN");
if_ever_painted_pause = true;
}
if (show_cursors) {
for (uint32_t n = 0; n < 2; n++) {
painter.draw_vline(
Point(std::min(screen_rect().size().width(), (int)cursors[n]), screen_rect().location().y()),
screen_rect().size().height(),
cursor_colors[n]);
}
}
// if (show_cursors) {
// for (uint32_t n = 0; n < 2; n++) {
// painter.draw_vline(
// Point(std::min(screen_rect().size().width(), (int)cursors[n]), screen_rect().location().y()),
// screen_rect().size().height(),
// cursor_colors[n]);
// }
// }
// }
return; return;
} }

View File

@ -1011,6 +1011,7 @@ class Waveform : public Widget {
bool show_cursors{false}; bool show_cursors{false};
bool paused_{false}; bool paused_{false};
bool clickable_{false}; bool clickable_{false};
bool if_ever_painted_pause{false}; // for prevent the "hidden" label keeps painting and being expensive
}; };
class VuMeter : public Widget { class VuMeter : public Widget {

Binary file not shown.

Binary file not shown.