Invest limit bw ssb to 3 k (#2188)

* Adding_TX_BW_user_selection_to_the_Mic_SSB_mode

* TX_SSB_BW_adjustm_2k_3k_4k

* init_value_correction

* Comment_correction

* Leaving_only_OK_txbw_SSB_2K_3K

* Limti_SSB_TX_BW_2K_3K
This commit is contained in:
Brumi-2021 2024-07-06 13:34:09 +02:00 committed by GitHub
parent b53b5c70d3
commit 032168234a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 73 additions and 18 deletions

View file

@ -81,6 +81,25 @@ SSB::SSB()
mode = Mode::LSB;
}
void SSB::set_fs_div_factor(float new_bw_ssb) {
switch ((int)new_bw_ssb / 1000) {
case 2:
fs_div_factor = 192; // TXBW_ssb = 2khz = fs/4 ; fs of Hilbert Transform => 8khz fs Hilbert = 1536.000/8000= 192
break;
case 3:
fs_div_factor = 128; // TXBW_ssb = 3khz = fs/4 ; fs of Hilbert Transform => 12khz fs Hilbert = 1536.000/12000= 128
break;
/* TODO pending to investigate 4khz, now is making aliasing folding with audio sweep .
case 4:
fs_div_factor = 96; // TXBW_ssb = 4khz = fs/4 ; fs of Hilbert Transform => 16khz fs Hilbert = 1536.000/16000= 96
break;
*/
default:
fs_div_factor = 128; // TXBW_ssb = 3khz = fs/4 ; fs of Hilbert Transform => 12khz fs Hilbert = 1536.000/12000= 128
break;
}
}
void SSB::execute(const buffer_s16_t& audio, const buffer_c8_t& buffer, bool& configured_in, uint32_t& new_beep_index, uint32_t& new_beep_timer, TXProgressMessage& new_txprogress_message, AudioLevelReportMessage& new_level_message, uint32_t& new_power_acc_count, uint32_t& new_divider) {
// unused
(void)configured_in;
@ -93,9 +112,10 @@ void SSB::execute(const buffer_s16_t& audio, const buffer_c8_t& buffer, bool& co
int8_t re = 0, im = 0;
for (size_t counter = 0; counter < buffer.count; counter++) {
if (counter % 128 == 0) {
if (counter % fs_div_factor == 0) { // Ex. TX bw_ssb 3khz =fs/4 Hilbert Transform sample rate, 128 = 1.536.000 hz / 12.000 hz (fs H.T.)
float i = 0.0, q = 0.0;
// over = 1.536.000/24khz = 64 . (Mic audio has fixed SR in audio_p buffer[] = 24khz), but in tx mode , we are running Transceiver fs @tx = 1.536.000 Hz.
sample = audio.p[counter / over] >> audio_shift_bits_s16_AM_DSB_SSB; // originally fixed >> 2, now >>2 for AK, 0,1,2,3 for WM (boost off)
sample *= audio_gain; // Apply GAIN Scale factor to the audio TX modulation.