This commit is contained in:
furrtek
2017-11-02 17:11:26 +00:00
parent 6e7b2c751f
commit 2ec24c9fa8
11 changed files with 136 additions and 99 deletions
+12 -3
View File
@@ -62,11 +62,18 @@ AFSKRxView::AFSKRxView(NavigationView& nav) {
&field_frequency,
&text_debug,
&button_modem_setup,
&record_view,
&console
});
// DEBUG
record_view.on_error = [&nav](std::string message) {
nav.display_modal("Error", message);
};
record_view.set_sampling_rate(24000);
// Auto-configure modem for LCR RX (will be removed later)
update_freq(462713300); // 162950000
update_freq(467225500); // 462713300
auto def_bell202 = &modem_defs[0];
persistent_memory::set_modem_baudrate(def_bell202->baudrate);
serial_format_t serial_format;
@@ -82,7 +89,6 @@ AFSKRxView::AFSKRxView(NavigationView& nav) {
update_freq(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) {
update_freq(f);
@@ -106,6 +112,7 @@ AFSKRxView::AFSKRxView(NavigationView& nav) {
receiver_model.set_sampling_rate(3072000);
receiver_model.set_baseband_bandwidth(1750000);
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
receiver_model.enable();
}
@@ -114,6 +121,7 @@ void AFSKRxView::on_data(uint32_t value, bool is_data) {
std::string str_byte = "";
if (is_data) {
// Colorize differently after message splits
str_console += (char)((console_color & 3) + 9);
//value = deframe_word(value);
@@ -122,7 +130,7 @@ void AFSKRxView::on_data(uint32_t value, bool is_data) {
value = ((value & 0xF0) >> 4) | ((value & 0x0F) << 4); // EFGHABCD
value = ((value & 0xCC) >> 2) | ((value & 0x33) << 2); // GHEFCDAB
value = ((value & 0xAA) >> 1) | ((value & 0x55) << 1); // HGFEDCBA
value &= 0x7F;
value &= 0x7F; // Ignore parity, which is the MSB now
if ((value >= 32) && (value < 127)) {
str_console += (char)value; // Printable
@@ -139,6 +147,7 @@ void AFSKRxView::on_data(uint32_t value, bool is_data) {
if (logger) str_log += str_byte;
if ((value != 0x7F) && (prev_value == 0x7F)) {
// Message split
console.writeln("");
console_color++;