BW setting in TX view should now be used everywhere

Jammer center and width value editing bugfix
This commit is contained in:
furrtek 2017-08-12 19:28:57 +01:00
parent 81eb96f870
commit 728bb64543
11 changed files with 27 additions and 28 deletions

View File

@ -50,7 +50,6 @@ Continuous (Fox-oring)
60s transmit, 240s space (Classic 1/5 min) 60s transmit, 240s space (Classic 1/5 min)
60s transmit, 360s space (Classic 1/7 min) 60s transmit, 360s space (Classic 1/7 min)
*/ */
//TODO: Use transmittermodel bw setting
//TODO: Use TransmitterView in TEDI/LCR, Numbers, ... //TODO: Use TransmitterView in TEDI/LCR, Numbers, ...
//TODO: FreqMan: Remove and rename categories //TODO: FreqMan: Remove and rename categories
//TODO: Wav visualizer //TODO: Wav visualizer

View File

@ -79,12 +79,12 @@ void TransmitterModel::set_vga(int32_t v_db) {
update_vga(); update_vga();
} }
uint32_t TransmitterModel::bandwidth() const { uint32_t TransmitterModel::channel_bandwidth() const {
return bandwidth_; return channel_bandwidth_;
} }
void TransmitterModel::set_bandwidth(uint32_t v) { void TransmitterModel::set_channel_bandwidth(uint32_t v) {
bandwidth_ = v; channel_bandwidth_ = v;
} }
uint32_t TransmitterModel::sampling_rate() const { uint32_t TransmitterModel::sampling_rate() const {

View File

@ -53,8 +53,8 @@ public:
int32_t tx_gain() const; int32_t tx_gain() const;
void set_tx_gain(int32_t v_db); void set_tx_gain(int32_t v_db);
uint32_t bandwidth() const; uint32_t channel_bandwidth() const;
void set_bandwidth(uint32_t v); void set_channel_bandwidth(uint32_t v);
uint32_t sampling_rate() const; uint32_t sampling_rate() const;
void set_sampling_rate(uint32_t v); void set_sampling_rate(uint32_t v);
@ -66,7 +66,7 @@ private:
bool enabled_ { false }; bool enabled_ { false };
bool rf_amp_ { true }; bool rf_amp_ { true };
int32_t lna_gain_db_ { 0 }; int32_t lna_gain_db_ { 0 };
uint32_t bandwidth_ { 1 }; uint32_t channel_bandwidth_ { 1 };
uint32_t baseband_bandwidth_ { max2837::filter::bandwidth_minimum }; uint32_t baseband_bandwidth_ { max2837::filter::bandwidth_minimum };
int32_t vga_gain_db_ { 8 }; int32_t vga_gain_db_ { 8 };
int32_t tx_gain_db_ { 47 }; int32_t tx_gain_db_ { 47 };

View File

@ -61,7 +61,7 @@ void BHTView::start_tx() {
for (c = 0; c < 16; c++) for (c = 0; c < 16; c++)
baseband::set_tone(c, ccir_deltas[c], XY_TONE_LENGTH); baseband::set_tone(c, ccir_deltas[c], XY_TONE_LENGTH);
baseband::set_tones_config(transmitter_model.bandwidth(), XY_SILENCE, 20, false, false); baseband::set_tones_config(transmitter_model.channel_bandwidth(), XY_SILENCE, 20, false, false);
} }
void BHTView::on_tx_progress(const int progress, const bool done) { void BHTView::on_tx_progress(const int progress, const bool done) {
@ -279,7 +279,7 @@ BHTView::BHTView(NavigationView& nav) {
tx_view.on_edit_frequency = [this, &nav]() { tx_view.on_edit_frequency = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency()); auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) { new_view->on_changed = [this](rf::Frequency f) {
receiver_model.set_tuning_frequency(f); transmitter_model.set_tuning_frequency(f);
}; };
}; };

View File

@ -153,7 +153,7 @@ RangeView::RangeView(NavigationView& nav) {
}; };
button_center.on_select = [this, &nav](Button& button) { button_center.on_select = [this, &nav](Button& button) {
auto new_view = nav.push<FrequencyKeypadView>(frequency_range.max); auto new_view = nav.push<FrequencyKeypadView>(center);
new_view->on_changed = [this, &button](rf::Frequency f) { new_view->on_changed = [this, &button](rf::Frequency f) {
update_center(f); update_center(f);
}; };
@ -162,7 +162,7 @@ RangeView::RangeView(NavigationView& nav) {
}; };
button_width.on_select = [this, &nav](Button& button) { button_width.on_select = [this, &nav](Button& button) {
auto new_view = nav.push<FrequencyKeypadView>(frequency_range.max); auto new_view = nav.push<FrequencyKeypadView>(width);
new_view->on_changed = [this, &button](rf::Frequency f) { new_view->on_changed = [this, &button](rf::Frequency f) {
update_width(f); update_width(f);
}; };

View File

@ -67,7 +67,7 @@ void MicTXView::set_tx(bool enable) {
baseband::set_audiotx_data( baseband::set_audiotx_data(
1536000U / 20, // 20Hz level update 1536000U / 20, // 20Hz level update
transmitter_model.bandwidth(), transmitter_model.channel_bandwidth(),
mic_gain_x10, mic_gain_x10,
ctcss_enabled, ctcss_enabled,
(uint32_t)((ctcss_tones[ctcss_index].frequency / 1536000.0) * 0xFFFFFFFFULL) (uint32_t)((ctcss_tones[ctcss_index].frequency / 1536000.0) * 0xFFFFFFFFULL)
@ -181,7 +181,7 @@ MicTXView::MicTXView(
}; };
field_bw.on_change = [this](uint32_t v) { field_bw.on_change = [this](uint32_t v) {
transmitter_model.set_bandwidth(v * 1000); transmitter_model.set_channel_bandwidth(v * 1000);
}; };
field_bw.set_value(10); field_bw.set_value(10);

View File

@ -108,7 +108,7 @@ bool MorseView::start_tx() {
if (modulation == CW) { if (modulation == CW) {
ookthread = chThdCreateStatic(ookthread_wa, sizeof(ookthread_wa), NORMALPRIO + 10, ookthread_fn, this); ookthread = chThdCreateStatic(ookthread_wa, sizeof(ookthread_wa), NORMALPRIO + 10, ookthread_fn, this);
} else if (modulation == FM) { } else if (modulation == FM) {
baseband::set_tones_config(transmitter_model.bandwidth(), 0, symbol_count, false, false); baseband::set_tones_config(transmitter_model.channel_bandwidth(), 0, symbol_count, false, false);
} }
return true; return true;

View File

@ -131,7 +131,7 @@ void NuoptixView::transmit(bool setup) {
shared_memory.bb_data.tones_data.silence = NUOPTIX_TONE_LENGTH; // 49ms tone, 49ms space shared_memory.bb_data.tones_data.silence = NUOPTIX_TONE_LENGTH; // 49ms tone, 49ms space
audio::set_rate(audio::Rate::Hz_24000); audio::set_rate(audio::Rate::Hz_24000);
baseband::set_tones_config(transmitter_model.bandwidth(), 0, 6 * 2, true, true); baseband::set_tones_config(transmitter_model.channel_bandwidth(), 0, 6 * 2, true, true);
timecode++; timecode++;
} }

View File

@ -53,7 +53,7 @@ void SigGenView::start_tx() {
auto duration = field_stop.value(); auto duration = field_stop.value();
if (!checkbox_auto.value()) if (!checkbox_auto.value())
duration = 0; duration = 0;
baseband::set_siggen_config(transmitter_model.bandwidth(), options_shape.selected_index_value(), duration); baseband::set_siggen_config(transmitter_model.channel_bandwidth(), options_shape.selected_index_value(), duration);
} }
void SigGenView::update_tone() { void SigGenView::update_tone() {

View File

@ -75,8 +75,8 @@ void TransmitterView::on_tuning_frequency_changed(rf::Frequency f) {
receiver_model.set_tuning_frequency(f); receiver_model.set_tuning_frequency(f);
} }
void TransmitterView::on_bandwidth_changed(uint32_t bandwidth) { void TransmitterView::on_channel_bandwidth_changed(uint32_t channel_bandwidth) {
//transmitter_model.set_bandwidth(bandwidth); transmitter_model.set_channel_bandwidth(channel_bandwidth);
} }
void TransmitterView::set_transmitting(const bool transmitting) { void TransmitterView::set_transmitting(const bool transmitting) {
@ -100,7 +100,7 @@ void TransmitterView::focus() {
} }
TransmitterView::TransmitterView( TransmitterView::TransmitterView(
const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock const Coord y, const uint64_t frequency_step, const uint32_t channel_bandwidth, const bool lock
) : lock_ { lock } ) : lock_ { lock }
{ {
set_parent_rect({ 0, y, 30 * 8, 6 * 8 }); set_parent_rect({ 0, y, 30 * 8, 6 * 8 });
@ -118,16 +118,16 @@ TransmitterView::TransmitterView(
field_frequency.set_focusable(false); field_frequency.set_focusable(false);
field_frequency.set_style(&style_locked); field_frequency.set_style(&style_locked);
} else { } else {
if (bandwidth) { if (channel_bandwidth) {
add_children({ add_children({
&text_bw, &text_bw,
&field_bw &field_bw
}); });
field_bw.on_change = [this](int32_t bandwidth) { field_bw.on_change = [this](int32_t v) {
on_bandwidth_changed(bandwidth * 1000); on_channel_bandwidth_changed(v * 1000);
}; };
field_bw.set_value(bandwidth); field_bw.set_value(channel_bandwidth);
} }
} }

View File

@ -52,10 +52,10 @@ public:
std::function<void(void)> on_start { }; std::function<void(void)> on_start { };
std::function<void(void)> on_stop { }; std::function<void(void)> on_stop { };
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t bandwidth, const bool lock); TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t channel_bandwidth, const bool lock);
TransmitterView( TransmitterView(
const Coord y, const uint32_t frequency_step, const uint32_t bandwidth const Coord y, const uint32_t frequency_step, const uint32_t channel_bandwidth
) : TransmitterView { y, frequency_step, bandwidth, false } ) : TransmitterView { y, frequency_step, channel_bandwidth, false }
{ {
} }
@ -117,7 +117,7 @@ private:
}; };
void on_tuning_frequency_changed(rf::Frequency f); void on_tuning_frequency_changed(rf::Frequency f);
void on_bandwidth_changed(uint32_t bandwidth); void on_channel_bandwidth_changed(uint32_t channel_bandwidth);
}; };
} /* namespace ui */ } /* namespace ui */