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)
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->channels() == 1) && ((reader->bits_per_sample() == 8) || (reader->bits_per_sample() == 16))) {
// sounds[c].ms_duration = reader->ms_duration();

View File

@ -74,7 +74,7 @@ __attribute__((section(".external_app.app_random_password.application_informatio
0x01,
},
/*.icon_color = */ ui::Color::yellow().v,
/*.menu_location = */ app_location_t::UTILITIES,
/*.menu_location = */ app_location_t::RX,
/*.desired_menu_position = */ -1,
/*.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>()},
{"soundbrd", "Soundbrd", TX, ui::Color::green(), &bitmap_icon_soundboard, new ViewFactory<SoundBoardView>()},
{"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 *************************************************************/
{"filemanager", "File Manager", UTILITIES, Color::green(), &bitmap_icon_dir, new ViewFactory<FileManagerView>()},
{"freqman", "Freq. Manager", UTILITIES, Color::green(), &bitmap_icon_freqman, new ViewFactory<FrequencyManagerView>()},
{"iqtrim", "IQ Trim", UTILITIES, Color::orange(), &bitmap_icon_trim, new ViewFactory<IQTrimView>()},
{"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>()},
{"signalgen", "Signal Gen", UTILITIES, Color::green(), &bitmap_icon_cwgen, new ViewFactory<SigGenView>()},
//{"testapp", "Test App", UTILITIES, Color::dark_grey(), nullptr, new ViewFactory<TestView>()},
// Dangerous apps.
{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) {
paused_ = paused;
if (!paused) {
if_ever_painted_pause = false;
}
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.
// even do a if(paused_) return; comsume too, but not that much.
// if (dirty()) {
// clear
// painter.fill_rectangle_unrolled8(screen_rect(), Theme::getInstance()->bg_darkest->background);
if (dirty() && !if_ever_painted_pause) {
// clear
painter.fill_rectangle_unrolled8(screen_rect(), Theme::getInstance()->bg_darkest->background);
// // draw "PAUSED" text
// const auto r = screen_rect();
// painter.draw_string(
// {r.center().x() - 24, r.center().y() - 8},
// style(),
// "PAUSED");
// draw "WF HIDDEN" text
const auto r = screen_rect();
painter.draw_string(
{r.center().x() - 24, r.center().y() - 8},
style(),
"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;
}

View File

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

Binary file not shown.

Binary file not shown.