Fixed the mixing of aircraft coordinates in the details view, by

checking if the ICAO address of the frame and the current item
in the details view match. Slight refactor by placing the decimal
to string conversion function into the string_format module.

Added fix in the scope of issue #365

FrequencyStepView field in TransmitterView class

FrequencyStepView field in TransmitterView class

Update ui_transmitter.hpp

Update credits

Fixed left padding of the decimal part of the numbers.
This commit is contained in:
teixeluis
2021-06-23 23:52:15 +01:00
parent 97349b06ef
commit fe806b7bdc
12 changed files with 77 additions and 55 deletions

View File

@@ -63,17 +63,9 @@ GeoPos::GeoPos(
const auto changed_fn = [this](int32_t) {
float lat_value = lat();
float lon_value = lon();
double integer_part;
double fractional_part;
fractional_part = modf(lat_value, &integer_part) * 100000;
if (fractional_part < 0)
fractional_part = -fractional_part;
text_lat_decimal.set(to_string_dec_int(integer_part) + "." + to_string_dec_uint(fractional_part, 5));
fractional_part = modf(lon_value, &integer_part) * 100000;
if (fractional_part < 0)
fractional_part = -fractional_part;
text_lon_decimal.set(to_string_dec_int(integer_part) + "." + to_string_dec_uint(fractional_part, 5));
text_lat_decimal.set(to_string_decimal(lat_value, 5));
text_lon_decimal.set(to_string_decimal(lon_value, 5));
if (on_change && report_change)
on_change(altitude(), lat_value, lon_value);

View File

@@ -103,6 +103,7 @@ void TransmitterView::set_transmitting(const bool transmitting) {
void TransmitterView::on_show() {
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_amp.set_value(transmitter_model.rf_amp() ? 14 : 0);
@@ -122,6 +123,7 @@ TransmitterView::TransmitterView(
add_children({
&field_frequency,
&field_frequency_step,
&text_gain,
&field_gain,
&button_start,
@@ -157,6 +159,10 @@ TransmitterView::TransmitterView(
if (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) {
on_tx_gain_changed(tx_gain);

View File

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