mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-19 22:24:02 +00:00
# This is a combination of 2 commits.
# The first commit's message is: Updated RDS transmitter: flags, PI and date/time Merging baseband audio tone generators Merging DTMF baseband with "tones" baseband Added stealth transmit mode App flash section bumped to 512k RX and TX LEDs are now used Play dead should work again, added login option Morse frame gen. for letters and fox hunt codes Merged EPAR with Xylos Made EPAR use encoders for frame gen. Moved OOK encoders data in encoders.hpp Simplified about screen, ui_about_demo.* files are still there BHT city DB, keywords removed BHT cities DB, keywords removed Update README.md RDS radiotext and time group generators # This is the 2nd commit message: Update README.md
This commit is contained in:
@@ -23,10 +23,8 @@
|
||||
#include "ui_nuoptix.hpp"
|
||||
|
||||
#include "ch.h"
|
||||
|
||||
#include "lfsr_random.hpp"
|
||||
#include "ui_alphanum.hpp"
|
||||
#include "portapack.hpp"
|
||||
#include "lfsr_random.hpp"
|
||||
#include "string_format.hpp"
|
||||
|
||||
#include "portapack_shared_memory.hpp"
|
||||
@@ -39,7 +37,12 @@ using namespace portapack;
|
||||
namespace ui {
|
||||
|
||||
void NuoptixView::focus() {
|
||||
number_timecode.focus();
|
||||
button_tx.focus();
|
||||
}
|
||||
|
||||
NuoptixView::~NuoptixView() {
|
||||
transmitter_model.disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
void NuoptixView::on_tuning_frequency_changed(rf::Frequency f) {
|
||||
@@ -47,8 +50,9 @@ void NuoptixView::on_tuning_frequency_changed(rf::Frequency f) {
|
||||
}
|
||||
|
||||
void NuoptixView::transmit(bool setup) {
|
||||
uint8_t mod;
|
||||
uint8_t mod, tone_code;
|
||||
uint8_t c;
|
||||
uint8_t dtmf_message[6];
|
||||
|
||||
if (!tx_mode) {
|
||||
transmitter_model.disable();
|
||||
@@ -56,7 +60,7 @@ void NuoptixView::transmit(bool setup) {
|
||||
}
|
||||
|
||||
if (tx_mode == IMPROVISE)
|
||||
timecode = lfsr_iterate(timecode) % 1999; // Should be 9999 but that would be one long audio track !
|
||||
timecode = lfsr_iterate(timecode) % 1999; // Could be 9999 but that would be one long audio track !
|
||||
|
||||
if (setup) {
|
||||
pbar.set_max(4);
|
||||
@@ -64,7 +68,7 @@ void NuoptixView::transmit(bool setup) {
|
||||
if (tx_mode == NORMAL)
|
||||
timecode = number_timecode.value();
|
||||
else
|
||||
timecode = 0125;
|
||||
timecode = 0125; // TODO: Use RTC as seed ?
|
||||
|
||||
transmitter_model.set_baseband_configuration({
|
||||
.mode = 0,
|
||||
@@ -77,35 +81,63 @@ void NuoptixView::transmit(bool setup) {
|
||||
transmitter_model.set_baseband_bandwidth(1750000);
|
||||
transmitter_model.enable();
|
||||
|
||||
shared_memory.tx_data[0] = '*'; // "Pre-tone for restart" method #1
|
||||
shared_memory.tx_data[1] = 'A'; // "Restart" method #1
|
||||
dtmf_message[0] = '*'; // "Pre-tone for restart" method #1
|
||||
dtmf_message[1] = 'A'; // "Restart" method #1
|
||||
} else {
|
||||
shared_memory.tx_data[0] = '#';
|
||||
shared_memory.tx_data[1] = (timecode / 1000) % 10;
|
||||
dtmf_message[0] = '#';
|
||||
dtmf_message[1] = (timecode / 1000) % 10;
|
||||
chThdSleepMilliseconds(92); // 141-49ms
|
||||
number_timecode.set_value(timecode);
|
||||
}
|
||||
|
||||
pbar.set_value(0);
|
||||
|
||||
shared_memory.tx_data[2] = (timecode / 100) % 10;
|
||||
shared_memory.tx_data[3] = (timecode / 10) % 10;
|
||||
shared_memory.tx_data[4] = timecode % 10;
|
||||
dtmf_message[2] = (timecode / 100) % 10;
|
||||
dtmf_message[3] = (timecode / 10) % 10;
|
||||
dtmf_message[4] = timecode % 10;
|
||||
|
||||
mod = 0;
|
||||
for (c = 1; c < 5; c++)
|
||||
if (shared_memory.tx_data[c] <= 9)
|
||||
mod += shared_memory.tx_data[c];
|
||||
if (dtmf_message[c] <= 9)
|
||||
mod += dtmf_message[c];
|
||||
|
||||
mod = 10 - (mod % 10);
|
||||
if (mod == 10) mod = 0; // Is this right ?
|
||||
|
||||
text_mod.set("Mod: " + to_string_dec_uint(mod));
|
||||
|
||||
shared_memory.tx_data[5] = mod;
|
||||
dtmf_message[5] = mod;
|
||||
|
||||
shared_memory.tx_data[6] = 0xFF; // End of message
|
||||
for (c = 0; c < 6; c++) {
|
||||
tone_code = dtmf_message[c];
|
||||
|
||||
if (tone_code == 'A')
|
||||
tone_code = 10;
|
||||
else if (tone_code == 'B')
|
||||
tone_code = 11;
|
||||
else if (tone_code == 'C')
|
||||
tone_code = 12;
|
||||
else if (tone_code == 'D')
|
||||
tone_code = 13;
|
||||
else if (tone_code == '#')
|
||||
tone_code = 14;
|
||||
else if (tone_code == '*')
|
||||
tone_code = 15;
|
||||
|
||||
shared_memory.bb_data.tones_data.message[c * 2] = tone_code;
|
||||
shared_memory.bb_data.tones_data.message[c * 2 + 1] = 0xFF; // Silence
|
||||
}
|
||||
|
||||
baseband::set_dtmf_data(number_bw.value(), 49, 49); // 49ms tone, 49ms space
|
||||
for (c = 0; c < 16; c++) {
|
||||
shared_memory.bb_data.tones_data.tone_defs[c * 2].delta = dtmf_deltas[c][0];
|
||||
shared_memory.bb_data.tones_data.tone_defs[c * 2].duration = NUOPTIX_TONE_LENGTH;
|
||||
shared_memory.bb_data.tones_data.tone_defs[c * 2 + 1].delta = dtmf_deltas[c][1];
|
||||
shared_memory.bb_data.tones_data.tone_defs[c * 2 + 1].duration = NUOPTIX_TONE_LENGTH;
|
||||
}
|
||||
shared_memory.bb_data.tones_data.silence = NUOPTIX_TONE_LENGTH; // 49ms tone, 49ms space
|
||||
|
||||
audio::set_rate(audio::Rate::Hz_24000);
|
||||
baseband::set_tones_data(number_bw.value(), 0, 6 * 2, true, true);
|
||||
|
||||
timecode++;
|
||||
}
|
||||
@@ -114,7 +146,7 @@ NuoptixView::NuoptixView(
|
||||
NavigationView& nav
|
||||
)
|
||||
{
|
||||
baseband::run_image(portapack::spi_flash::image_tag_dtmf_tx);
|
||||
baseband::run_image(portapack::spi_flash::image_tag_tones);
|
||||
|
||||
add_children({ {
|
||||
&field_frequency,
|
||||
@@ -129,7 +161,6 @@ NuoptixView::NuoptixView(
|
||||
&button_exit
|
||||
} });
|
||||
|
||||
//check_loop.set_value(false);
|
||||
number_bw.set_value(15);
|
||||
number_timecode.set_value(1);
|
||||
|
||||
@@ -174,9 +205,4 @@ NuoptixView::NuoptixView(
|
||||
};
|
||||
}
|
||||
|
||||
NuoptixView::~NuoptixView() {
|
||||
transmitter_model.disable();
|
||||
baseband::shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user