Merge pull request #359 from XxOinvizioNxX/next

Add FrequencyStepView field to the TransmitterView class
This commit is contained in:
Erwin Ried 2021-06-22 12:30:59 +02:00 committed by GitHub
commit 52376b12b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -103,6 +103,7 @@ void TransmitterView::set_transmitting(const bool transmitting) {
void TransmitterView::on_show() { void TransmitterView::on_show() {
field_frequency.set_value(transmitter_model.tuning_frequency()); field_frequency.set_value(transmitter_model.tuning_frequency());
field_frequency_step.set_by_value(receiver_model.frequency_step());
field_gain.set_value(transmitter_model.tx_gain()); field_gain.set_value(transmitter_model.tx_gain());
field_amp.set_value(transmitter_model.rf_amp() ? 14 : 0); field_amp.set_value(transmitter_model.rf_amp() ? 14 : 0);
@ -122,6 +123,7 @@ TransmitterView::TransmitterView(
add_children({ add_children({
&field_frequency, &field_frequency,
&field_frequency_step,
&text_gain, &text_gain,
&field_gain, &field_gain,
&button_start, &button_start,
@ -157,6 +159,10 @@ TransmitterView::TransmitterView(
if (on_edit_frequency) if (on_edit_frequency)
on_edit_frequency(); on_edit_frequency();
}; };
field_frequency_step.on_change = [this](size_t, OptionsField::value_t v) {
this->field_frequency.set_step(v);
};
field_gain.on_change = [this](uint32_t tx_gain) { field_gain.on_change = [this](uint32_t tx_gain) {
on_tx_gain_changed(tx_gain); on_tx_gain_changed(tx_gain);

View File

@ -124,11 +124,11 @@ private:
}; };
Text text_bw { Text text_bw {
{ 11 * 8, 1 * 8, 9 * 8, 1 * 16 }, { 18 * 8, 1 * 8, 3 * 8, 1 * 16 },
"BW: kHz" "kHz"
}; };
NumberField field_bw { NumberField field_bw {
{ 14 * 8, 1 * 8 }, { 15 * 8, 1 * 8 },
3, 3,
{ 1, 150 }, { 1, 150 },
1, 1,
@ -152,6 +152,10 @@ private:
{ 21 * 8, 1 * 8, 9 * 8, 32 }, { 21 * 8, 1 * 8, 9 * 8, 32 },
"START" "START"
}; };
FrequencyStepView field_frequency_step {
{ 10 * 8 - 4, 1 * 8 },
};
void on_tuning_frequency_changed(rf::Frequency f); void on_tuning_frequency_changed(rf::Frequency f);
void on_channel_bandwidth_changed(uint32_t channel_bandwidth); void on_channel_bandwidth_changed(uint32_t channel_bandwidth);