mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-15 08:47:51 +00:00
Merge pull request #497 from Brumi-2021/Solving_mic_saturation_and_spectrum_armonics_Mic_App
Solving_mic_saturation_and_spectrum_harmonics_Mic_App
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
|
||||
#include "baseband_api.hpp"
|
||||
#include "audio.hpp"
|
||||
|
||||
#include "wm8731.hpp"
|
||||
using wolfson::wm8731::WM8731;
|
||||
|
||||
#include "tonesets.hpp"
|
||||
#include "portapack_hal.hpp"
|
||||
#include "string_format.hpp"
|
||||
@@ -34,6 +38,10 @@
|
||||
using namespace tonekey;
|
||||
using namespace portapack;
|
||||
|
||||
|
||||
WM8731 audio_codec_wm8731 { i2c0, 0x1a };
|
||||
|
||||
|
||||
namespace ui {
|
||||
|
||||
void MicTXView::focus() {
|
||||
@@ -178,7 +186,7 @@ void MicTXView::rxaudio(bool is_on) {
|
||||
|
||||
baseband::run_image(portapack::spi_flash::image_tag_mic_tx);
|
||||
audio::output::stop();
|
||||
audio::input::start();
|
||||
audio::input::start(ak4951_alc_GUI_selected); // set up audio input = mic config of any audio coded AK4951/WM8731, (in WM8731 parameter will be ignored)
|
||||
portapack::pin_i2s0_rx_sda.mode(3);
|
||||
configure_baseband();
|
||||
}
|
||||
@@ -203,10 +211,12 @@ MicTXView::MicTXView(
|
||||
|
||||
baseband::run_image(portapack::spi_flash::image_tag_mic_tx);
|
||||
|
||||
add_children({
|
||||
&labels,
|
||||
|
||||
if ( audio_codec_wm8731.detected() ) {
|
||||
add_children({
|
||||
&labels_WM8731, // we have audio codec WM8731, same MIC menu as original.
|
||||
&vumeter,
|
||||
&options_gain,
|
||||
&options_gain, // MIC GAIN float factor on the GUI.
|
||||
// &check_va,
|
||||
&field_va,
|
||||
&field_va_level,
|
||||
@@ -229,6 +239,37 @@ MicTXView::MicTXView(
|
||||
&field_rxamp,
|
||||
&tx_button
|
||||
});
|
||||
|
||||
} else {
|
||||
add_children({
|
||||
&labels_AK4951, // we have audio codec AK4951, enable Automatic Level Control
|
||||
&vumeter,
|
||||
&options_gain,
|
||||
&options_ak4951_alc_mode,
|
||||
// &check_va,
|
||||
&field_va,
|
||||
&field_va_level,
|
||||
&field_va_attack,
|
||||
&field_va_decay,
|
||||
&field_bw,
|
||||
&field_rfgain,
|
||||
&field_rfamp,
|
||||
&options_mode,
|
||||
&field_frequency,
|
||||
&options_tone_key,
|
||||
&check_rogerbeep,
|
||||
&check_rxactive,
|
||||
&field_volume,
|
||||
&field_rxbw,
|
||||
&field_squelch,
|
||||
&field_rxfrequency,
|
||||
&field_rxlna,
|
||||
&field_rxvga,
|
||||
&field_rxamp,
|
||||
&tx_button
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
tone_keys_populate(options_tone_key);
|
||||
options_tone_key.on_change = [this](size_t i, int32_t) {
|
||||
@@ -242,6 +283,12 @@ MicTXView::MicTXView(
|
||||
};
|
||||
options_gain.set_selected_index(1); // x1.0
|
||||
|
||||
options_ak4951_alc_mode.on_change = [this](size_t, int8_t v) {
|
||||
ak4951_alc_GUI_selected = v;
|
||||
audio::input::start(ak4951_alc_GUI_selected);
|
||||
};
|
||||
// options_ak4951_alc_mode.set_selected_index(0);
|
||||
|
||||
tx_frequency = transmitter_model.tuning_frequency();
|
||||
field_frequency.set_value(transmitter_model.tuning_frequency());
|
||||
field_frequency.set_step(receiver_model.frequency_step());
|
||||
@@ -478,7 +525,7 @@ MicTXView::MicTXView(
|
||||
set_tx(false);
|
||||
|
||||
audio::set_rate(audio::Rate::Hz_24000);
|
||||
audio::input::start();
|
||||
audio::input::start(ak4951_alc_GUI_selected); // originally , audio::input::start(); (we added parameter)
|
||||
}
|
||||
|
||||
MicTXView::~MicTXView() {
|
||||
|
@@ -83,6 +83,7 @@ private:
|
||||
bool rx_enabled { false };
|
||||
uint32_t tone_key_index { };
|
||||
float mic_gain { 1.0 };
|
||||
uint8_t ak4951_alc_GUI_selected { 0 };
|
||||
uint32_t audio_level { 0 };
|
||||
uint32_t va_level { };
|
||||
uint32_t attack_ms { };
|
||||
@@ -106,8 +107,8 @@ private:
|
||||
bool enable_lsb { false };
|
||||
|
||||
|
||||
Labels labels {
|
||||
{ { 3 * 8, 1 * 8 }, "MIC. GAIN:", Color::light_grey() },
|
||||
Labels labels_WM8731 {
|
||||
{ { 3 * 8, 1 * 8 }, "MIC-GAIN:", Color::light_grey() },
|
||||
{ { 3 * 8, 3 * 8 }, "F:", Color::light_grey() },
|
||||
{ { 15 * 8, 3 * 8 }, "BW: FM kHz", Color::light_grey() },
|
||||
{ { 3 * 8, 5 * 8 }, "GAIN:", Color::light_grey() },
|
||||
@@ -118,15 +119,36 @@ private:
|
||||
{ {12 * 8, 10 * 8 }, "ATT:", Color::light_grey() },
|
||||
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
|
||||
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
|
||||
{ { 9 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
|
||||
{ {17 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
|
||||
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
|
||||
{ {15 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
|
||||
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
|
||||
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
|
||||
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
|
||||
{ {12 * 8, 27 * 8 }, "VGA:", Color::light_grey()},
|
||||
{ {19 * 8, 27 * 8 }, "AMP:", Color::light_grey()}
|
||||
};
|
||||
|
||||
Labels labels_AK4951 {
|
||||
{ { 3 * 8, 1 * 8 }, "MIC-GAIN:", Color::light_grey() },
|
||||
{ { 17 * 8, 1 * 8 }, "ALC", Color::light_grey() },
|
||||
{ { 3 * 8, 3 * 8 }, "F:", Color::light_grey() },
|
||||
{ { 15 * 8, 3 * 8 }, "BW: FM kHz", Color::light_grey() },
|
||||
{ { 3 * 8, 5 * 8 }, "GAIN:", Color::light_grey() },
|
||||
{ {11 * 8, 5 * 8 }, "Amp:", Color::light_grey() },
|
||||
{ { 18 * 8, (5 * 8) }, "Mode:", Color::light_grey() },
|
||||
{ { 3 * 8, 8 * 8 }, "TX Activation:", Color::light_grey() },
|
||||
{ { 4 * 8, 10 * 8 }, "LVL:", Color::light_grey() },
|
||||
{ {12 * 8, 10 * 8 }, "ATT:", Color::light_grey() },
|
||||
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
|
||||
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
|
||||
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
|
||||
{ {15 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
|
||||
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
|
||||
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
|
||||
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
|
||||
{ {12 * 8, 27 * 8 }, "VGA:", Color::light_grey()},
|
||||
{ {19 * 8, 27 * 8 }, "AMP:", Color::light_grey()}
|
||||
};
|
||||
|
||||
VuMeter vumeter {
|
||||
{ 0 * 8, 1 * 8, 2 * 8, 33 * 8 },
|
||||
12,
|
||||
@@ -135,7 +157,7 @@ private:
|
||||
|
||||
|
||||
OptionsField options_gain {
|
||||
{ 13 * 8, 1 * 8 },
|
||||
{ 12 * 8, 1 * 8 },
|
||||
4,
|
||||
{
|
||||
{ "x0.5", 5 },
|
||||
@@ -145,6 +167,25 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
OptionsField options_ak4951_alc_mode {
|
||||
{ 20 * 8, 1 * 8 }, // Coordinates are: int:x (px), int:y (px)
|
||||
11,
|
||||
{
|
||||
{ " OFF-20kHz", 0 }, // Nothing changed from ORIGINAL,keeping ALL programm. AK4951 Dig. block->OFF)
|
||||
{ "+12dB-6kHz", 1 }, // ALC-> on, (+12dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "+09dB-6kHz", 2 }, // ALC-> on, (+09dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "+06dB-6kHz", 3 }, // ALC-> on, (+06dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "+03dB-2kHz", 4 }, // ALC-> on, (+03dB's) Auto Vol max + Wind Noise cancel + LPF 3,5k + Pre-amp Mic (+21dB=original)+ EQ boosting ~<2kHz (f0~1k1,fb:1,7K, k=1,8)
|
||||
{ "+03dB-4kHz", 5 }, // ALC-> on, (+03dB's) Auto Vol max + Wind Noise cancel + LPF 4kHz + Pre-amp Mic (+21dB=original)+ EQ boosting ~<3kHz (f0~1k4,fb~2,4k, k=1,8)
|
||||
{ "+03dB-6kHz", 6 }, // ALC-> on, (+03dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "+00dB-6kHz", 7 }, // ALC-> on, (+00dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "-03dB-6kHz", 8 }, // ALC-> on, (-03dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "-06dB-6kHz", 9 }, // ALC-> on, (-06dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
|
||||
{ "-09dB-6kHz", 10 }, // ALC-> on, (-09dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz - Pre-amp MIC -3dB (18dB's)
|
||||
{ "-12dB-6kHz", 11 }, // ALC-> on, (-12dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz - Pre-amp MIC -6dB (15dB's)
|
||||
}
|
||||
};
|
||||
|
||||
FrequencyField field_frequency {
|
||||
{ 5 * 8, 3 * 8 },
|
||||
};
|
||||
@@ -244,7 +285,7 @@ private:
|
||||
};
|
||||
|
||||
NumberField field_volume {
|
||||
{ 13 * 8, 23 * 8 },
|
||||
{ 11* 8, 23 * 8 },
|
||||
2,
|
||||
{ 0, 99 },
|
||||
1,
|
||||
@@ -252,7 +293,7 @@ private:
|
||||
};
|
||||
|
||||
OptionsField field_rxbw {
|
||||
{ 25 * 8, 23 * 8},
|
||||
{ 23* 8, 23 * 8},
|
||||
3,
|
||||
{
|
||||
{"8k5", 0},
|
||||
|
Reference in New Issue
Block a user