From d50ea3cc50b48e3aeac148fcc8cc48e6852cf9b4 Mon Sep 17 00:00:00 2001
From: euquiq <31453004+euquiq@users.noreply.github.com>
Date: Fri, 7 Aug 2020 16:33:17 -0300
Subject: [PATCH] fixed a bug, and some fine-tuning

Earlier code did not start with squelch totally open, but a tiny bit closed.  (now at app loading, squelch is truly set up with the same value it shows on screen).

I also hardcoded the NFM sampling rate and baseband bandwidth. It seemed "the right thing to do".
---
 firmware/application/apps/ui_mictx.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/firmware/application/apps/ui_mictx.cpp b/firmware/application/apps/ui_mictx.cpp
index e8fc8ce9..0d7b2367 100644
--- a/firmware/application/apps/ui_mictx.cpp
+++ b/firmware/application/apps/ui_mictx.cpp
@@ -126,15 +126,15 @@ void MicTXView::on_tuning_frequency_changed(rf::Frequency f) {
 
 void MicTXView::rxaudio(bool is_on) {
 	if (is_on) {
+		audio::input::stop();
 		baseband::shutdown();
 		baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
 		receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
-		//receiver_model.set_sampling_rate(sampling_rate); //**
-		//receiver_model.set_baseband_bandwidth(1750000);	//**
-		receiver_model.enable();
+		receiver_model.set_sampling_rate(3072000);
+		receiver_model.set_baseband_bandwidth(1750000);	
 		receiver_model.set_tuning_frequency(field_frequency.value()); //probably this too can be commented out.
-		audio::output::start();	
-
+		receiver_model.enable();
+		audio::output::start();
 	} else {	//These incredibly convoluted steps are required for the vumeter to reappear when stopping RX.
 		receiver_model.disable();
 		baseband::shutdown();
@@ -255,6 +255,7 @@ MicTXView::MicTXView(
 		receiver_model.set_squelch_level(100 - v);	
 	};
 	field_squelch.set_value(0);
+	receiver_model.set_squelch_level(0);
 
 	transmitter_model.set_sampling_rate(sampling_rate);
 	transmitter_model.set_baseband_bandwidth(1750000);
-- 
GitLab