Ejemplo n.º 1
0
CaptureAppView::CaptureAppView(NavigationView& nav) {
	baseband::run_image(portapack::spi_flash::image_tag_capture);

	add_children({ {
		&rssi,
		&channel,
		&field_frequency,
		&field_frequency_step,
		&field_rf_amp,
		&field_lna,
		&field_vga,
		&record_view,
		&waterfall,
	} });

	field_frequency.set_value(target_frequency());
	field_frequency.set_step(receiver_model.frequency_step());
	field_frequency.on_change = [this](rf::Frequency f) {
		this->on_target_frequency_changed(f);
	};
	field_frequency.on_edit = [this, &nav]() {
		// TODO: Provide separate modal method/scheme?
		auto new_view = nav.push<FrequencyKeypadView>(this->target_frequency());
		new_view->on_changed = [this](rf::Frequency f) {
			this->on_target_frequency_changed(f);
			this->field_frequency.set_value(f);
		};
	};

	field_frequency_step.set_by_value(receiver_model.frequency_step());
	field_frequency_step.on_change = [this](size_t, OptionsField::value_t v) {
		receiver_model.set_frequency_step(v);
		this->field_frequency.set_step(v);
	};

	radio::enable({
		tuning_frequency(),
		sampling_rate,
		baseband_bandwidth,
		rf::Direction::Receive,
		receiver_model.rf_amp(),
		static_cast<int8_t>(receiver_model.lna()),
		static_cast<int8_t>(receiver_model.vga()),
	});

	record_view.set_sampling_rate(sampling_rate / 8);
	record_view.on_error = [&nav](std::string message) {
		nav.display_modal("Error", message);
	};
}
Ejemplo n.º 2
0
AISAppView::AISAppView(NavigationView&) {
	baseband::run_image(portapack::spi_flash::image_tag_ais);

	add_children({ {
		&label_channel,
		&options_channel,
		&field_rf_amp,
		&field_lna,
		&field_vga,
		&rssi,
		&channel,
		&recent_entries_view,
		&recent_entry_detail_view,
	} });

	recent_entry_detail_view.hidden(true);

	target_frequency_ = initial_target_frequency;

	radio::enable({
		tuning_frequency(),
		sampling_rate,
		baseband_bandwidth,
		rf::Direction::Receive,
		receiver_model.rf_amp(),
		static_cast<int8_t>(receiver_model.lna()),
		static_cast<int8_t>(receiver_model.vga()),
		1,
	});

	options_channel.on_change = [this](size_t, OptionsField::value_t v) {
		this->on_frequency_changed(v);
	};
	options_channel.set_by_value(target_frequency());

	recent_entries_view.on_select = [this](const AISRecentEntry& entry) {
		this->on_show_detail(entry);
	};
	recent_entry_detail_view.on_close = [this]() {
		this->on_show_list();
	};

	logger = std::make_unique<AISLogger>();
	if( logger ) {
		logger->append("ais.txt");
	}
}
Ejemplo n.º 3
0
rf::Frequency CaptureAppView::tuning_frequency() const {
	return target_frequency() - (sampling_rate / 4);
}
Ejemplo n.º 4
0
uint32_t AISAppView::tuning_frequency() const {
	return target_frequency() - (sampling_rate / 4);
}