Compare commits

..

7 Commits

Author SHA1 Message Date
Mark Thompson f0614c882b File manager "Clean" button tweaks (#1990)
* File Manager "clean" button tweaks

* Add files via upload
2024-03-13 22:42:40 +01:00
not tre mann 14f42d1fe8 support "clean" files (#1983)
* init for clean files
* textual
* icons position
2024-03-13 18:06:14 +01:00
Mark Thompson 999f9e2ded Fix #1982 (enable DMA interrupt for all apps) (#1987) 2024-03-13 16:57:35 +01:00
Mark Thompson 61dc8a0225 Disabled unused baseband "no-op" process (#1986) 2024-03-13 16:08:52 +01:00
Mark Thompson 0b2d5f75cc Start audio DMA only in apps that use audio (#1982)
* Start audio DMA only in apps that use audio
* Rename main.cpp to main.cpp.unuse
* shrink_tx_buffer fix for transfers_per_buffer==1 scenario
2024-03-13 16:07:44 +01:00
Erwin Ried 3c489e1a81 Steamlining the warning (#1984)
I think it is enough to note nobody should pay for the download
2024-03-13 19:30:05 +08:00
gullradriel 910fd82051 freqman: limiting description size to 30, and minor fix (#1977)
* Limiting description size to 30 as it was documented before

* cosmetic adjustement

---------

Co-authored-by: GullCode <gullradriel@hotmail.com>
2024-03-11 16:40:47 +01:00
30 changed files with 177 additions and 62 deletions
+2 -6
View File
@@ -1,10 +1,6 @@
> [!WARNING]
> Recently, we have become aware of certain individuals distributing prepackaged packages of Mayhem for a fee, and we want to bring this to your attention to ensure the integrity and security of our project.
>
> We would like to clarify that none of the contributors to Mayhem receive any monetary compensation for their efforts. All the work put into this project is driven by passion and hobby, and we are committed to providing the community with an open-source solution that remains free of charge.
>
> __IF YOU'VE PAID FOR MAYHEM OR ANY PREPACKAGED PACKAGES, YOU'RE BEING SCAMMED.__ Seek a refund from your card company and report the issue immediately.
> The only legitimate link leading to our repositories is the organization [portapack-mayhem](https://github.com/portapack-mayhem/mayhem-firmware). Please ensure that any download or access to our software is done exclusively through these trusted sources.
> __IF YOU'VE PAID FOR MAYHEM OR ANY PREPACKAGED PACKAGES, YOU'RE BEING SCAMMED.__
> The only legitimate link leading to our repositories is the organization [portapack-mayhem](https://github.com/portapack-mayhem/mayhem-firmware).
# PortaPack Mayhem
+33 -1
View File
@@ -402,6 +402,7 @@ void FileSaveView::refresh_widgets() {
void FileManagerView::refresh_widgets(const bool v) {
button_rename.hidden(v);
button_delete.hidden(v);
button_clean.hidden(v);
button_cut.hidden(v);
button_copy.hidden(v);
button_paste.hidden(v);
@@ -449,7 +450,7 @@ void FileManagerView::on_rename(std::string_view hint) {
void FileManagerView::on_delete() {
if (is_directory(get_selected_full_path()) && !is_empty_directory(get_selected_full_path())) {
nav_.display_modal("Delete", "Directory not empty!");
nav_.display_modal("Delete", " Folder is not empty;\n Use \"Clean\" button to\n empty it first.");
return;
}
@@ -474,6 +475,31 @@ void FileManagerView::on_delete() {
});
}
void FileManagerView::on_clean() {
if (is_empty_directory(get_selected_full_path())) {
nav_.display_modal("Clean", "Folder is Empty;\nUse \"Delete\" button instead\nof \"Clean\" button to delete\nit.");
return;
}
auto path_name = is_directory(get_selected_full_path()) ? get_selected_full_path() : get_selected_full_path().parent_path();
// selected either a single file (delete files in this directory) or a directory that is not empty (del sub files)
nav_.push<ModalMessageView>(
"Clean", " ALL FILES in this folder\n (excluding sub-folders)\n will be DELETED!\n\n Delete all files?", YESNO,
[this, path_name](bool choice) {
if (choice) {
std::vector<std::filesystem::path> file_list;
file_list = scan_root_files(path_name, u"*");
for (const auto& file_name : file_list) {
std::filesystem::path current_full_path = path_name / file_name;
delete_file(current_full_path);
}
reload_current();
}
});
}
void FileManagerView::on_new_dir() {
name_buffer = "";
text_prompt(nav_, name_buffer, max_filename_length, [this](std::string& dir_name) {
@@ -560,6 +586,7 @@ FileManagerView::FileManagerView(
&text_date,
&button_rename,
&button_delete,
&button_clean,
&button_cut,
&button_copy,
&button_paste,
@@ -606,6 +633,11 @@ FileManagerView::FileManagerView(
on_delete();
};
button_clean.on_select = [this]() {
if (selected_is_valid())
on_clean();
};
button_cut.on_select = [this]() {
if (selected_is_valid() && !get_selected_entry().is_directory) {
clipboard_path = get_selected_full_path();
+13 -4
View File
@@ -207,6 +207,7 @@ class FileManagerView : public FileManBaseView {
void refresh_widgets(const bool v);
void on_rename(std::string_view hint);
void on_delete();
void on_clean();
void on_paste();
void on_new_dir();
void on_new_file();
@@ -227,11 +228,17 @@ class FileManagerView : public FileManBaseView {
Color::dark_blue()};
NewButton button_delete{
{4 * 8, 29 * 8, 4 * 8, 32},
{9 * 8, 34 * 8, 4 * 8, 32},
{},
&bitmap_icon_trash,
Color::red()};
NewButton button_clean{
{13 * 8, 34 * 8, 4 * 8, 32},
{},
&bitmap_icon_clean,
Color::red()};
NewButton button_cut{
{9 * 8, 29 * 8, 4 * 8, 32},
{},
@@ -269,20 +276,22 @@ class FileManagerView : public FileManBaseView {
Color::orange()};
NewButton button_rename_timestamp{
{4 * 8, 34 * 8, 4 * 8, 32},
{4 * 8, 29 * 8, 4 * 8, 32},
{},
&bitmap_icon_options_datetime,
Color::orange(),
/*vcenter*/ true};
NewButton button_open_iq_trim{
{9 * 8, 34 * 8, 4 * 8, 32},
{4 * 8, 34 * 8, 4 * 8, 32},
{},
&bitmap_icon_trim,
Color::orange()};
NewButton button_show_hidden_files{
{13 * 8, 34 * 8, 4 * 8, 32},
{17 * 8, 34 * 8, 4 * 8, 32},
{},
&bitmap_icon_hide,
Color::dark_grey()};
+1 -1
View File
@@ -228,7 +228,7 @@ void FrequencyManagerView::on_edit_freq() {
void FrequencyManagerView::on_edit_desc() {
temp_buffer_ = current_entry().description;
text_prompt(nav_, temp_buffer_, desc_edit_max, [this](std::string& new_desc) {
text_prompt(nav_, temp_buffer_, freqman_max_desc_size, [this](std::string& new_desc) {
auto entry = current_entry();
entry.description = std::move(new_desc);
db_.replace_entry(current_index(), entry);
+3 -5
View File
@@ -40,8 +40,6 @@ class FreqManBaseView : public View {
void focus() override;
static constexpr size_t desc_edit_max = 0x80;
protected:
using options_t = OptionsField::options_t;
@@ -63,11 +61,11 @@ class FreqManBaseView : public View {
/* The top section (category) is 20px tall. */
Labels label_category{
{{0, 2}, "Category:", Color::light_grey()}};
{{0, 2}, "F:", Color::light_grey()}};
OptionsField options_category{
{9 * 8, 2},
14 /* length */,
{3 * 8, 2},
20 /* length */,
{}};
FreqManUIList freqlist_view{
+38
View File
@@ -5797,6 +5797,44 @@ static constexpr Bitmap bitmap_icon_brightness{
{16, 16},
bitmap_icon_brightness_data};
static constexpr uint8_t bitmap_icon_clean_data[] = {
0x00,
0x00,
0xC0,
0x01,
0x20,
0x02,
0xFC,
0x1F,
0x00,
0x00,
0x08,
0x08,
0xE8,
0x08,
0xA8,
0x09,
0xA8,
0x0B,
0x28,
0x0A,
0x28,
0x0A,
0x28,
0x0A,
0xE8,
0x0B,
0x08,
0x08,
0xF0,
0x07,
0x00,
0x00,
};
static constexpr Bitmap bitmap_icon_clean{
{16, 16},
bitmap_icon_clean_data};
} /* namespace ui */
#endif /*__BITMAP_HPP__*/
+2 -2
View File
@@ -76,7 +76,7 @@ __attribute__((section(".external_app.app_calculator.application_information"),
/*.icon_color = */ ui::Color::yellow().v,
/*.menu_location = */ app_location_t::UTILITIES,
/*.m4_app_tag = portapack::spi_flash::image_tag_noop */ {'\0', '\0', '\0', '\0'}, // optional
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}
+1 -1
View File
@@ -76,7 +76,7 @@ __attribute__((section(".external_app.app_font_viewer.application_information"),
/*.icon_color = */ ui::Color::cyan().v,
/*.menu_location = */ app_location_t::DEBUG,
/*.m4_app_tag = portapack::spi_flash::image_tag_noop */ {'\0', '\0', '\0', '\0'},
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}
+2 -2
View File
@@ -76,7 +76,7 @@ __attribute__((section(".external_app.app_pacman.application_information"), used
/*.icon_color = */ ui::Color::yellow().v,
/*.menu_location = */ app_location_t::UTILITIES,
/*.m4_app_tag = portapack::spi_flash::image_tag_noop */ {'\0', '\0', '\0', '\0'}, // optional
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}
+2 -2
View File
@@ -76,7 +76,7 @@ __attribute__((section(".external_app.app_tetris.application_information"), used
/*.icon_color = */ ui::Color::orange().v,
/*.menu_location = */ app_location_t::UTILITIES,
/*.m4_app_tag = portapack::spi_flash::image_tag_noop */ {'\0', '\0', '\0', '\0'}, // optional
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
/*.m4_app_tag = portapack::spi_flash::image_tag_none */ {0, 0, 0, 0},
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
};
}
+2 -2
View File
@@ -376,7 +376,7 @@ bool parse_freqman_entry(std::string_view str, freqman_entry& entry) {
} else if (key == "c") {
entry.tone = parse_tone_key(value);
} else if (key == "d") {
entry.description = trim(value);
entry.description = trim(value).substr(0, freqman_max_desc_size);
} else if (key == "f") {
entry.type = freqman_type::Single;
parse_int(value, entry.frequency_a);
@@ -492,7 +492,7 @@ freqman_entry FreqmanDB::operator[](Index index) const {
return entry;
else if (read_raw_) {
entry.type = freqman_type::Raw;
entry.description = trim(*line_text);
entry.description = trim(*line_text).substr(0, freqman_max_desc_size);
return entry;
}
}
+3
View File
@@ -162,6 +162,9 @@ std::string freqman_entry_get_step_string_short(freqman_index_t step);
* ensure app memory stability. */
constexpr size_t freqman_default_max_entries = 150;
/* Limiting description to 30 as specified by the format */
constexpr size_t freqman_max_desc_size = 30;
struct freqman_load_options {
/* Loads all entries when set to 0. */
size_t max_entries{freqman_default_max_entries};
+10 -10
View File
@@ -290,7 +290,7 @@ macro(DeclareTargets chunk_tag name)
DEPENDS ${PROJECT_NAME}.elf ${MAKE_IMAGE_CHUNK}
VERBATIM
)
set(BASEBAND_IMAGES ${BASEBAND_IMAGES} ${PROJECT_NAME}.img)
else()
@@ -434,12 +434,12 @@ set(MODE_CPPSRC
)
DeclareTargets(PNFM nfm_audio)
### No op
set(MODE_CPPSRC
proc_noop.cpp
)
DeclareTargets(PNOP no_operation)
#### No op
#
#set(MODE_CPPSRC
# proc_noop.cpp
#)
#DeclareTargets(PNOP no_operation)
### OOK
@@ -519,7 +519,7 @@ set(MODE_CPPSRC
)
DeclareTargets(PWFM wfm_audio)
### SubGhz Decoders
### SubGhz Decoders
set(MODE_CPPSRC
proc_subghzd.cpp
@@ -554,7 +554,7 @@ set(MODE_INCDIR
)
set(MODE_CPPSRC
sd_over_usb/proc_sd_over_usb.cpp
sd_over_usb/scsi.c
sd_over_usb/diskio.c
sd_over_usb/sd_over_usb.c
@@ -672,7 +672,7 @@ set(BASEBAND_IMAGES ${BASEBAND_IMAGES} terminator.img)
#######################################################################
project(baseband)
add_custom_command(
OUTPUT ${PROJECT_NAME}.img
COMMAND cat ${BASEBAND_IMAGES} > ${PROJECT_NAME}.img
+23 -17
View File
@@ -162,14 +162,6 @@ static void rx_error() {
disable();
}
void init() {
gpdma_channel_i2s0_tx.set_handlers(tx_transfer_complete, tx_error);
gpdma_channel_i2s0_rx.set_handlers(rx_transfer_complete, rx_error);
// LPC_GPDMA->SYNC |= (1 << gpdma_rx_peripheral);
// LPC_GPDMA->SYNC |= (1 << gpdma_tx_peripheral);
}
static void configure_tx() {
const auto peripheral = reinterpret_cast<uint32_t>(&LPC_I2S0->TXFIFO);
const auto control_value = control_tx(transfer_bytes);
@@ -194,22 +186,32 @@ static void configure_rx() {
}
}
void configure() {
configure_tx();
configure_rx();
static void enable_tx() {
const auto gpdma_config_tx = config_tx();
gpdma_channel_i2s0_tx.configure(lli_tx_loop[0], gpdma_config_tx);
gpdma_channel_i2s0_tx.enable();
}
void enable() {
const auto gpdma_config_tx = config_tx();
static void enable_rx() {
const auto gpdma_config_rx = config_rx();
gpdma_channel_i2s0_tx.configure(lli_tx_loop[0], gpdma_config_tx);
gpdma_channel_i2s0_rx.configure(lli_rx_loop[0], gpdma_config_rx);
gpdma_channel_i2s0_tx.enable();
gpdma_channel_i2s0_rx.enable();
}
void init_audio_out() {
gpdma_channel_i2s0_tx.set_handlers(tx_transfer_complete, tx_error);
// LPC_GPDMA->SYNC |= (1 << gpdma_tx_peripheral);
configure_tx();
enable_tx();
}
void init_audio_in() {
gpdma_channel_i2s0_rx.set_handlers(rx_transfer_complete, rx_error);
// LPC_GPDMA->SYNC |= (1 << gpdma_rx_peripheral);
configure_rx();
enable_rx();
}
void disable() {
gpdma_channel_i2s0_tx.disable();
gpdma_channel_i2s0_rx.disable();
@@ -217,6 +219,10 @@ void disable() {
void shrink_tx_buffer(bool shrink) {
single_tx_buffer = shrink;
if (transfers_per_buffer == 1)
return;
if (single_tx_buffer)
lli_tx_loop[0].lli = lli_pointer(&lli_tx_loop[0]);
else
+2 -3
View File
@@ -43,9 +43,8 @@ using buffer_t = buffer_t<sample_t>;
namespace dma {
void init();
void configure();
void enable();
void init_audio_in();
void init_audio_out();
void disable();
void shrink_tx_buffer(bool shrink);
+1 -6
View File
@@ -28,13 +28,8 @@
#include "gpdma.hpp"
#include "audio_dma.hpp"
static void init() {
audio::dma::init();
audio::dma::configure();
audio::dma::enable();
// Audio DMA initialization was moved to baseband proc's that actually use DMA audio, to save memory.
nvicEnableVector(DMA_IRQn, CORTEX_PRIORITY_MASK(LPC_DMA_IRQ_PRIORITY));
}
+4
View File
@@ -23,6 +23,8 @@
#include "proc_afskrx.hpp"
#include "portapack_shared_memory.hpp"
#include "audio_dma.hpp"
#include "event_m4.hpp"
void AFSKRxProcessor::execute(const buffer_c8_t& buffer) {
@@ -181,6 +183,8 @@ void AFSKRxProcessor::configure(const AFSKRxConfigureMessage& message) {
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<AFSKRxProcessor>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -22,6 +22,7 @@
#include "proc_am_audio.hpp"
#include "audio_output.hpp"
#include "audio_dma.hpp"
#include "event_m4.hpp"
@@ -112,6 +113,8 @@ void NarrowbandAMAudio::capture_config(const CaptureConfigMessage& message) {
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<NarrowbandAMAudio>()};
event_dispatcher.run();
return 0;
+4
View File
@@ -23,6 +23,8 @@
#include "proc_aprsrx.hpp"
#include "portapack_shared_memory.hpp"
#include "audio_dma.hpp"
#include "event_m4.hpp"
#include "stdio.h"
@@ -244,6 +246,8 @@ void APRSRxProcessor::configure(const APRSRxConfigureMessage& message) {
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<APRSRxProcessor>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -24,6 +24,7 @@
#include "portapack_shared_memory.hpp"
#include "sine_table_int8.hpp"
#include "event_m4.hpp"
#include "audio_dma.hpp"
#include <cstdint>
@@ -139,6 +140,8 @@ void AudioTXProcessor::sample_rate_config(const SampleRateConfigMessage& message
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<AudioTXProcessor>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -25,6 +25,7 @@
#include "sine_table_int8.hpp"
#include "tonesets.hpp"
#include "event_m4.hpp"
#include "audio_dma.hpp"
#include <cstdint>
@@ -167,6 +168,8 @@ void MicTXProcessor::on_message(const Message* const msg) {
}
int main() {
audio::dma::init_audio_in();
EventDispatcher event_dispatcher{std::make_unique<MicTXProcessor>()};
event_dispatcher.run();
return 0;
+4
View File
@@ -24,6 +24,8 @@
#include "sine_table_int8.hpp"
#include "portapack_shared_memory.hpp"
#include "audio_dma.hpp"
#include "event_m4.hpp"
#include <cstdint>
@@ -174,6 +176,8 @@ void NarrowbandFMAudio::capture_config(const CaptureConfigMessage& message) {
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<NarrowbandFMAudio>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -27,6 +27,7 @@
#include "dsp_iir_config.hpp"
#include "event_m4.hpp"
#include "audio_dma.hpp"
#include <algorithm>
#include <cmath>
@@ -530,6 +531,8 @@ uint32_t POCSAGProcessor::getRate() const {
//
// ====================================================================
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<POCSAGProcessor>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -26,6 +26,7 @@
#include "proc_pocsag2.hpp"
#include "event_m4.hpp"
#include "audio_dma.hpp"
#include <algorithm>
#include <cmath>
@@ -416,6 +417,8 @@ void POCSAGProcessor::send_packet() {
/* main **************************************************/
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<POCSAGProcessor>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -27,6 +27,7 @@
#include "event_m4.hpp"
#include "audio_output.hpp"
#include "audio_dma.hpp"
SondeProcessor::SondeProcessor() {
decim_0.configure(taps_11k0_decim_0.taps);
@@ -141,6 +142,8 @@ void SondeProcessor::pitch_rssi_config(const PitchRSSIConfigureMessage& message)
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<SondeProcessor>()};
event_dispatcher.run();
+3
View File
@@ -23,6 +23,7 @@
#include "proc_tones.hpp"
#include "sine_table_int8.hpp"
#include "event_m4.hpp"
#include "audio_dma.hpp"
#include <cstdint>
@@ -154,6 +155,8 @@ void TonesProcessor::on_message(const Message* const p) {
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<TonesProcessor>()};
event_dispatcher.run();
return 0;
+3
View File
@@ -26,6 +26,7 @@
#include "audio_output.hpp"
#include "dsp_fft.hpp"
#include "event_m4.hpp"
#include "audio_dma.hpp"
#include <cstdint>
@@ -188,6 +189,8 @@ void WidebandFMAudio::capture_config(const CaptureConfigMessage& message) {
}
int main() {
audio::dma::init_audio_out();
EventDispatcher event_dispatcher{std::make_unique<WidebandFMAudio>()};
event_dispatcher.run();
return 0;
@@ -20,6 +20,7 @@
*/
#include "proc_wideband_spectrum.hpp"
#include "audio_dma.hpp"
#include "event_m4.hpp"
@@ -82,6 +83,8 @@ void WidebandSpectrum::on_message(const Message* const msg) {
}
int main() {
audio::dma::init_audio_out(); // for AudioRX app (enables audio output while this baseband image is running)
EventDispatcher event_dispatcher{std::make_unique<WidebandSpectrum>()};
event_dispatcher.run();
return 0;
Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B