mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 03:34:35 +00:00
Added HamItUp option (#840)
* Added HamItUp option to allow quick offset of the tuned frequency * New HamItUp icon for top bar * HamItUp checkbox status and frequency persistent settings in Settings/Radio
This commit is contained in:
parent
2457ba016f
commit
92b622deac
@ -166,7 +166,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "AIS Boats RX"; };
|
||||
std::string title() const override { return "AIS RX"; };
|
||||
|
||||
private:
|
||||
static constexpr uint32_t initial_target_frequency = 162025000;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Analog TV RX"; };
|
||||
std::string title() const override { return "AnalogTV RX"; };
|
||||
|
||||
private:
|
||||
static constexpr ui::Dim header_height = 3 * 16;
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "ERT Meter RX"; };
|
||||
std::string title() const override { return "ERT RX"; };
|
||||
|
||||
private:
|
||||
ERTRecentEntries recent { };
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Soundboard TX"; };
|
||||
std::string title() const override { return "Soundbrd TX"; };
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "TPMS Cars RX"; };
|
||||
std::string title() const override { return "TPMS RX"; };
|
||||
|
||||
private:
|
||||
static constexpr uint32_t initial_target_frequency = 315000000;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "AFSK RX (beta)"; };
|
||||
std::string title() const override { return "AFSK RX"; };
|
||||
|
||||
private:
|
||||
void on_data(uint32_t value, bool is_data);
|
||||
|
@ -179,7 +179,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "BHT Xy/EP TX"; };
|
||||
std::string title() const override { return "BHT TX"; };
|
||||
|
||||
private:
|
||||
// app save settings
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "BurgerPgr TX"; };
|
||||
std::string title() const override { return "BurgerPgrTX"; };
|
||||
|
||||
private:
|
||||
enum tx_modes {
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
void load_directory_contents(const std::filesystem::path& dir_path);
|
||||
std::filesystem::path get_selected_path();
|
||||
|
||||
std::string title() const override { return "File manager"; };
|
||||
std::string title() const override { return "Fileman"; };
|
||||
|
||||
protected:
|
||||
NavigationView& nav_;
|
||||
|
@ -87,7 +87,7 @@ class FrequencySaveView : public FreqManBaseView {
|
||||
public:
|
||||
FrequencySaveView(NavigationView& nav, const rf::Frequency value);
|
||||
|
||||
std::string title() const override { return "Save frequency"; };
|
||||
std::string title() const override { return "Save freq."; };
|
||||
|
||||
private:
|
||||
std::string desc_buffer { };
|
||||
@ -126,7 +126,7 @@ public:
|
||||
|
||||
FrequencyLoadView(NavigationView& nav);
|
||||
|
||||
std::string title() const override { return "Load frequency"; };
|
||||
std::string title() const override { return "Load freq."; };
|
||||
|
||||
private:
|
||||
void refresh_widgets(const bool v);
|
||||
@ -137,7 +137,7 @@ public:
|
||||
FrequencyManagerView(NavigationView& nav);
|
||||
~FrequencyManagerView();
|
||||
|
||||
std::string title() const override { return "Freq. manager"; };
|
||||
std::string title() const override { return "Freqman"; };
|
||||
|
||||
private:
|
||||
std::string desc_buffer { };
|
||||
|
@ -49,7 +49,7 @@ namespace ui
|
||||
GlassView& operator=(const GlassView &nav);
|
||||
|
||||
~GlassView();
|
||||
std::string title() const override { return "Looking Glass"; };
|
||||
std::string title() const override { return "LookingGlass"; };
|
||||
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
~WipeSDView();
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Wipe SD Card"; };
|
||||
std::string title() const override { return "Wipe sdcard"; };
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
@ -38,6 +38,8 @@ using namespace portapack;
|
||||
#include "ui_font_fixed_8x16.hpp"
|
||||
#include "cpld_update.hpp"
|
||||
|
||||
#include "freqman.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
SetDateTimeView::SetDateTimeView(
|
||||
@ -144,6 +146,8 @@ SetRadioView::SetRadioView(
|
||||
}
|
||||
|
||||
add_children({
|
||||
&check_hamitup,
|
||||
&button_hamitup_freq,
|
||||
&check_clkout,
|
||||
&field_clkout_freq,
|
||||
&labels_clkout_khz,
|
||||
@ -168,6 +172,28 @@ SetRadioView::SetRadioView(
|
||||
EventDispatcher::send_message(message);
|
||||
};
|
||||
|
||||
check_hamitup.set_value(portapack::persistent_memory::config_hamitup());
|
||||
check_hamitup.on_select = [this](Checkbox&, bool v) {
|
||||
portapack::persistent_memory::set_config_hamitup(v);
|
||||
// Retune to take hamitup change in account
|
||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
||||
//Refresh status bar with/out UP!
|
||||
StatusRefreshMessage message { };
|
||||
EventDispatcher::send_message(message);
|
||||
};
|
||||
|
||||
button_hamitup_freq.set_text( to_string_short_freq( portapack::persistent_memory::config_hamitup_freq() ) + "MHz");
|
||||
|
||||
button_hamitup_freq.on_select = [this, &nav](Button& button) {
|
||||
auto new_view = nav.push<FrequencyKeypadView>(portapack::persistent_memory::config_hamitup_freq() );
|
||||
new_view->on_changed = [this, &button](rf::Frequency f) {
|
||||
portapack::persistent_memory::set_config_hamitup_freq( f );
|
||||
// Retune to take hamitup change in account
|
||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
||||
button_hamitup_freq.set_text( "<" + to_string_short_freq( f ) + " MHz>" );
|
||||
};
|
||||
};
|
||||
|
||||
field_clkout_freq.set_value(portapack::persistent_memory::clkout_freq());
|
||||
value_freq_step.set_style(&style_text);
|
||||
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Radio settings"; };
|
||||
std::string title() const override { return "Radio"; };
|
||||
|
||||
private:
|
||||
const Style style_text {
|
||||
@ -193,11 +193,21 @@ private:
|
||||
};
|
||||
|
||||
Checkbox check_bias {
|
||||
{ 28, 13 * 16 },
|
||||
{ 18, 12 * 16 },
|
||||
5,
|
||||
"Turn on bias voltage"
|
||||
};
|
||||
|
||||
Checkbox check_hamitup {
|
||||
{ 18, 14 * 16},
|
||||
7,
|
||||
"HamItUp"
|
||||
};
|
||||
Button button_hamitup_freq {
|
||||
{ 240 - 15 * 8 , 14 * 16 , 15 * 8 , 24 },
|
||||
"",
|
||||
};
|
||||
|
||||
Button button_save {
|
||||
{ 2 * 8, 16 * 16, 12 * 8, 32 },
|
||||
"Save"
|
||||
@ -219,7 +229,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "UI settings"; };
|
||||
std::string title() const override { return "UI"; };
|
||||
|
||||
private:
|
||||
|
||||
@ -299,7 +309,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "App Settings"; };
|
||||
std::string title() const override { return "AppSettings"; };
|
||||
|
||||
private:
|
||||
|
||||
@ -332,7 +342,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Audio settings"; };
|
||||
std::string title() const override { return "Audio"; };
|
||||
|
||||
private:
|
||||
Labels labels {
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "Radiosonde RX"; };
|
||||
std::string title() const override { return "Radiosnd RX"; };
|
||||
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
void focus() override;
|
||||
void paint(Painter&) override;
|
||||
|
||||
std::string title() const override { return "SSTV TX (beta)"; };
|
||||
std::string title() const override { return "SSTV TX"; };
|
||||
|
||||
private:
|
||||
NavigationView& nav_;
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
|
||||
void focus() override;
|
||||
|
||||
std::string title() const override { return "TouchTunes TX"; };
|
||||
std::string title() const override { return "TouchTunes"; };
|
||||
|
||||
private:
|
||||
uint32_t scan_button_index { };
|
||||
|
@ -37,7 +37,7 @@ namespace ui
|
||||
public:
|
||||
WhipCalcView(NavigationView &nav);
|
||||
void focus() override;
|
||||
std::string title() const override { return "Antenna length"; };
|
||||
std::string title() const override { return "Ant. length"; };
|
||||
|
||||
private:
|
||||
const double speed_of_light_mps = 299792458.0; // m/s
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,6 +40,7 @@ using namespace hackrf::one;
|
||||
#include "cpld_update.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
|
||||
namespace radio {
|
||||
|
||||
@ -168,7 +169,11 @@ void set_direction(const rf::Direction new_direction) {
|
||||
}
|
||||
|
||||
bool set_tuning_frequency(const rf::Frequency frequency) {
|
||||
const auto tuning_config = tuning::config::create(frequency);
|
||||
rf::Frequency final_frequency = frequency ;
|
||||
if( portapack::persistent_memory::config_hamitup() ) {
|
||||
final_frequency = frequency + portapack::persistent_memory::config_hamitup_freq();
|
||||
}
|
||||
const auto tuning_config = tuning::config::create(final_frequency);
|
||||
if( tuning_config.is_valid() ) {
|
||||
first_if.disable();
|
||||
|
||||
|
@ -111,6 +111,7 @@ SystemStatusView::SystemStatusView(
|
||||
&button_back,
|
||||
&title,
|
||||
&button_title,
|
||||
&button_hamitup,
|
||||
&button_speaker,
|
||||
&button_stealth,
|
||||
//&button_textentry,
|
||||
@ -148,6 +149,10 @@ SystemStatusView::SystemStatusView(
|
||||
this->on_title();
|
||||
};
|
||||
|
||||
button_hamitup.on_select = [this](ImageButton&) {
|
||||
this->on_hamitup();
|
||||
};
|
||||
|
||||
button_speaker.on_select = [this](ImageButton&) {
|
||||
this->on_speaker();
|
||||
};
|
||||
@ -179,6 +184,17 @@ SystemStatusView::SystemStatusView(
|
||||
}
|
||||
|
||||
void SystemStatusView::refresh() {
|
||||
if( portapack::persistent_memory::config_hamitup() )
|
||||
{
|
||||
button_hamitup.set_foreground(Color::red());
|
||||
}
|
||||
else
|
||||
{
|
||||
button_hamitup.set_foreground(Color::light_grey());
|
||||
}
|
||||
// Retune to take hamitup change in account
|
||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() );
|
||||
|
||||
if (!portapack::persistent_memory::config_speaker()) {
|
||||
button_speaker.set_foreground(Color::light_grey());
|
||||
button_speaker.set_bitmap(&bitmap_icon_speaker_mute);
|
||||
@ -187,6 +203,7 @@ void SystemStatusView::refresh() {
|
||||
else {
|
||||
button_speaker.hidden(true);
|
||||
}
|
||||
|
||||
if (portapack::get_antenna_bias()) {
|
||||
button_bias_tee.set_bitmap(&bitmap_icon_biast_on);
|
||||
button_bias_tee.set_foreground(ui::Color::yellow());
|
||||
@ -202,6 +219,7 @@ void SystemStatusView::refresh() {
|
||||
button_clock_status.set_bitmap(&bitmap_icon_clk_int);
|
||||
// button_bias_tee.set_foreground(ui::Color::green());
|
||||
}
|
||||
|
||||
if(portapack::persistent_memory::clkout_enabled()) {
|
||||
button_clock_status.set_foreground(ui::Color::green());
|
||||
} else {
|
||||
@ -239,6 +257,20 @@ void SystemStatusView::set_title(const std::string new_value) {
|
||||
}
|
||||
}
|
||||
|
||||
void SystemStatusView::on_hamitup() {
|
||||
if(!portapack::persistent_memory::config_hamitup())
|
||||
{
|
||||
portapack::persistent_memory::set_config_hamitup( true );
|
||||
button_hamitup.set_foreground(Color::red());
|
||||
}
|
||||
else
|
||||
{
|
||||
portapack::persistent_memory::set_config_hamitup( false );
|
||||
button_hamitup.set_foreground(Color::light_grey());
|
||||
}
|
||||
receiver_model.set_tuning_frequency( portapack::persistent_memory::tuned_frequency() ); // Retune
|
||||
}
|
||||
|
||||
void SystemStatusView::on_speaker() {
|
||||
if (!portapack::speaker_mode)
|
||||
{
|
||||
@ -524,7 +556,6 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
|
||||
{ "TEDI/LCR", ui::Color::yellow(), &bitmap_icon_lcr, [&nav](){ nav.push<LCRView>(); } },
|
||||
{ "TouchTune", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<TouchTunesView>(); } },
|
||||
{ "Playlist", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<PlaylistView>(); } },
|
||||
|
||||
//{ "Remote", ui::Color::dark_grey(), &bitmap_icon_remote, [&nav](){ nav.push<RemoteView>(); } },
|
||||
});
|
||||
}
|
||||
|
@ -142,11 +142,18 @@ namespace ui
|
||||
Color::dark_grey()};
|
||||
|
||||
ImageButton button_speaker{
|
||||
{17 * 8, 0, 2 * 8, 1 * 16},
|
||||
{15 * 8, 0, 2 * 8, 1 * 16},
|
||||
&bitmap_icon_speaker_mute,
|
||||
Color::light_grey(),
|
||||
Color::dark_grey()};
|
||||
|
||||
ImageButton button_hamitup{
|
||||
{17 * 8, 0, 2 * 8, 1 * 16},
|
||||
&bitmap_icon_hamitup,
|
||||
Color::light_grey(),
|
||||
Color::dark_grey()
|
||||
};
|
||||
|
||||
ImageButton button_stealth{
|
||||
{19 * 8, 0, 2 * 8, 1 * 16},
|
||||
&bitmap_icon_stealth,
|
||||
@ -187,6 +194,7 @@ namespace ui
|
||||
SDCardStatusView sd_card_status_view{
|
||||
{28 * 8, 0 * 16, 2 * 8, 1 * 16}};
|
||||
|
||||
void on_hamitup();
|
||||
void on_speaker();
|
||||
void on_stealth();
|
||||
void on_bias_tee();
|
||||
|
@ -288,6 +288,10 @@ struct data_t {
|
||||
// Recon App
|
||||
uint64_t recon_config;
|
||||
|
||||
// HamItUp (+125MHz offset by default, configurable)
|
||||
bool hamitup;
|
||||
int64_t hamitup_freq;
|
||||
|
||||
constexpr data_t() :
|
||||
structure_version(data_structure_version_enum::VERSION_CURRENT),
|
||||
tuned_frequency(tuned_frequency_reset_value),
|
||||
@ -315,7 +319,9 @@ struct data_t {
|
||||
tone_mix(tone_mix_reset_value),
|
||||
|
||||
hardware_config(0),
|
||||
recon_config(0)
|
||||
recon_config(0),
|
||||
hamitup(0),
|
||||
hamitup_freq(125000000)
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -733,6 +739,17 @@ void set_recon_load_hamradios(const bool v ){
|
||||
void set_recon_match_mode(const bool v ) {
|
||||
data->recon_config = (data->recon_config & ~0x00800000UL) | (v << 23);
|
||||
}
|
||||
|
||||
bool config_hamitup() {
|
||||
return data->hamitup;
|
||||
}
|
||||
void set_config_hamitup(const bool v ){
|
||||
data-> hamitup = v ;
|
||||
}
|
||||
int64_t config_hamitup_freq() {
|
||||
return data->hamitup_freq ;
|
||||
}
|
||||
void set_config_hamitup_freq(const int64_t v ){
|
||||
data-> hamitup_freq = v ;
|
||||
}
|
||||
} /* namespace persistent_memory */
|
||||
} /* namespace portapack */
|
||||
|
@ -151,6 +151,8 @@ uint8_t config_cpld();
|
||||
void set_config_cpld(uint8_t i);
|
||||
|
||||
bool config_splash();
|
||||
bool config_hamitup();
|
||||
int64_t config_hamitup_freq();
|
||||
bool show_gui_return_icon();
|
||||
bool load_app_settings();
|
||||
bool save_app_settings();
|
||||
@ -167,6 +169,8 @@ void set_load_app_settings(bool v);
|
||||
void set_save_app_settings(bool v);
|
||||
void set_show_bigger_qr_code(bool v);
|
||||
void set_config_splash(bool v);
|
||||
void set_config_hamitup(bool v);
|
||||
void set_config_hamitup_freq(const int64_t v );
|
||||
void set_clock_hidden(bool v);
|
||||
void set_clock_with_date(bool v);
|
||||
void set_config_login(bool v);
|
||||
|
BIN
firmware/graphics/icon_hamitup.png
Executable file
BIN
firmware/graphics/icon_hamitup.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 189 B |
Loading…
Reference in New Issue
Block a user