mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-12-05 19:52:13 +00:00
Added bitrate option for POCSAG baseband, PWMRSSI frequency option
Split SD card wiper app Cleanup for -Weffc++
This commit is contained in:
@@ -176,6 +176,7 @@ set(CPPSRC
|
||||
ui_replay_view.cpp
|
||||
ui_rssi.cpp
|
||||
ui_sd_card_status_view.cpp
|
||||
ui_sd_wipe.cpp
|
||||
# ui_sd_card_debug.cpp
|
||||
ui_setup.cpp
|
||||
ui_soundboard.cpp
|
||||
|
||||
@@ -5027,6 +5027,33 @@ ui_sd_card_status_view.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_sd_card_status_view.cpp.s
|
||||
.PHONY : ui_sd_card_status_view.cpp.s
|
||||
|
||||
ui_sd_wipe.obj: ui_sd_wipe.cpp.obj
|
||||
|
||||
.PHONY : ui_sd_wipe.obj
|
||||
|
||||
# target to build an object file
|
||||
ui_sd_wipe.cpp.obj:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_sd_wipe.cpp.obj
|
||||
.PHONY : ui_sd_wipe.cpp.obj
|
||||
|
||||
ui_sd_wipe.i: ui_sd_wipe.cpp.i
|
||||
|
||||
.PHONY : ui_sd_wipe.i
|
||||
|
||||
# target to preprocess a source file
|
||||
ui_sd_wipe.cpp.i:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_sd_wipe.cpp.i
|
||||
.PHONY : ui_sd_wipe.cpp.i
|
||||
|
||||
ui_sd_wipe.s: ui_sd_wipe.cpp.s
|
||||
|
||||
.PHONY : ui_sd_wipe.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
ui_sd_wipe.cpp.s:
|
||||
cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_sd_wipe.cpp.s
|
||||
.PHONY : ui_sd_wipe.cpp.s
|
||||
|
||||
ui_setup.obj: ui_setup.cpp.obj
|
||||
|
||||
.PHONY : ui_setup.obj
|
||||
@@ -5769,6 +5796,9 @@ help:
|
||||
@echo "... ui_sd_card_status_view.obj"
|
||||
@echo "... ui_sd_card_status_view.i"
|
||||
@echo "... ui_sd_card_status_view.s"
|
||||
@echo "... ui_sd_wipe.obj"
|
||||
@echo "... ui_sd_wipe.i"
|
||||
@echo "... ui_sd_wipe.s"
|
||||
@echo "... ui_setup.obj"
|
||||
@echo "... ui_setup.i"
|
||||
@echo "... ui_setup.s"
|
||||
|
||||
@@ -141,9 +141,9 @@ void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit,
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
void set_pocsag() {
|
||||
void set_pocsag(const pocsag::BitRate bitrate) {
|
||||
const POCSAGConfigureMessage message {
|
||||
1200
|
||||
bitrate
|
||||
};
|
||||
send_message(&message);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define __BASEBAND_API_H__
|
||||
|
||||
#include "message.hpp"
|
||||
#include "pocsag_packet.hpp"
|
||||
|
||||
#include "dsp_fir_taps.hpp"
|
||||
|
||||
@@ -62,7 +63,7 @@ void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phas
|
||||
const uint8_t afsk_repeat, const uint32_t afsk_bw, const bool afsk_alt_format);
|
||||
void set_ook_data(const uint32_t stream_length, const uint32_t samples_per_bit, const uint8_t repeat,
|
||||
const uint32_t pause_symbols);
|
||||
void set_pocsag();
|
||||
void set_pocsag(const pocsag::BitRate bitrate);
|
||||
void set_adsb();
|
||||
void set_rds_data(const uint16_t message_length);
|
||||
//void set_dtmf_data(const uint32_t bw, const uint32_t tone_length, const uint32_t pause_length);
|
||||
|
||||
@@ -140,7 +140,7 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
|
||||
logger = std::make_unique<POCSAGLogger>();
|
||||
if (logger) logger->append("pocsag.txt");
|
||||
|
||||
baseband::set_pocsag();
|
||||
baseband::set_pocsag(pocsag::BitRate::FSK1200);
|
||||
}
|
||||
|
||||
POCSAGAppView::~POCSAGAppView() {
|
||||
|
||||
@@ -38,6 +38,11 @@ public:
|
||||
CloseCallView(NavigationView& nav);
|
||||
~CloseCallView();
|
||||
|
||||
CloseCallView(const CloseCallView&) = delete;
|
||||
CloseCallView(CloseCallView&&) = delete;
|
||||
CloseCallView& operator=(const CloseCallView&) = delete;
|
||||
CloseCallView& operator=(CloseCallView&&) = delete;
|
||||
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
void focus() override;
|
||||
|
||||
@@ -38,6 +38,11 @@ public:
|
||||
EncodersView(NavigationView& nav);
|
||||
~EncodersView();
|
||||
|
||||
EncodersView(const EncodersView&) = delete;
|
||||
EncodersView(EncodersView&&) = delete;
|
||||
EncodersView& operator=(const EncodersView&) = delete;
|
||||
EncodersView& operator=(EncodersView&&) = delete;
|
||||
|
||||
void focus() override;
|
||||
void on_show() override;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "ui_about.hpp"
|
||||
#include "ui_adsbtx.hpp"
|
||||
#include "ui_bht_tx.hpp"
|
||||
#include "ui_closecall.hpp"
|
||||
#include "ui_debug.hpp"
|
||||
#include "ui_encoders.hpp"
|
||||
@@ -43,11 +44,11 @@
|
||||
#include "ui_numbers.hpp"
|
||||
#include "ui_nuoptix.hpp"
|
||||
#include "ui_rds.hpp"
|
||||
#include "ui_sd_wipe.hpp"
|
||||
#include "ui_setup.hpp"
|
||||
#include "ui_soundboard.hpp"
|
||||
#include "ui_whipcalc.hpp"
|
||||
#include "ui_whistle.hpp"
|
||||
#include "ui_bht_tx.hpp"
|
||||
|
||||
#include "analog_audio_app.hpp"
|
||||
#include "ais_app.hpp"
|
||||
@@ -435,45 +436,6 @@ void BMPView::paint(Painter&) {
|
||||
portapack::display.drawBMP({(240 - 185) / 2, 0}, splash_bmp, false);
|
||||
}
|
||||
|
||||
/* WipeSDView ************************************************************/
|
||||
|
||||
WipeSDView::WipeSDView(NavigationView& nav) : nav_ (nav) {
|
||||
add_children({
|
||||
&text_info,
|
||||
&progress,
|
||||
&dummy
|
||||
});
|
||||
}
|
||||
|
||||
WipeSDView::~WipeSDView() {
|
||||
if (thread) chThdTerminate(thread);
|
||||
}
|
||||
|
||||
Thread* WipeSDView::thread { nullptr };
|
||||
|
||||
void WipeSDView::focus() {
|
||||
BlockDeviceInfo block_device_info;
|
||||
|
||||
dummy.focus();
|
||||
|
||||
if (!confirmed) {
|
||||
nav_.push<ModalMessageView>("Warning !", "Wipe first 32MB of SD card ?", YESCANCEL, [this](bool choice) {
|
||||
if (choice)
|
||||
confirmed = true;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (sdcGetInfo(&SDCD1, &block_device_info) == CH_SUCCESS) {
|
||||
blocks = 32; // Only erase first 32MB (block_device_info.blk_size * uint64_t(block_device_info.blk_num)) / (1024 * 1024);
|
||||
progress.set_max(blocks);
|
||||
|
||||
thread = chThdCreateFromHeap(NULL, 2048, NORMALPRIO + 10, WipeSDView::static_fn, this);
|
||||
} else {
|
||||
nav_.pop(); // Just silently abort for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* PlayDeadView **********************************************************/
|
||||
|
||||
void PlayDeadView::focus() {
|
||||
|
||||
@@ -176,62 +176,6 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
class WipeSDView : public View {
|
||||
public:
|
||||
WipeSDView(NavigationView& nav);
|
||||
~WipeSDView();
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "SD card wipe"; };
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
||||
bool confirmed = false;
|
||||
uint32_t blocks;
|
||||
static Thread* thread;
|
||||
|
||||
static msg_t static_fn(void* arg) {
|
||||
auto obj = static_cast<WipeSDView*>(arg);
|
||||
obj->run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void run() {
|
||||
uint32_t n, b;
|
||||
lfsr_word_t v = 1;
|
||||
const auto buffer = std::make_unique<std::array<uint8_t, 16384>>();
|
||||
|
||||
for (b = 0; b < blocks; b++) {
|
||||
progress.set_value(b);
|
||||
|
||||
lfsr_fill(v,
|
||||
reinterpret_cast<lfsr_word_t*>(buffer->data()),
|
||||
sizeof(*buffer.get()) / sizeof(lfsr_word_t));
|
||||
|
||||
// 1MB
|
||||
for (n = 0; n < 64; n++) {
|
||||
if (disk_write(sd_card::fs.drv, buffer->data(), n + (b * 64), 16384 / 512) != RES_OK) nav_.pop();
|
||||
}
|
||||
}
|
||||
nav_.pop();
|
||||
}
|
||||
|
||||
Text text_info {
|
||||
{ 10 * 8, 16 * 8, 10 * 8, 16 },
|
||||
"Working..."
|
||||
};
|
||||
|
||||
ProgressBar progress {
|
||||
{ 2 * 8, 19 * 8, 26 * 8, 24 }
|
||||
};
|
||||
|
||||
Button dummy {
|
||||
{ 240, 0, 0, 0 },
|
||||
""
|
||||
};
|
||||
};
|
||||
|
||||
class PlayDeadView : public View {
|
||||
public:
|
||||
PlayDeadView(NavigationView& nav);
|
||||
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
void on_tuning_frequency_changed(rf::Frequency f);
|
||||
void transmit(bool setup);
|
||||
|
||||
uint32_t timecode;
|
||||
uint32_t timecode { 0 };
|
||||
|
||||
FrequencyField field_frequency {
|
||||
{ 1 * 8, 4 },
|
||||
|
||||
@@ -42,7 +42,7 @@ void RecordView::toggle_pwmrssi() {
|
||||
// Send to RSSI widget
|
||||
const PWMRSSIConfigureMessage message {
|
||||
pwmrssi_enabled,
|
||||
1000,
|
||||
64,
|
||||
0
|
||||
};
|
||||
shared_memory.application_queue.push(message);
|
||||
|
||||
64
firmware/application/ui_sd_wipe.cpp
Normal file
64
firmware/application/ui_sd_wipe.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "ui_sd_wipe.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
WipeSDView::WipeSDView(NavigationView& nav) : nav_ (nav) {
|
||||
add_children({
|
||||
&text_info,
|
||||
&progress,
|
||||
&dummy
|
||||
});
|
||||
}
|
||||
|
||||
WipeSDView::~WipeSDView() {
|
||||
if (thread) chThdTerminate(thread);
|
||||
}
|
||||
|
||||
Thread* WipeSDView::thread { nullptr };
|
||||
|
||||
void WipeSDView::focus() {
|
||||
BlockDeviceInfo block_device_info;
|
||||
|
||||
dummy.focus();
|
||||
|
||||
if (!confirmed) {
|
||||
nav_.push<ModalMessageView>("Warning !", "Wipe first 32MB of SD card ?", YESCANCEL, [this](bool choice) {
|
||||
if (choice)
|
||||
confirmed = true;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (sdcGetInfo(&SDCD1, &block_device_info) == CH_SUCCESS) {
|
||||
blocks = 32; // Only erase first 32MB (block_device_info.blk_size * uint64_t(block_device_info.blk_num)) / (1024 * 1024);
|
||||
progress.set_max(blocks);
|
||||
|
||||
thread = chThdCreateFromHeap(NULL, 2048, NORMALPRIO + 10, WipeSDView::static_fn, this);
|
||||
} else {
|
||||
nav_.pop(); // Just silently abort for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
92
firmware/application/ui_sd_wipe.hpp
Normal file
92
firmware/application/ui_sd_wipe.hpp
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __UI_SE_WIPE_H__
|
||||
#define __UI_SE_WIPE_H__
|
||||
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ff.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace ui {
|
||||
|
||||
class WipeSDView : public View {
|
||||
public:
|
||||
WipeSDView(NavigationView& nav);
|
||||
~WipeSDView();
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "SD card wipe"; };
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
||||
bool confirmed = false;
|
||||
uint32_t blocks { 0 };
|
||||
static Thread* thread;
|
||||
|
||||
static msg_t static_fn(void* arg) {
|
||||
auto obj = static_cast<WipeSDView*>(arg);
|
||||
obj->run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void run() {
|
||||
uint32_t n, b;
|
||||
lfsr_word_t v = 1;
|
||||
const auto buffer = std::make_unique<std::array<uint8_t, 16384>>();
|
||||
|
||||
for (b = 0; b < blocks; b++) {
|
||||
progress.set_value(b);
|
||||
|
||||
lfsr_fill(v,
|
||||
reinterpret_cast<lfsr_word_t*>(buffer->data()),
|
||||
sizeof(*buffer.get()) / sizeof(lfsr_word_t));
|
||||
|
||||
// 1MB
|
||||
for (n = 0; n < 64; n++) {
|
||||
if (disk_write(sd_card::fs.drv, buffer->data(), n + (b * 64), 16384 / 512) != RES_OK) nav_.pop();
|
||||
}
|
||||
}
|
||||
nav_.pop();
|
||||
}
|
||||
|
||||
Text text_info {
|
||||
{ 10 * 8, 16 * 8, 10 * 8, 16 },
|
||||
"Working..."
|
||||
};
|
||||
|
||||
ProgressBar progress {
|
||||
{ 2 * 8, 19 * 8, 26 * 8, 24 }
|
||||
};
|
||||
|
||||
Button dummy {
|
||||
{ 240, 0, 0, 0 },
|
||||
""
|
||||
};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__UI_SE_WIPE_H__*/
|
||||
@@ -41,6 +41,11 @@ public:
|
||||
SoundBoardView(NavigationView& nav);
|
||||
~SoundBoardView();
|
||||
|
||||
SoundBoardView(const SoundBoardView&) = delete;
|
||||
SoundBoardView(SoundBoardView&&) = delete;
|
||||
SoundBoardView& operator=(const SoundBoardView&) = delete;
|
||||
SoundBoardView& operator=(SoundBoardView&&) = delete;
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Soundboard"; };
|
||||
|
||||
Reference in New Issue
Block a user