Skip to content

Commit

Permalink
USB Serial setfreq support (#2246)
Browse files Browse the repository at this point in the history
  • Loading branch information
gullradriel authored Sep 9, 2024
1 parent 281e52d commit d45a172
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions firmware/application/apps/ui_looking_glass_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,17 @@ GlassView::GlassView(
update_display_beep();
}

void GlassView::on_freqchg(int64_t freq) {
int64_t half_range = abs(field_frequency_max.value() - field_frequency_max.value()) / 2;
if (half_range < 1) {
half_range = 1;
}
range_presets.set_selected_index(0); // Manual
update_min(freq - half_range);
update_max(freq + half_range);
on_range_changed();
}

uint8_t GlassView::get_spec_iq_phase_calibration_value() { // define accessor functions inside AnalogAudioView to read & write real iq_phase_calibration_value
return iq_phase_calibration_value;
}
Expand Down
9 changes: 9 additions & 0 deletions firmware/application/apps/ui_looking_glass_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class GlassView : public View {
std::string label{};
};

void on_freqchg(int64_t freq);
int32_t map(int32_t value, int32_t fromLow, int32_t fromHigh, int32_t toLow, int32_t toHigh);
std::vector<preset_entry> presets_db{};
void manage_beep_audio();
Expand Down Expand Up @@ -307,6 +308,7 @@ class GlassView : public View {
const auto message = *reinterpret_cast<const ChannelSpectrumConfigMessage*>(p);
this->fifo = message.fifo;
}};

MessageHandlerRegistration message_handler_frame_sync{
Message::ID::DisplayFrameSync,
[this](const Message* const) {
Expand All @@ -317,6 +319,13 @@ class GlassView : public View {
}
}
}};

MessageHandlerRegistration message_handler_freqchg{
Message::ID::FreqChangeCommand,
[this](Message* const p) {
const auto message = static_cast<const FreqChangeCommandMessage*>(p);
this->on_freqchg(message->freq);
}};
};
} // namespace ui
#endif

0 comments on commit d45a172

Please sign in to comment.