Adding_TX_IQ_phase_Calibration_to_Mic_App (#1843)

* Adding_TX_IQ_phase_Calibration_to_Mic_App

* Adding_persistent_CAL_data_and_correct_init_data
This commit is contained in:
Brumi-2021
2024-02-04 00:57:45 +01:00
committed by GitHub
parent c30a61441b
commit b8073bca0f
9 changed files with 115 additions and 5 deletions

View File

@@ -31,6 +31,7 @@
#include "tonesets.hpp"
#include "ui_tone_key.hpp"
#include "wm8731.hpp"
#include "radio.hpp"
#include <cstring>
@@ -336,6 +337,7 @@ MicTXView::MicTXView(
&field_rxlna,
&field_rxvga,
&field_rxamp,
hackrf_r9 ? &field_tx_iq_phase_cal_2839 : &field_tx_iq_phase_cal_2837,
&tx_button,
&tx_icon});
@@ -368,6 +370,21 @@ MicTXView::MicTXView(
receiver_model.set_rf_amp(v);
};
radio::set_tx_max283x_iq_phase_calibration(iq_phase_calibration_value);
if (hackrf_r9) { // MAX2839 has 6 bits IQ CAL phasse adjustment.
field_tx_iq_phase_cal_2839.set_value(iq_phase_calibration_value);
field_tx_iq_phase_cal_2839.on_change = [this](int32_t v) {
iq_phase_calibration_value = v;
radio::set_tx_max283x_iq_phase_calibration(iq_phase_calibration_value);
};
} else { // MAX2837 has 5 bits IQ CAL phase adjustment.
field_tx_iq_phase_cal_2837.set_value(iq_phase_calibration_value);
field_tx_iq_phase_cal_2837.on_change = [this](int32_t v) {
iq_phase_calibration_value = v;
radio::set_tx_max283x_iq_phase_calibration(iq_phase_calibration_value);
};
}
options_gain.on_change = [this](size_t, int32_t v) {
mic_gain_x10 = v;
configure_baseband();

View File

@@ -113,6 +113,7 @@ class MicTXView : public View {
uint32_t va_level{40};
uint32_t attack_ms{500};
uint32_t decay_ms{1000};
uint8_t iq_phase_calibration_value{15};
app_settings::SettingsManager settings_{
"tx_mic",
app_settings::Mode::RX_TX,
@@ -132,6 +133,7 @@ class MicTXView : public View {
{"vox"sv, &va_enabled},
{"rogerbeep"sv, &rogerbeep_enabled},
{"tone_key_index"sv, &tone_key_index},
{"iq_phase_calibration"sv, &iq_phase_calibration_value},
}};
rf::Frequency tx_frequency{0};
@@ -160,7 +162,8 @@ class MicTXView : public View {
{{5 * 8, (25 * 8) + 2}, "F_RX:", Color::light_grey()},
{{5 * 8, (27 * 8) + 2}, "LNA:", Color::light_grey()},
{{12 * 8, (27 * 8) + 2}, "VGA:", Color::light_grey()},
{{19 * 8, (27 * 8) + 2}, "AMP:", Color::light_grey()}};
{{19 * 8, (27 * 8) + 2}, "AMP:", Color::light_grey()},
{{21 * 8, (31 * 8)}, "TX-IQ-CAL:", Color::light_grey()}};
Labels labels_WM8731{
{{17 * 8, 1 * 8}, "Boost", Color::light_grey()}};
Labels labels_AK4951{
@@ -338,6 +341,22 @@ class MicTXView : public View {
' ',
};
NumberField field_tx_iq_phase_cal_2837{
{24 * 8, (33 * 8)},
2,
{0, 31}, // 5 bits IQ CAL phase adjustment.
1,
' ',
};
NumberField field_tx_iq_phase_cal_2839{
{24 * 8, (33 * 8)},
2,
{0, 63}, // 6 bits IQ CAL phasse adjustment.
1,
' ',
};
Button tx_button{
{10 * 8, 30 * 8, 10 * 8, 5 * 8},
"PTT TX",