mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-12 11:37:38 +00:00
Remove RF TX and use PATX baseband for audio --> speaker out only (#2601)
* Force 433.92 and remove metadata check We already know the frequency for all files so don't need a million metadata files to match. * Remove RF TX. Improve PATX baseband. * code formatting of course
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
|
// CVS Spam app by RocketGod (@rocketgod-git) https://betaskynet.com
|
||||||
|
// Original .cu8 files by @jimilinuxguy https://github.com/jimilinuxguy/customer-assistance-buttons-sdr
|
||||||
|
// If you can read this, you're a nerd. :P
|
||||||
|
// Come join us at https://discord.gg/thepiratesreborn
|
||||||
|
|
||||||
// RocketGod's Shopping Cart Lock app
|
|
||||||
// https://betaskynet.com
|
|
||||||
#include "ui.hpp"
|
#include "ui.hpp"
|
||||||
#include "shoppingcart_lock.hpp"
|
#include "shoppingcart_lock.hpp"
|
||||||
#include "ui_navigation.hpp"
|
#include "ui_navigation.hpp"
|
||||||
@@ -57,10 +59,10 @@ __attribute__((section(".external_app.app_shoppingcart_lock.application_informat
|
|||||||
0x00,
|
0x00,
|
||||||
},
|
},
|
||||||
/*.icon_color = */ ui::Color::red().v,
|
/*.icon_color = */ ui::Color::red().v,
|
||||||
/*.menu_location = */ app_location_t::TX,
|
/*.menu_location = */ app_location_t::UTILITIES,
|
||||||
/*.desired_menu_position = */ -1,
|
/*.desired_menu_position = */ -1,
|
||||||
|
|
||||||
/*.m4_app_tag = portapack::spi_flash::image_tag_afsk_rx */ {'P', 'A', 'T', 'X'},
|
/*.m4_app_tag = portapack::spi_flash::image_tag_audio_tx */ {'P', 'A', 'T', 'X'},
|
||||||
/*.m4_app_offset = */ 0x00000000, // will be filled at compile time
|
/*.m4_app_offset = */ 0x00000000,
|
||||||
};
|
};
|
||||||
}
|
}
|
@@ -1,5 +1,8 @@
|
|||||||
// RocketGod's Shopping Cart Lock app
|
// CVS Spam app by RocketGod (@rocketgod-git) https://betaskynet.com
|
||||||
// https://betaskynet.com
|
// Original .cu8 files by @jimilinuxguy https://github.com/jimilinuxguy/customer-assistance-buttons-sdr
|
||||||
|
// If you can read this, you're a nerd. :P
|
||||||
|
// Come join us at https://discord.gg/thepiratesreborn
|
||||||
|
|
||||||
#include "shoppingcart_lock.hpp"
|
#include "shoppingcart_lock.hpp"
|
||||||
|
|
||||||
using namespace portapack;
|
using namespace portapack;
|
||||||
@@ -48,7 +51,6 @@ void ShoppingCartLock::stop() {
|
|||||||
audio::output::stop();
|
audio::output::stop();
|
||||||
|
|
||||||
log_event("... Resetting State Variables");
|
log_event("... Resetting State Variables");
|
||||||
transmitter_model.disable();
|
|
||||||
ready_signal = false;
|
ready_signal = false;
|
||||||
thread_sync_complete = false;
|
thread_sync_complete = false;
|
||||||
looping = false;
|
looping = false;
|
||||||
@@ -110,18 +112,24 @@ std::string ShoppingCartLock::list_wav_files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShoppingCartLock::wait_for_thread() {
|
void ShoppingCartLock::wait_for_thread() {
|
||||||
uint32_t timeout = 100;
|
uint32_t timeout = 1000;
|
||||||
while (!ready_signal && timeout > 0) {
|
while (!ready_signal && timeout > 0) {
|
||||||
chThdYield();
|
chThdYield();
|
||||||
timeout--;
|
timeout--;
|
||||||
}
|
}
|
||||||
|
if (!ready_signal) {
|
||||||
|
log_event("!!! Timeout waiting for ReplayThread");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShoppingCartLock::restart_playback() {
|
void ShoppingCartLock::restart_playback() {
|
||||||
auto reader = std::make_unique<WAVFileReader>();
|
auto reader = std::make_unique<WAVFileReader>();
|
||||||
std::string file_path = (wav_dir / current_file).string();
|
std::string file_path = (wav_dir / current_file).string();
|
||||||
|
|
||||||
if (!reader->open(file_path)) return;
|
if (!reader->open(file_path)) {
|
||||||
|
log_event("!!! Failed to reopen " + current_file + " for restart");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
replay_thread = std::make_unique<ReplayThread>(
|
replay_thread = std::make_unique<ReplayThread>(
|
||||||
std::move(reader),
|
std::move(reader),
|
||||||
@@ -133,9 +141,8 @@ void ShoppingCartLock::restart_playback() {
|
|||||||
EventDispatcher::send_message(message);
|
EventDispatcher::send_message(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
log_event(">> SENDING <<");
|
log_event(">> RESTARTING AUDIO <<");
|
||||||
audio::output::start();
|
audio::output::start();
|
||||||
transmitter_model.enable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShoppingCartLock::play_audio(const std::string& filename, bool loop) {
|
void ShoppingCartLock::play_audio(const std::string& filename, bool loop) {
|
||||||
@@ -166,33 +173,24 @@ void ShoppingCartLock::play_audio(const std::string& filename, bool loop) {
|
|||||||
|
|
||||||
wait_for_thread();
|
wait_for_thread();
|
||||||
|
|
||||||
log_event("... Configuring Baseband");
|
baseband::set_sample_rate(wav_sample_rate);
|
||||||
|
audio::set_rate(wav_sample_rate <= 12000 ? audio::Rate::Hz_12000 : wav_sample_rate <= 24000 ? audio::Rate::Hz_24000
|
||||||
const uint32_t bb_sample_rate = 1536000;
|
: audio::Rate::Hz_48000);
|
||||||
const uint32_t decimation = bb_sample_rate / wav_sample_rate;
|
|
||||||
|
|
||||||
baseband::set_audiotx_config(
|
baseband::set_audiotx_config(
|
||||||
bb_sample_rate / decimation,
|
wav_sample_rate,
|
||||||
|
0.0f,
|
||||||
0.0f,
|
0.0f,
|
||||||
5.0f,
|
|
||||||
wav_bits_per_sample,
|
wav_bits_per_sample,
|
||||||
wav_bits_per_sample,
|
wav_bits_per_sample,
|
||||||
0,
|
0,
|
||||||
true,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
baseband::set_sample_rate(wav_sample_rate);
|
|
||||||
|
|
||||||
log_event("... Starting Audio Output");
|
|
||||||
audio::output::start();
|
audio::output::start();
|
||||||
log_event("... Setting Max Volume");
|
volume_t max_volume = audio::headphone::volume_range().max;
|
||||||
audio::headphone::set_volume(audio::headphone::volume_range().max);
|
audio::headphone::set_volume(max_volume);
|
||||||
|
|
||||||
transmitter_model.enable();
|
|
||||||
|
|
||||||
log_event(">>> Playback Started <<<");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShoppingCartLock::ShoppingCartLock(NavigationView& nav)
|
ShoppingCartLock::ShoppingCartLock(NavigationView& nav)
|
||||||
@@ -225,9 +223,6 @@ ShoppingCartLock::ShoppingCartLock(NavigationView& nav)
|
|||||||
log_event("[+] INITIALIZATION COMPLETE");
|
log_event("[+] INITIALIZATION COMPLETE");
|
||||||
log_event("[+] PORTAPACK ARMED");
|
log_event("[+] PORTAPACK ARMED");
|
||||||
log_event("[*] STATUS: READY");
|
log_event("[*] STATUS: READY");
|
||||||
log_event("This app use speaker to");
|
|
||||||
log_event("produce LF signal, but");
|
|
||||||
log_event("also trigger radio TX");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShoppingCartLock::~ShoppingCartLock() {
|
ShoppingCartLock::~ShoppingCartLock() {
|
||||||
@@ -235,4 +230,4 @@ ShoppingCartLock::~ShoppingCartLock() {
|
|||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ui::external_app::shoppingcart_lock
|
} // namespace ui::external_app::shoppingcart_lock
|
@@ -1,5 +1,8 @@
|
|||||||
// RocketGod's Shopping Cart Lock app
|
// CVS Spam app by RocketGod (@rocketgod-git) https://betaskynet.com
|
||||||
// https://betaskynet.com
|
// Original .cu8 files by @jimilinuxguy https://github.com/jimilinuxguy/customer-assistance-buttons-sdr
|
||||||
|
// If you can read this, you're a nerd. :P
|
||||||
|
// Come join us at https://discord.gg/thepiratesreborn
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
@@ -27,8 +30,8 @@ class ShoppingCartLock : public View {
|
|||||||
void focus() override;
|
void focus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr size_t BUFFER_SIZE = 8192;
|
static constexpr size_t BUFFER_SIZE = 512;
|
||||||
static constexpr size_t NUM_BUFFERS = 8;
|
static constexpr size_t NUM_BUFFERS = 2;
|
||||||
const std::string shoppingcart_lock_file{"shopping_cart_lock.wav"};
|
const std::string shoppingcart_lock_file{"shopping_cart_lock.wav"};
|
||||||
const std::string shoppingcart_unlock_file{"shopping_cart_unlock.wav"};
|
const std::string shoppingcart_unlock_file{"shopping_cart_unlock.wav"};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user