mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 19:54:39 +00:00
Added tone key mix ratio in Settings -> Audio
Renamed Setup to Settings Updated binary
This commit is contained in:
parent
96828262d7
commit
b11c3c94b6
@ -234,7 +234,7 @@ set(CPPSRC
|
||||
apps/ui_scanner.cpp
|
||||
apps/ui_search.cpp
|
||||
apps/ui_sd_wipe.cpp
|
||||
apps/ui_setup.cpp
|
||||
apps/ui_settings.cpp
|
||||
apps/ui_siggen.cpp
|
||||
apps/ui_sonde.cpp
|
||||
apps/ui_soundboard.cpp
|
||||
|
@ -55,8 +55,7 @@ void MicTXView::configure_baseband() {
|
||||
sampling_rate / 20, // Update vu-meter at 20Hz
|
||||
transmitting ? transmitter_model.channel_bandwidth() : 0,
|
||||
mic_gain,
|
||||
TONES_F2D(tone_key_frequency(tone_key_index), sampling_rate),
|
||||
0.2 // 20% mix
|
||||
TONES_F2D(tone_key_frequency(tone_key_index), sampling_rate)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "ui_setup.hpp"
|
||||
#include "ui_settings.hpp"
|
||||
|
||||
#include "ui_navigation.hpp"
|
||||
#include "ui_touch_calibration.hpp"
|
||||
@ -42,7 +42,7 @@ namespace ui {
|
||||
SetDateTimeView::SetDateTimeView(
|
||||
NavigationView& nav
|
||||
) {
|
||||
button_ok.on_select = [&nav, this](Button&){
|
||||
button_done.on_select = [&nav, this](Button&){
|
||||
const auto model = this->form_collect();
|
||||
const rtc::RTC new_datetime {
|
||||
model.year, model.month, model.day,
|
||||
@ -57,18 +57,14 @@ SetDateTimeView::SetDateTimeView(
|
||||
},
|
||||
|
||||
add_children({
|
||||
&labels,
|
||||
&field_year,
|
||||
&text_slash1,
|
||||
&field_month,
|
||||
&text_slash2,
|
||||
&field_day,
|
||||
&field_hour,
|
||||
&text_colon1,
|
||||
&field_minute,
|
||||
&text_colon2,
|
||||
&field_second,
|
||||
&text_format,
|
||||
&button_ok,
|
||||
&button_done,
|
||||
&button_cancel,
|
||||
});
|
||||
|
||||
@ -120,10 +116,6 @@ SetRadioView::SetRadioView(
|
||||
add_children({
|
||||
&labels,
|
||||
&field_ppm,
|
||||
&text_description_1,
|
||||
&text_description_2,
|
||||
&text_description_3,
|
||||
&text_description_4,
|
||||
&check_bias,
|
||||
&button_done,
|
||||
&button_cancel
|
||||
@ -252,6 +244,25 @@ void SetUIView::focus() {
|
||||
checkbox_login.focus();
|
||||
}
|
||||
|
||||
SetAudioView::SetAudioView(NavigationView& nav) {
|
||||
add_children({
|
||||
&labels,
|
||||
&field_tone_mix,
|
||||
&button_ok
|
||||
});
|
||||
|
||||
field_tone_mix.set_value(persistent_memory::tone_mix());
|
||||
|
||||
button_ok.on_select = [&nav, this](Button&) {
|
||||
persistent_memory::set_tone_mix(field_tone_mix.value());
|
||||
nav.pop();
|
||||
};
|
||||
}
|
||||
|
||||
void SetAudioView::focus() {
|
||||
field_tone_mix.focus();
|
||||
}
|
||||
|
||||
/*void ModInfoView::on_show() {
|
||||
if (modules_nb) update_infos(0);
|
||||
}
|
||||
@ -430,14 +441,13 @@ void ModInfoView::focus() {
|
||||
button_ok.focus();
|
||||
}*/
|
||||
|
||||
SetupMenuView::SetupMenuView(NavigationView& nav) {
|
||||
SettingsMenuView::SettingsMenuView(NavigationView& nav) {
|
||||
add_items({
|
||||
{ "Audio", ui::Color::white(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
|
||||
{ "Radio", ui::Color::white(), nullptr, [&nav](){ nav.push<SetRadioView>(); } },
|
||||
{ "UI", ui::Color::white(), nullptr, [&nav](){ nav.push<SetUIView>(); } },
|
||||
//{ "SD card modules", ui::Color::white(), [&nav](){ nav.push<ModInfoView>(); } },
|
||||
{ "Date/Time", ui::Color::white(), nullptr, [&nav](){ nav.push<SetDateTimeView>(); } },
|
||||
//{ "Frequency correction", ui::Color::white(), nullptr, [&nav](){ nav.push<SetFrequencyCorrectionView>(); } },
|
||||
//{ "Antenna Bias Voltage", ui::Color::white(), nullptr, [&nav](){ nav.push<AntennaBiasSetupView>(); } },
|
||||
{ "Touch screen", ui::Color::white(), nullptr, [&nav](){ nav.push<TouchCalibrationView>(); } },
|
||||
{ "Play dead", ui::Color::white(), &bitmap_icon_playdead, [&nav](){ nav.push<SetPlayDeadView>(); } }
|
||||
});
|
@ -20,8 +20,8 @@
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __UI_SETUP_H__
|
||||
#define __UI_SETUP_H__
|
||||
#ifndef __UI_SETTINGS_H__
|
||||
#define __UI_SETTINGS_H__
|
||||
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_menu.hpp"
|
||||
@ -50,6 +50,11 @@ public:
|
||||
std::string title() const override { return "Set Date/Time"; };
|
||||
|
||||
private:
|
||||
Labels labels {
|
||||
{ { 8 * 8, 9 * 16 }, "/ / : :", Color::light_grey() },
|
||||
{ { 4 * 8, 11 * 16 }, "YYYY/MM/DD HH:MM:SS", Color::light_grey() }
|
||||
};
|
||||
|
||||
NumberField field_year {
|
||||
{ 4 * 8, 9 * 16 },
|
||||
4,
|
||||
@ -57,10 +62,6 @@ private:
|
||||
1,
|
||||
'0',
|
||||
};
|
||||
Text text_slash1 {
|
||||
{ 8 * 8, 9 * 16, 1 * 8, 16 },
|
||||
"/",
|
||||
};
|
||||
NumberField field_month {
|
||||
{ 9 * 8, 9 * 16 },
|
||||
2,
|
||||
@ -68,10 +69,6 @@ private:
|
||||
1,
|
||||
'0',
|
||||
};
|
||||
Text text_slash2 {
|
||||
{ 11 * 8, 9 * 16, 1 * 8, 16 },
|
||||
"/",
|
||||
};
|
||||
NumberField field_day {
|
||||
{ 12 * 8, 9 * 16 },
|
||||
2,
|
||||
@ -87,10 +84,6 @@ private:
|
||||
1,
|
||||
'0',
|
||||
};
|
||||
Text text_colon1 {
|
||||
{ 17 * 8, 9 * 16, 1 * 8, 16 },
|
||||
":"
|
||||
};
|
||||
NumberField field_minute {
|
||||
{ 18 * 8, 9 * 16 },
|
||||
2,
|
||||
@ -98,10 +91,6 @@ private:
|
||||
1,
|
||||
'0',
|
||||
};
|
||||
Text text_colon2 {
|
||||
{ 20 * 8, 9 * 16, 1 * 8, 16 },
|
||||
":",
|
||||
};
|
||||
NumberField field_second {
|
||||
{ 21 * 8, 9 * 16 },
|
||||
2,
|
||||
@ -110,17 +99,12 @@ private:
|
||||
'0',
|
||||
};
|
||||
|
||||
Text text_format {
|
||||
{ 4 * 8, 11 * 16, 19 * 8, 16 },
|
||||
"YYYY/MM/DD HH:MM:SS",
|
||||
};
|
||||
|
||||
Button button_ok {
|
||||
{ 4 * 8, 13 * 16, 8 * 8, 24 },
|
||||
"OK",
|
||||
Button button_done {
|
||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||
"Done"
|
||||
};
|
||||
Button button_cancel {
|
||||
{ 18 * 8, 13 * 16, 8 * 8, 24 },
|
||||
{ 16 * 8, 16 * 16, 12 * 8, 32 },
|
||||
"Cancel",
|
||||
};
|
||||
|
||||
@ -144,6 +128,10 @@ private:
|
||||
Labels labels {
|
||||
{ { 2 * 8, 2 * 16 }, "Frequency correction:", Color::light_grey() },
|
||||
{ { 6 * 8, 3 * 16 }, "PPM", Color::light_grey() },
|
||||
{ { 24, 7 * 16 }, "CAUTION: Ensure that all", Color::red() },
|
||||
{ { 28, 8 * 16 }, "devices attached to the", Color::red() },
|
||||
{ { 8, 9 * 16 }, "antenna connector can accept", Color::red() },
|
||||
{ { 68, 10 * 16 }, "a DC voltage!", Color::red() }
|
||||
};
|
||||
|
||||
NumberField field_ppm {
|
||||
@ -154,26 +142,6 @@ private:
|
||||
'0',
|
||||
};
|
||||
|
||||
Text text_description_1 {
|
||||
{ 24, 7 * 16, 24 * 8, 16 },
|
||||
"\x1B" "\x0C" "CAUTION: Ensure that all"
|
||||
};
|
||||
|
||||
Text text_description_2 {
|
||||
{ 28, 8 * 16, 23 * 8, 16 },
|
||||
"\x1B" "\x0C" "devices attached to the"
|
||||
};
|
||||
|
||||
Text text_description_3 {
|
||||
{ 8, 9 * 16, 28 * 8, 16 },
|
||||
"\x1B" "\x0C" "antenna connector can accept"
|
||||
};
|
||||
|
||||
Text text_description_4 {
|
||||
{ 68, 10 * 16, 13 * 8, 16 },
|
||||
"\x1B" "\x0C" "a DC voltage!"
|
||||
};
|
||||
|
||||
Checkbox check_bias {
|
||||
{ 28, 12 * 16 },
|
||||
5,
|
||||
@ -262,7 +230,34 @@ private:
|
||||
};
|
||||
|
||||
Button button_ok {
|
||||
{ 72, 260, 96, 32 },
|
||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||
"OK"
|
||||
};
|
||||
};
|
||||
|
||||
class SetAudioView : public View {
|
||||
public:
|
||||
SetAudioView(NavigationView& nav);
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Audio settings"; };
|
||||
|
||||
private:
|
||||
Labels labels {
|
||||
{ { 2 * 8, 3 * 16 }, "Tone key mix: %", Color::light_grey() },
|
||||
};
|
||||
|
||||
NumberField field_tone_mix {
|
||||
{ 16 * 8, 3 * 16 },
|
||||
2,
|
||||
{ 10, 99 },
|
||||
1,
|
||||
'0'
|
||||
};
|
||||
|
||||
Button button_ok {
|
||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||
"OK"
|
||||
};
|
||||
};
|
||||
@ -366,13 +361,13 @@ private:
|
||||
};
|
||||
};*/
|
||||
|
||||
class SetupMenuView : public MenuView {
|
||||
class SettingsMenuView : public MenuView {
|
||||
public:
|
||||
SetupMenuView(NavigationView& nav);
|
||||
SettingsMenuView(NavigationView& nav);
|
||||
|
||||
std::string title() const override { return "Settings"; };
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif/*__UI_SETUP_H__*/
|
||||
#endif/*__UI_SETTINGS_H__*/
|
@ -98,13 +98,12 @@ void SoundBoardView::file_error() {
|
||||
|
||||
void SoundBoardView::play_sound(uint16_t id) {
|
||||
uint32_t sample_rate = 0;
|
||||
|
||||
auto reader = std::make_unique<WAVFileReader>();
|
||||
uint32_t tone_key_index = options_tone_key.selected_index();
|
||||
|
||||
stop(false);
|
||||
|
||||
if(!reader->open(sounds[id].path)) {
|
||||
if (!reader->open(sounds[id].path)) {
|
||||
file_error();
|
||||
return;
|
||||
}
|
||||
@ -130,11 +129,10 @@ void SoundBoardView::play_sound(uint16_t id) {
|
||||
}
|
||||
|
||||
baseband::set_audiotx_config(
|
||||
0,
|
||||
0, // Divider is unused
|
||||
number_bw.value() * 1000,
|
||||
10,
|
||||
TONES_F2D(tone_key_frequency(tone_key_index), sample_rate),
|
||||
0.2 // 20% mix
|
||||
0, // Gain is unused
|
||||
TONES_F2D(tone_key_frequency(tone_key_index), sample_rate)
|
||||
);
|
||||
|
||||
radio::enable({
|
||||
|
@ -27,9 +27,12 @@
|
||||
#include "dsp_iir_config.hpp"
|
||||
|
||||
#include "portapack_shared_memory.hpp"
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
|
||||
#include "core_control.hpp"
|
||||
|
||||
using namespace portapack;
|
||||
|
||||
namespace baseband {
|
||||
|
||||
static void send_message(const Message* const message) {
|
||||
@ -153,13 +156,13 @@ void kill_afsk() {
|
||||
}
|
||||
|
||||
void set_audiotx_config(const uint32_t divider, const float deviation_hz, const float audio_gain,
|
||||
const uint32_t tone_key_delta, const float tone_key_mix_weight) {
|
||||
const uint32_t tone_key_delta) {
|
||||
const AudioTXConfigMessage message {
|
||||
divider,
|
||||
deviation_hz,
|
||||
audio_gain,
|
||||
tone_key_delta,
|
||||
tone_key_mix_weight
|
||||
(float)persistent_memory::tone_mix() / 100.0f
|
||||
};
|
||||
send_message(&message);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void set_tones_config(const uint32_t bw, const uint32_t pre_silence, const uint1
|
||||
void kill_tone();
|
||||
void set_sstv_data(const uint8_t vis_code, const uint32_t pixel_duration);
|
||||
void set_audiotx_config(const uint32_t divider, const float deviation_hz, const float audio_gain,
|
||||
const uint32_t tone_key_delta, const float tone_key_mix_weight);
|
||||
const uint32_t tone_key_delta);
|
||||
void set_fifo_data(const int8_t * data);
|
||||
void set_pitch_rssi(int32_t avg, bool enabled);
|
||||
void set_afsk_data(const uint32_t afsk_samples_per_bit, const uint32_t afsk_phase_inc_mark, const uint32_t afsk_phase_inc_space,
|
||||
|
@ -27,7 +27,7 @@
|
||||
// Check what ends up in the BSS section by looking at the map files !
|
||||
// Use constexpr where possible or make sure const are in .cpp files, not headers !
|
||||
|
||||
//TEST: Goertzel
|
||||
//TEST: Goertzel tone detect
|
||||
//TEST: Menuview refresh, seems to blink a lot
|
||||
//TEST: Check AFSK transmit end, skips last bits ?
|
||||
//TEST: Imperial in whipcalc
|
||||
@ -37,6 +37,9 @@
|
||||
//BUG: SCANNER Multiple slices
|
||||
//GLITCH: The about view scroller sometimes misses lines because of a race condition between the display scrolling and drawing the line
|
||||
|
||||
//TODO: Make play button larger in Replay
|
||||
//TODO: Put LNA and VGA controls in Soundboard
|
||||
//TODO: Add default headphones volume setting in Audio settings
|
||||
//TODO: Move Touchtunes remote to Custom remote
|
||||
//TODO: Use escapes \x1B to set colors in text, it works !
|
||||
//TODO: Open files in File Manager
|
||||
@ -74,10 +77,8 @@ Continuous (Fox-oring)
|
||||
//TODO: Use msgpack for settings, lists... on sd card
|
||||
|
||||
// Multimon-style stuff:
|
||||
//TODO: CTCSS detector
|
||||
//TODO: DMR detector
|
||||
//TODO: GSM channel detector
|
||||
//TODO: SIGFOX RX/TX
|
||||
//TODO: Playdead amnesia and login
|
||||
//TODO: Setup: Play dead by default ? Enable/disable ?
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "ui_scanner.hpp"
|
||||
#include "ui_search.hpp"
|
||||
#include "ui_sd_wipe.hpp"
|
||||
#include "ui_setup.hpp"
|
||||
#include "ui_settings.hpp"
|
||||
#include "ui_siggen.hpp"
|
||||
#include "ui_sonde.hpp"
|
||||
#include "ui_soundboard.hpp"
|
||||
@ -378,12 +378,13 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
|
||||
|
||||
UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) {
|
||||
add_items({
|
||||
{ "Test app", ui::Color::grey(), nullptr, [&nav](){ nav.push<TestView>(); } },
|
||||
//{ "Test app", ui::Color::grey(), nullptr, [&nav](){ nav.push<TestView>(); } },
|
||||
{ "Frequency manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push<FrequencyManagerView>(); } },
|
||||
{ "File manager", ui::Color::yellow(), &bitmap_icon_file, [&nav](){ nav.push<FileManagerView>(); } },
|
||||
{ "Notepad", ui::Color::grey(), &bitmap_icon_notepad, [&nav](){ nav.push<NotImplementedView>(); } },
|
||||
{ "Signal generator", ui::Color::green(), &bitmap_icon_cwgen, [&nav](){ nav.push<SigGenView>(); } },
|
||||
{ "Tone search", ui::Color::grey(), nullptr, [&nav](){ nav.push<ToneSearchView>(); } },
|
||||
//{ "Tone search", ui::Color::grey(), nullptr, [&nav](){ nav.push<ToneSearchView>(); } },
|
||||
{ "Wave file viewer", ui::Color::blue(), nullptr, [&nav](){ nav.push<ViewWavView>(); } },
|
||||
{ "Whip antenna length", ui::Color::yellow(), nullptr, [&nav](){ nav.push<WhipCalcView>(); } },
|
||||
{ "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push<WipeSDView>(); } },
|
||||
});
|
||||
@ -411,9 +412,8 @@ SystemMenuView::SystemMenuView(NavigationView& nav) {
|
||||
{ "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
|
||||
{ "Search/Close call", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } },
|
||||
{ "Scanner", ui::Color::grey(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } },
|
||||
{ "Wave file viewer", ui::Color::blue(), nullptr, [&nav](){ nav.push<ViewWavView>(); } },
|
||||
{ "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
|
||||
{ "Setup", ui::Color::white(), &bitmap_icon_setup, [&nav](){ nav.push<SetupMenuView>(); } },
|
||||
{ "Settings", ui::Color::white(), &bitmap_icon_setup, [&nav](){ nav.push<SettingsMenuView>(); } },
|
||||
//{ "Debug", ui::Color::white(), nullptr, [&nav](){ nav.push<DebugMenuView>(); } },
|
||||
{ "HackRF mode", ui::Color::white(), &bitmap_icon_hackrf, [this, &nav](){ hackrf_mode(nav); } },
|
||||
{ "About", ui::Color::white(), nullptr, [&nav](){ nav.push<AboutView>(); } }
|
||||
|
@ -95,7 +95,6 @@ void AudioTXProcessor::on_message(const Message* const message) {
|
||||
|
||||
void AudioTXProcessor::audio_config(const AudioTXConfigMessage& message) {
|
||||
fm_delta = message.deviation_hz * (0xFFFFFFULL / baseband_fs);
|
||||
|
||||
tone_gen.configure(message.tone_key_delta, message.tone_key_mix_weight);
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,10 @@ using ppb_range_t = range_t<ppb_t>;
|
||||
constexpr ppb_range_t ppb_range { -99000, 99000 };
|
||||
constexpr ppb_t ppb_reset_value { 0 };
|
||||
|
||||
using tone_mix_range_t = range_t<int32_t>;
|
||||
constexpr tone_mix_range_t tone_mix_range { 10, 99 };
|
||||
constexpr int32_t tone_mix_reset_value { 20 };
|
||||
|
||||
using afsk_freq_range_t = range_t<int32_t>;
|
||||
constexpr afsk_freq_range_t afsk_freq_range { 1, 4000 };
|
||||
constexpr int32_t afsk_mark_reset_value { 1200 };
|
||||
@ -85,6 +89,8 @@ struct data_t {
|
||||
|
||||
uint32_t pocsag_last_address;
|
||||
uint32_t pocsag_ignore_address;
|
||||
|
||||
int32_t tone_mix;
|
||||
};
|
||||
|
||||
static_assert(sizeof(data_t) <= backup_ram.size(), "Persistent memory structure too large for VBAT-maintained region");
|
||||
@ -125,6 +131,15 @@ const touch::Calibration& touch_calibration() {
|
||||
return data->touch_calibration;
|
||||
}
|
||||
|
||||
int32_t tone_mix() {
|
||||
tone_mix_range.reset_if_outside(data->tone_mix, tone_mix_reset_value);
|
||||
return data->tone_mix;
|
||||
}
|
||||
|
||||
void set_tone_mix(const int32_t new_value) {
|
||||
data->tone_mix = tone_mix_range.clip(new_value);
|
||||
}
|
||||
|
||||
int32_t afsk_mark_freq() {
|
||||
afsk_freq_range.reset_if_outside(data->afsk_mark_freq, afsk_mark_reset_value);
|
||||
return data->afsk_mark_freq;
|
||||
|
@ -50,6 +50,9 @@ const touch::Calibration& touch_calibration();
|
||||
serial_format_t serial_format();
|
||||
void set_serial_format(const serial_format_t new_value);
|
||||
|
||||
int32_t tone_mix();
|
||||
void set_tone_mix(const int32_t new_value);
|
||||
|
||||
int32_t afsk_mark_freq();
|
||||
void set_afsk_mark(const int32_t new_value);
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user