Added a bunch of notes about Radiosonde RX (help !)

This commit is contained in:
furrtek
2017-10-06 05:35:25 +01:00
parent d3222c27ca
commit f00125879d
4 changed files with 93 additions and 23 deletions

View File

@@ -53,14 +53,14 @@ SondeView::SondeView(NavigationView& nav) {
field_frequency.set_value(receiver_model.tuning_frequency());
field_frequency.set_step(receiver_model.frequency_step());
field_frequency.on_change = [this](rf::Frequency f) {
receiver_model.set_tuning_frequency(f);
set_target_frequency(f);
field_frequency.set_value(f);
};
field_frequency.on_edit = [this, &nav]() {
// TODO: Provide separate modal method/scheme?
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
receiver_model.set_tuning_frequency(f);
set_target_frequency(f);
field_frequency.set_value(f);
};
};
@@ -74,6 +74,8 @@ SondeView::SondeView(NavigationView& nav) {
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga()),
});
set_target_frequency(402000000);
/*logger = std::make_unique<SondeLogger>();
if( logger ) {
@@ -90,8 +92,15 @@ void SondeView::focus() {
field_vga.focus();
}
void SondeView::on_packet(const sonde::Packet& packet) {
text_debug.set("Got frame !");
void SondeView::on_packet(const baseband::Packet& packet) {
std::string bin_string;
for (size_t i = 0; i < 30; i++) {
bin_string += to_string_dec_uint(packet[i]);
}
text_debug.set(bin_string);
/*if( logger ) {
logger->on_packet(packet);
}*/
@@ -100,4 +109,13 @@ void SondeView::on_packet(const sonde::Packet& packet) {
}*/
}
void SondeView::set_target_frequency(const uint32_t new_value) {
target_frequency_ = new_value;
radio::set_tuning_frequency(tuning_frequency());
}
uint32_t SondeView::tuning_frequency() const {
return target_frequency_ - (sampling_rate / 4);
}
} /* namespace ui */

View File

@@ -67,6 +67,7 @@ public:
private:
//std::unique_ptr<SondeLogger> logger { };
uint32_t target_frequency_ { };
FrequencyField field_frequency {
{ 0 * 8, 0 * 8 },
@@ -96,12 +97,16 @@ private:
Message::ID::SondePacket,
[this](Message* const p) {
const auto message = static_cast<const SondePacketMessage*>(p);
const sonde::Packet packet { message->type, message->packet };
this->on_packet(packet);
//const sonde::Packet packet { message->type, message->packet };
//this->on_packet(packet);
this->on_packet(message->packet);
}
};
void on_packet(const sonde::Packet& packet);
//void on_packet(const sonde::Packet& packet);
void on_packet(const baseband::Packet& packet);
void set_target_frequency(const uint32_t new_value);
uint32_t tuning_frequency() const;
};
} /* namespace ui */