mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-03-02 11:39:21 -05:00
added a frequency field to the ERT app
This commit is contained in:
parent
1cbe5cb293
commit
bdbd616a84
@ -65,9 +65,13 @@ std::string commodity_type(CommodityType value) {
|
|||||||
|
|
||||||
} /* namespace ert */
|
} /* namespace ert */
|
||||||
|
|
||||||
void ERTLogger::on_packet(const ert::Packet& packet) {
|
void ERTLogger::on_packet(const ert::Packet& packet, const uint32_t target_frequency) {
|
||||||
const auto formatted = packet.symbols_formatted();
|
const auto formatted = packet.symbols_formatted();
|
||||||
std::string entry = ert::format::type(packet.type()) + " " + formatted.data + "/" + formatted.errors;
|
|
||||||
|
// TODO: function doesn't take uint64_t, so when >= 1<<32, weirdness will ensue!
|
||||||
|
const auto target_frequency_str = to_string_dec_uint(target_frequency, 10);
|
||||||
|
|
||||||
|
std::string entry = target_frequency_str + " " + ert::format::type(packet.type()) + " " + formatted.data + "/" + formatted.errors;
|
||||||
log_file.write_entry(packet.received_at(), entry);
|
log_file.write_entry(packet.received_at(), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,10 +103,12 @@ void RecentEntriesTable<ERTRecentEntries>::draw(
|
|||||||
painter.draw_string(target_rect.location(), style, line);
|
painter.draw_string(target_rect.location(), style, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERTAppView::ERTAppView(NavigationView&) {
|
ERTAppView::ERTAppView(NavigationView& nav)
|
||||||
|
: nav_{nav} {
|
||||||
baseband::run_image(portapack::spi_flash::image_tag_ert);
|
baseband::run_image(portapack::spi_flash::image_tag_ert);
|
||||||
|
|
||||||
add_children({
|
add_children({
|
||||||
|
&field_frequency,
|
||||||
&field_rf_amp,
|
&field_rf_amp,
|
||||||
&field_lna,
|
&field_lna,
|
||||||
&field_vga,
|
&field_vga,
|
||||||
@ -110,6 +116,8 @@ ERTAppView::ERTAppView(NavigationView&) {
|
|||||||
&recent_entries_view,
|
&recent_entries_view,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
field_frequency.set_step(1000000);
|
||||||
|
|
||||||
receiver_model.enable();
|
receiver_model.enable();
|
||||||
|
|
||||||
logger = std::make_unique<ERTLogger>();
|
logger = std::make_unique<ERTLogger>();
|
||||||
@ -134,7 +142,7 @@ void ERTAppView::set_parent_rect(const Rect new_parent_rect) {
|
|||||||
|
|
||||||
void ERTAppView::on_packet(const ert::Packet& packet) {
|
void ERTAppView::on_packet(const ert::Packet& packet) {
|
||||||
if (logger) {
|
if (logger) {
|
||||||
logger->on_packet(packet);
|
logger->on_packet(packet, receiver_model.target_frequency());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet.crc_ok()) {
|
if (packet.crc_ok()) {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "ui_navigation.hpp"
|
#include "ui_navigation.hpp"
|
||||||
#include "ui_receiver.hpp"
|
#include "ui_receiver.hpp"
|
||||||
|
#include "ui_freq_field.hpp"
|
||||||
#include "ui_rssi.hpp"
|
#include "ui_rssi.hpp"
|
||||||
#include "ui_channel.hpp"
|
#include "ui_channel.hpp"
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ class ERTLogger {
|
|||||||
return log_file.append(filename);
|
return log_file.append(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_packet(const ert::Packet& packet);
|
void on_packet(const ert::Packet& packet, const uint32_t target_frequency);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LogFile log_file{};
|
LogFile log_file{};
|
||||||
@ -126,6 +127,7 @@ class ERTAppView : public View {
|
|||||||
ERTRecentEntries recent{};
|
ERTRecentEntries recent{};
|
||||||
std::unique_ptr<ERTLogger> logger{};
|
std::unique_ptr<ERTLogger> logger{};
|
||||||
|
|
||||||
|
NavigationView& nav_;
|
||||||
RxRadioState radio_state_{
|
RxRadioState radio_state_{
|
||||||
911600000 /* frequency */,
|
911600000 /* frequency */,
|
||||||
2500000 /* bandwidth */,
|
2500000 /* bandwidth */,
|
||||||
@ -143,6 +145,10 @@ class ERTAppView : public View {
|
|||||||
|
|
||||||
static constexpr auto header_height = 1 * 16;
|
static constexpr auto header_height = 1 * 16;
|
||||||
|
|
||||||
|
RxFrequencyField field_frequency{
|
||||||
|
{5 * 8, 0 * 16},
|
||||||
|
nav_};
|
||||||
|
|
||||||
RFAmpField field_rf_amp{
|
RFAmpField field_rf_amp{
|
||||||
{13 * 8, 0 * 16}};
|
{13 * 8, 0 * 16}};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user