* Fix for #2538

Fix for #2538
Added on_bandwidth_changed Callback to ui_transmitter.hpp
Modified the field_bw.on_change lambda in the TransmitterView constructor to trigger the on_bandwidth_changed callback
Connected the Callback in ui_siggen.cpp

I am not a C++ programmer so this change was proposed by Gemini AI.

I have built and tested the App and it works as expected and I don't think the change will have any unexpected side effects.

* Fix clang issues

Fix clang issues

* Update ui_transmitter.cpp

typo

* Revised change

The proposed change mirrors the way a change to the frequency (on_edit_frequency) is triggered in ui_siggen by the tx_view.
The bw parameter is not passed because it is stored in _setting in the tx_view and will be read by update_config.
A change to the bw is not checked against auto_update to keep its behaviour consistent with a change to the gain, amplitude or frequency.

* Make changes to the channel_bandwidth dynamic whist playing

Behaviour of channel bandwidth is now consistent with frequency, amp and gain.

* comment edit

* revert hackrf submodule checkpoint to the repo

* comment

---------

Co-authored-by: zxkmm <zxkmm@hotmail.com>
This commit is contained in:
Richard 2025-05-02 05:19:41 +01:00 committed by GitHub
parent c2e05dea48
commit bd781ce37b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 8 deletions

View file

@ -91,10 +91,6 @@ void SoundBoardView::start_tx(const uint32_t id) {
auto reader = std::make_unique<WAVFileReader>();
uint32_t tone_key_index = options_tone_key.selected_index();
uint32_t sample_rate;
uint8_t bits_per_sample;
stop();
if (!reader->open(u"/WAV/" + file_list[id].native())) {
@ -108,7 +104,9 @@ void SoundBoardView::start_tx(const uint32_t id) {
// button_play.set_bitmap(&bitmap_stop);
sample_rate = reader->sample_rate();
uint32_t sample_rate = reader->sample_rate();
tone_key_index = options_tone_key.selected_index();
bits_per_sample = reader->bits_per_sample();
replay_thread = std::make_unique<ReplayThread>(
@ -155,6 +153,23 @@ void SoundBoardView::on_tx_progress(const uint32_t progress) {
progressbar.set_value(progress);
}
void SoundBoardView::update_config() {
// NB: this were called by the on_bandwidth_changed() callback,
// so other val would be updated too when bw changed. currently it's safe but be careful.
baseband::set_audiotx_config(
1536000 / 20, // Update vu-meter at 20Hz
transmitter_model.channel_bandwidth(),
0, // Gain is unused
8, // shift_bits_s16, default 8 bits, but also unused
bits_per_sample,
TONES_F2D(tone_key_frequency(tone_key_index), TONES_SAMPLERATE),
false, // AM
false, // DSB
false, // USB
false // LSB
);
}
void SoundBoardView::on_select_entry() {
tx_view.focus();
}
@ -289,6 +304,10 @@ SoundBoardView::SoundBoardView(
};
};
tx_view.on_bandwidth_changed = [this]() {
update_config();
};
tx_view.on_start = [this]() {
start_tx(menu_view.highlighted_index());
};