mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-08-22 07:29:03 +00:00
b048b8f4f1
* Add sliding-frequency audio receiver tuning * Move ADS-B receiver to external app * Move AIS receiver to external app * Move APRS receiver to external app * Move APRS transmitter to external app * Isolate filtered spectrum collection from WFM * Fixed the issues #3280 * fpga_bridge.c: init registers per reference fpga_init, add quarter-shift mode setter * radio.hpp: expose cached FPGA quarter-rate shift * radio.cpp: program FPGA quarter-rate shift together with tuning offset * tuning.hpp: pass AFE rate and direction to tuning config, add quarter_shift field * tuning.cpp: import full PRALINE RX/TX tuning tables with quarter-shift offsets * clock_manager: stop writing bogus RX digital gain, keep quarter shift across rate changes * receiver_model: port LPF bandwidth from reference auto_bandwidth, use cached quarter shift * adsb_rx: enable RF amp by default on first run * ui_geomap.hpp: add hemisphere fields, degrees become magnitude * ui_geomap: use hemisphere selector for lat/lon sign, fix minute/second wrap carry * ui_menu: guard select against empty menu * waterfall_designer: header updates for profile file handling * waterfall_designer: exception-free profile parsing, CRLF handling, deferred nav callbacks, backup cleanup * external.ld: scope app section globs to their own object directories * CMakeLists: relink when external.ld changes * tools: add external app symbol placement checker * tools: add guru meditation address lookup script * tools: add per-function stack usage report script Co-authored-by: gullradriel <gullradriel@users.noreply.github.com>
86 lines
2.9 KiB
C++
86 lines
2.9 KiB
C++
/*
|
|
* Copyright (C) 2023 Kyle Reed
|
|
*
|
|
* This file is part of PortaPack.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef __UI_FREQ_FIELD_H__
|
|
#define __UI_FREQ_FIELD_H__
|
|
|
|
#include "portapack.hpp"
|
|
#include "receiver_model.hpp"
|
|
#include "transmitter_model.hpp"
|
|
#include "ui_receiver.hpp"
|
|
|
|
namespace ui {
|
|
|
|
/* A frequency field bound directly a radio model
|
|
* that can manage its own editing UX. */
|
|
template <typename TModel, TModel* model>
|
|
class BoundFrequencyField : public FrequencyField {
|
|
private:
|
|
using FrequencyField::on_change;
|
|
using FrequencyField::on_edit;
|
|
|
|
public:
|
|
decltype(FrequencyField::on_change) updated{};
|
|
std::function<bool(rf::Frequency)> changing{};
|
|
std::function<void(rf::Frequency)> entered{};
|
|
|
|
BoundFrequencyField(Point parent_pos, NavigationView& nav)
|
|
: FrequencyField(parent_pos) {
|
|
// NB: There is no frequency_step on the tx_model.
|
|
set_step(portapack::receiver_model.frequency_step());
|
|
set_value(model->target_frequency());
|
|
|
|
on_change = [this](rf::Frequency f) {
|
|
if (!changing || !changing(f))
|
|
model->set_target_frequency(f);
|
|
if (updated)
|
|
updated(f);
|
|
};
|
|
|
|
on_edit = [this, &nav]() {
|
|
if (on_edit_shown)
|
|
on_edit_shown();
|
|
auto freq_view = nav.push<FrequencyKeypadView>(model->target_frequency());
|
|
freq_view->on_changed = [this](rf::Frequency f) {
|
|
if (entered)
|
|
entered(f);
|
|
else
|
|
set_value(f);
|
|
};
|
|
nav.set_on_pop([this]() {
|
|
if (on_edit_hidden)
|
|
on_edit_hidden();
|
|
});
|
|
};
|
|
}
|
|
|
|
std::function<void(void)> on_edit_shown{}; // fired, when the FrequencyKeypadView pops up
|
|
std::function<void(void)> on_edit_hidden{}; // fired, when the FrequencyKeypadView ended
|
|
// TODO: override set_step and update the rx model then call base.
|
|
};
|
|
|
|
using RxFrequencyField = BoundFrequencyField<ReceiverModel, &portapack::receiver_model>;
|
|
using TxFrequencyField = BoundFrequencyField<TransmitterModel, &portapack::transmitter_model>;
|
|
|
|
} // namespace ui
|
|
|
|
#endif // __UI_FREQ_FIELD_H__
|