Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setfreq usb command #2235

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions firmware/application/apps/analog_audio_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,7 @@ void AnalogAudioView::handle_coded_squelch(uint32_t value) {
text_ctcss.set(tone_key_string_by_value(value, text_ctcss.parent_rect().width() / 8));
}

void AnalogAudioView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}
} /* namespace ui */
9 changes: 9 additions & 0 deletions firmware/application/apps/analog_audio_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,21 @@ class AnalogAudioView : public View {

void handle_coded_squelch(uint32_t value);

void on_freqchg(int64_t freq);

MessageHandlerRegistration message_handler_coded_squelch{
Message::ID::CodedSquelch,
[this](const Message* p) {
const auto message = *reinterpret_cast<const CodedSquelchMessage*>(p);
this->handle_coded_squelch(message.value);
}};

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 */
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/capture_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,8 @@ void CaptureAppView::focus() {
record_view.focus();
}

void CaptureAppView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

} /* namespace ui */
9 changes: 9 additions & 0 deletions firmware/application/apps/capture_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ class CaptureAppView : public View {
3};

spectrum::WaterfallView waterfall{};

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

void on_freqchg(int64_t freq);
};

} /* namespace ui */
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/ert_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,8 @@ void ERTAppView::on_show_list() {
recent_entries_view.focus();
}

void ERTAppView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

} /* namespace ui */
8 changes: 8 additions & 0 deletions firmware/application/apps/ert_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ class ERTAppView : public View {
this->on_packet(packet);
}};

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

void on_freqchg(int64_t freq);
void on_packet(const ert::Packet& packet);
void on_show_list();
};
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/pocsag_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ void POCSAGAppView::on_stats(const POCSAGStatsMessage* stats) {
widget_frames.set_sync(stats->has_sync);
}

void POCSAGAppView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

void BaudIndicator::paint(Painter& painter) {
auto p = screen_pos();
char top = '-';
Expand Down
9 changes: 9 additions & 0 deletions firmware/application/apps/pocsag_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,15 @@ class POCSAGAppView : public View {
Console console{
{0, 2 * 16 + 6, screen_width, screen_height - 54}};

void on_freqchg(int64_t freq);

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

MessageHandlerRegistration message_handler_packet{
Message::ID::POCSAGPacket,
[this](Message* const p) {
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/ui_aprs_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ APRSRxView::APRSRxView(NavigationView& nav, Rect parent_rect)
receiver_model.enable();
}

void APRSRxView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

void APRSRxView::on_packet(const APRSPacketMessage* message) {
std::string str_console = "\x1B";

Expand Down
8 changes: 8 additions & 0 deletions firmware/application/apps/ui_aprs_rx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class APRSRxView : public View {

std::string title() const override { return "APRS RX"; };
void on_packet(const APRSPacketMessage* message);
void on_freqchg(int64_t freq);

private:
void on_data(uint32_t value, bool is_data);
Expand Down Expand Up @@ -271,6 +272,13 @@ class APRSRXView : public View {
this->view_stream.on_packet(message);
this->view_table.on_pkt(message);
}};

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

} /* namespace ui */
Expand Down
5 changes: 5 additions & 0 deletions firmware/application/apps/ui_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,9 @@ void LevelView::handle_coded_squelch(const uint32_t value) {
text_ctcss.set(" ");
}

void LevelView::on_freqchg(int64_t freq) {
receiver_model.set_target_frequency(freq);
button_frequency.set_text("<" + to_string_short_freq(freq) + " MHz>");
}

} /* namespace ui */
9 changes: 9 additions & 0 deletions firmware/application/apps/ui_level.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ class LevelView : public View {

void handle_coded_squelch(const uint32_t value);

void on_freqchg(int64_t freq);

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

MessageHandlerRegistration message_handler_coded_squelch{
Message::ID::CodedSquelch,
[this](const Message* const p) {
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/ui_sonde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,8 @@ void SondeView::on_packet(const sonde::Packet& packet) {
}
}

void SondeView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

} /* namespace ui */
8 changes: 8 additions & 0 deletions firmware/application/apps/ui_sonde.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ class SondeView : public View {
const auto message = static_cast<const OrientationDataMessage*>(p);
this->on_orientation(message);
}};
MessageHandlerRegistration message_handler_freqchg{
Message::ID::FreqChangeCommand,
[this](Message* const p) {
const auto message = static_cast<const FreqChangeCommandMessage*>(p);
this->on_freqchg(message->freq);
}};

void on_freqchg(int64_t freq);

void on_gps(const GPSPosDataMessage* msg);
void on_orientation(const OrientationDataMessage* msg);
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/ui_subghzd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ std::string SubGhzDView::pad_string_with_spaces(int snakes) {
return paddedStr;
}

void SubGhzDView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

template <>
void RecentEntriesTable<ui::SubGhzDRecentEntries>::draw(
const Entry& entry,
Expand Down
8 changes: 8 additions & 0 deletions firmware/application/apps/ui_subghzd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ class SubGhzDView : public View {
}};
SubGhzDRecentEntriesView recent_entries_view{columns, recent};

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

MessageHandlerRegistration message_handler_packet{
Message::ID::SubGhzDData,
[this](Message* const p) {
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/apps/ui_weatherstation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ std::string WeatherView::pad_string_with_spaces(int snakes) {
return paddedStr;
}

void WeatherView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

template <>
void RecentEntriesTable<ui::WeatherRecentEntries>::draw(
const Entry& entry,
Expand Down
8 changes: 8 additions & 0 deletions firmware/application/apps/ui_weatherstation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ class WeatherView : public View {
}};
WeatherRecentEntriesView recent_entries_view{columns, recent};

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

MessageHandlerRegistration message_handler_packet{
Message::ID::WeatherData,
[this](Message* const p) {
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/external/afsk_rx/ui_afsk_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ void AFSKRxView::on_data(uint32_t value, bool is_data) {
}
}

void AFSKRxView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

AFSKRxView::~AFSKRxView() {
audio::output::stop();
receiver_model.disable();
Expand Down
9 changes: 9 additions & 0 deletions firmware/application/external/afsk_rx/ui_afsk_rx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ class AFSKRxView : public View {
const auto message = static_cast<const AFSKDataMessage*>(p);
this->on_data(message->value, message->is_data);
}};

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

void on_freqchg(int64_t freq);
};

} // namespace ui::external_app::afsk_rx
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/external/analogtv/analog_tv_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,8 @@ void AnalogTvView::update_modulation(const ReceiverModel::Mode modulation) {
receiver_model.enable();
}

void AnalogTvView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

} // namespace ui::external_app::analogtv
9 changes: 9 additions & 0 deletions firmware/application/external/analogtv/analog_tv_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ class AnalogTvView : public View {
void set_options_widget(std::unique_ptr<Widget> new_widget);

void update_modulation(const ReceiverModel::Mode modulation);

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

void on_freqchg(int64_t freq);
};

} // namespace ui::external_app::analogtv
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/external/foxhunt/ui_foxhunt_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,8 @@ void FoxhuntRxView::on_orientation(const OrientationDataMessage* msg) {
geomap.update_my_orientation(msg->angle, true);
}

void FoxhuntRxView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

} // namespace ui::external_app::foxhunt_rx
8 changes: 8 additions & 0 deletions firmware/application/external/foxhunt/ui_foxhunt_rx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ class FoxhuntRxView : public View {
[this](const Message* const p) {
this->on_statistics_update(static_cast<const ChannelStatisticsMessage*>(p)->statistics);
}};
MessageHandlerRegistration message_handler_freqchg{
Message::ID::FreqChangeCommand,
[this](Message* const p) {
const auto message = static_cast<const FreqChangeCommandMessage*>(p);
this->on_freqchg(message->freq);
}};

void on_freqchg(int64_t freq);

float my_lat = 200;
float my_lon = 200;
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/external/nrf_rx/ui_nrf_rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ void NRFRxView::on_data(uint32_t value, bool is_data) {
}
}

void NRFRxView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

NRFRxView::~NRFRxView() {
audio::output::stop();
receiver_model.disable();
Expand Down
9 changes: 9 additions & 0 deletions firmware/application/external/nrf_rx/ui_nrf_rx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ class NRFRxView : public View {
const auto message = static_cast<const AFSKDataMessage*>(p);
this->on_data(message->value, message->is_data);
}};

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

void on_freqchg(int64_t freq);
};

} /* namespace ui::external_app::nrf_rx */
Expand Down
4 changes: 4 additions & 0 deletions firmware/application/external/protoview/ui_protoview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ void ProtoView::on_data(const ProtoViewDataMessage* message) {
draw2();
}

void ProtoView::on_freqchg(int64_t freq) {
field_frequency.set_value(freq);
}

ProtoView::~ProtoView() {
audio::output::stop();
receiver_model.disable();
Expand Down
9 changes: 9 additions & 0 deletions firmware/application/external/protoview/ui_protoview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ class ProtoView : public View {
[this](const Message* const) {
this->on_timer();
}};

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

void on_freqchg(int64_t freq);
};

} // namespace ui::external_app::protoview
Expand Down
Loading
Loading