mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-03-04 14:05:09 +00:00
Save most common settings for TX apps. And translated some French apps along the way.
This commit is contained in:
parent
c9db1aab30
commit
cccc92cc34
@ -27,56 +27,30 @@
|
|||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
#include "portapack_persistent_memory.hpp"
|
#include "portapack_persistent_memory.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
int app_settings::load(std::string application, AppSettings* settings){
|
int app_settings::load(std::string application, AppSettings* settings) {
|
||||||
|
|
||||||
if (portapack::persistent_memory::load_app_settings()) {
|
if (portapack::persistent_memory::load_app_settings()) {
|
||||||
file_path = folder+"/"+application+".ini";
|
file_path = folder+"/"+application+".ini";
|
||||||
|
|
||||||
auto error = settings_file.open(file_path);
|
auto error = settings_file.open(file_path);
|
||||||
if (!error.is_valid()) {
|
if (!error.is_valid()) {
|
||||||
auto error = settings_file.read(file_content, 256);
|
auto error = settings_file.read(file_content, std::min((int)settings_file.size(), MAX_FILE_CONTENT_SIZE));
|
||||||
|
|
||||||
// Retrieve settings
|
|
||||||
auto position1 = strstr(file_content, "baseband_bandwidth=");
|
|
||||||
if (position1) {
|
|
||||||
position1 += 19;
|
|
||||||
settings->baseband_bandwidth=strtoll(position1, nullptr, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto position2 = strstr(file_content, "rx_frequency=");
|
|
||||||
if (position2) {
|
|
||||||
position2 += 13;
|
|
||||||
settings->rx_frequency=strtoll(position2, nullptr, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto position3 = strstr(file_content, "lna=");
|
|
||||||
if (position3) {
|
|
||||||
position3 += 4;
|
|
||||||
settings->lna=strtoll(position3, nullptr, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto position4 = strstr(file_content, "rx_amp=");
|
|
||||||
if (position4) {
|
|
||||||
position4 += 7;
|
|
||||||
settings->rx_amp=strtoll(position4, nullptr, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto position5 = strstr(file_content, "sampling_rate=");
|
|
||||||
if (position5) {
|
|
||||||
position5 += 13;
|
|
||||||
settings->sampling_rate=strtoll(position5, nullptr, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
auto position6 = strstr(file_content, "vga=");
|
|
||||||
if (position6) {
|
|
||||||
position6 += 4;
|
|
||||||
settings->vga=strtoll(position6, nullptr, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
settings->baseband_bandwidth=std::app_settings::read_long_long(file_content, "baseband_bandwidth=");
|
||||||
|
settings->channel_bandwidth=std::app_settings::read_long_long(file_content, "channel_bandwidth=");
|
||||||
|
settings->lna=std::app_settings::read_long_long(file_content, "lna=");
|
||||||
|
settings->modulation=std::app_settings::read_long_long(file_content, "modulation=");
|
||||||
|
settings->rx_amp=std::app_settings::read_long_long(file_content, "rx_amp=");
|
||||||
|
settings->rx_frequency=std::app_settings::read_long_long(file_content, "rx_frequency=");
|
||||||
|
settings->sampling_rate=std::app_settings::read_long_long(file_content, "sampling_rate=");
|
||||||
|
settings->vga=std::app_settings::read_long_long(file_content, "vga=");
|
||||||
|
settings->tx_amp=std::app_settings::read_long_long(file_content, "tx_amp=");
|
||||||
|
settings->tx_frequency=std::app_settings::read_long_long(file_content, "tx_frequency=");
|
||||||
|
settings->tx_gain=std::app_settings::read_long_long(file_content, "tx_gain=");
|
||||||
rc = SETTINGS_OK;
|
rc = SETTINGS_OK;
|
||||||
}
|
}
|
||||||
else rc = SETTINGS_UNABLE_TO_LOAD;
|
else rc = SETTINGS_UNABLE_TO_LOAD;
|
||||||
@ -85,7 +59,7 @@ int app_settings::load(std::string application, AppSettings* settings){
|
|||||||
return(rc);
|
return(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int app_settings::save(std::string application, AppSettings* settings){
|
int app_settings::save(std::string application, AppSettings* settings) {
|
||||||
|
|
||||||
if (portapack::persistent_memory::save_app_settings()) {
|
if (portapack::persistent_memory::save_app_settings()) {
|
||||||
file_path = folder+"/"+application+".ini";
|
file_path = folder+"/"+application+".ini";
|
||||||
@ -95,12 +69,16 @@ int app_settings::save(std::string application, AppSettings* settings){
|
|||||||
if (!error.is_valid()) {
|
if (!error.is_valid()) {
|
||||||
// Save common setting
|
// Save common setting
|
||||||
settings_file.write_line("baseband_bandwidth="+to_string_dec_uint(portapack::receiver_model.baseband_bandwidth()));
|
settings_file.write_line("baseband_bandwidth="+to_string_dec_uint(portapack::receiver_model.baseband_bandwidth()));
|
||||||
|
settings_file.write_line("channel_bandwidth="+to_string_dec_uint(portapack::transmitter_model.channel_bandwidth()));
|
||||||
settings_file.write_line("lna="+to_string_dec_uint(portapack::receiver_model.lna()));
|
settings_file.write_line("lna="+to_string_dec_uint(portapack::receiver_model.lna()));
|
||||||
settings_file.write_line("rx_amp="+to_string_dec_uint(portapack::receiver_model.rf_amp()));
|
settings_file.write_line("rx_amp="+to_string_dec_uint(portapack::receiver_model.rf_amp()));
|
||||||
settings_file.write_line("sampling_rate="+to_string_dec_uint(portapack::receiver_model.sampling_rate()));
|
settings_file.write_line("sampling_rate="+to_string_dec_uint(portapack::receiver_model.sampling_rate()));
|
||||||
|
settings_file.write_line("tx_amp="+to_string_dec_uint(portapack::transmitter_model.rf_amp()));
|
||||||
|
settings_file.write_line("tx_gain="+to_string_dec_uint(portapack::transmitter_model.tx_gain()));
|
||||||
settings_file.write_line("vga="+to_string_dec_uint(portapack::receiver_model.vga()));
|
settings_file.write_line("vga="+to_string_dec_uint(portapack::receiver_model.vga()));
|
||||||
// Save other settings from struct
|
// Save other settings from struct
|
||||||
settings_file.write_line("rx_frequency="+to_string_dec_uint(settings->rx_frequency));
|
settings_file.write_line("rx_frequency="+to_string_dec_uint(settings->rx_frequency));
|
||||||
|
settings_file.write_line("tx_frequency="+to_string_dec_uint(settings->tx_frequency));
|
||||||
|
|
||||||
rc = SETTINGS_OK;
|
rc = SETTINGS_OK;
|
||||||
}
|
}
|
||||||
@ -110,4 +88,15 @@ int app_settings::save(std::string application, AppSettings* settings){
|
|||||||
return(rc);
|
return(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long long int app_settings::read_long_long(char* file_content, const char* setting_text) {
|
||||||
|
auto position = strstr(file_content, (char *)setting_text);
|
||||||
|
if (position) {
|
||||||
|
position += strlen((char *)setting_text);
|
||||||
|
setting_value = strtoll(position, nullptr, 10);
|
||||||
|
}
|
||||||
|
return(setting_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} /* namespace std */
|
} /* namespace std */
|
||||||
|
@ -46,13 +46,18 @@ public:
|
|||||||
#define SETTINGS_DISABLED -3 // load/save settings disabled in settings
|
#define SETTINGS_DISABLED -3 // load/save settings disabled in settings
|
||||||
|
|
||||||
|
|
||||||
// store settings that can't be set directly, but have to be stored in app
|
|
||||||
struct AppSettings {
|
struct AppSettings {
|
||||||
uint32_t baseband_bandwidth;
|
uint32_t baseband_bandwidth;
|
||||||
|
uint32_t channel_bandwidth;
|
||||||
uint8_t lna;
|
uint8_t lna;
|
||||||
|
uint8_t modulation;
|
||||||
uint8_t rx_amp;
|
uint8_t rx_amp;
|
||||||
uint32_t rx_frequency;
|
uint32_t rx_frequency;
|
||||||
uint32_t sampling_rate;
|
uint32_t sampling_rate;
|
||||||
|
uint8_t tx_amp;
|
||||||
|
uint32_t tx_frequency;
|
||||||
|
uint8_t tx_gain;
|
||||||
uint8_t vga;
|
uint8_t vga;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,12 +67,16 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
#define MAX_FILE_CONTENT_SIZE 1000
|
||||||
|
|
||||||
char file_content[257] = {};
|
char file_content[MAX_FILE_CONTENT_SIZE] = {};
|
||||||
std::string file_path = "";
|
std::string file_path = "";
|
||||||
std::string folder = "SETTINGS";
|
std::string folder = "SETTINGS";
|
||||||
int rc = SETTINGS_OK;
|
int rc = SETTINGS_OK;
|
||||||
File settings_file { };
|
File settings_file { };
|
||||||
|
long long int setting_value {} ;
|
||||||
|
|
||||||
|
long long int read_long_long(char* file_content, const char* setting_text);
|
||||||
|
|
||||||
|
|
||||||
}; // class app_settings
|
}; // class app_settings
|
||||||
|
@ -139,7 +139,6 @@ AnalogAudioView::AnalogAudioView(
|
|||||||
}
|
}
|
||||||
else field_frequency.set_value(receiver_model.tuning_frequency());
|
else field_frequency.set_value(receiver_model.tuning_frequency());
|
||||||
|
|
||||||
|
|
||||||
//Filename Datetime and Frequency
|
//Filename Datetime and Frequency
|
||||||
record_view.set_filename_date_frequency(true);
|
record_view.set_filename_date_frequency(true);
|
||||||
|
|
||||||
@ -170,6 +169,7 @@ AnalogAudioView::AnalogAudioView(
|
|||||||
|
|
||||||
const auto modulation = receiver_model.modulation();
|
const auto modulation = receiver_model.modulation();
|
||||||
options_modulation.set_by_value(toUType(modulation));
|
options_modulation.set_by_value(toUType(modulation));
|
||||||
|
|
||||||
options_modulation.on_change = [this](size_t, OptionsField::value_t v) {
|
options_modulation.on_change = [this](size_t, OptionsField::value_t v) {
|
||||||
this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v));
|
this->on_modulation_changed(static_cast<ReceiverModel::Mode>(v));
|
||||||
};
|
};
|
||||||
@ -193,7 +193,7 @@ AnalogAudioView::AnalogAudioView(
|
|||||||
audio::output::start();
|
audio::output::start();
|
||||||
|
|
||||||
update_modulation(static_cast<ReceiverModel::Mode>(modulation));
|
update_modulation(static_cast<ReceiverModel::Mode>(modulation));
|
||||||
on_modulation_changed(static_cast<ReceiverModel::Mode>(modulation));
|
on_modulation_changed(static_cast<ReceiverModel::Mode>(modulation));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t AnalogAudioView::get_spec_bw_index() {
|
size_t AnalogAudioView::get_spec_bw_index() {
|
||||||
@ -412,9 +412,6 @@ void AnalogAudioView::update_modulation(const ReceiverModel::Mode modulation) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void AnalogAudioView::squelched() {
|
|
||||||
if (exit_on_squelch) nav_.pop();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void AnalogAudioView::handle_coded_squelch(const uint32_t value) {
|
void AnalogAudioView::handle_coded_squelch(const uint32_t value) {
|
||||||
float diff, min_diff = value;
|
float diff, min_diff = value;
|
||||||
|
@ -43,6 +43,10 @@ void LGEView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LGEView::~LGEView() {
|
LGEView::~LGEView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_lge", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -300,6 +304,15 @@ LGEView::LGEView(NavigationView& nav) {
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_lge", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
field_salle.set_value(1);
|
field_salle.set_value(1);
|
||||||
field_equipe.set_value(1);
|
field_equipe.set_value(1);
|
||||||
field_joueur.set_value(1);
|
field_joueur.set_value(1);
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@ -49,9 +50,13 @@ private:
|
|||||||
ALL
|
ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
tx_modes tx_mode = IDLE;
|
tx_modes tx_mode = IDLE;
|
||||||
|
|
||||||
RFM69 rfm69 { 5, 0x2DD4, true, true };
|
RFM69 rfm69 { 5, 0x2DD4, true, true };
|
||||||
|
|
||||||
uint32_t frame_size { 0 };
|
uint32_t frame_size { 0 };
|
||||||
uint32_t repeats { 0 };
|
uint32_t repeats { 0 };
|
||||||
@ -79,28 +84,28 @@ private:
|
|||||||
|
|
||||||
Labels labels {
|
Labels labels {
|
||||||
//{ { 7 * 8, 1 * 8 }, "NO FUN ALLOWED !", Color::red() },
|
//{ { 7 * 8, 1 * 8 }, "NO FUN ALLOWED !", Color::red() },
|
||||||
{ { 1 * 8, 1 * 8 }, "Trame:", Color::light_grey() },
|
{ { 1 * 8, 1 * 8 }, "Frame:", Color::light_grey() },
|
||||||
{ { 1 * 8, 3 * 8 }, "Salle:", Color::light_grey() },
|
{ { 2 * 8, 3 * 8 }, "Room:", Color::light_grey() },
|
||||||
{ { 14 * 8, 3 * 8 }, "Texte:", Color::light_grey() },
|
{ { 14 * 8, 3 * 8 }, "Text:", Color::light_grey() },
|
||||||
{ { 0 * 8, 5 * 8 }, "Equipe:", Color::light_grey() },
|
{ { 1 * 8, 5 * 8 }, "Group:", Color::light_grey() },
|
||||||
{ { 0 * 8, 7 * 8 }, "Joueur:", Color::light_grey() },
|
{ { 0 * 8, 7 * 8 }, "Player:", Color::light_grey() },
|
||||||
{ { 0 * 8, 10 * 8 }, "Collier:", Color::light_grey() },
|
{ { 0 * 8, 10 * 8 }, "Vest:", Color::light_grey() },
|
||||||
{ { 4 * 8, 12 * 8 }, "ID:", Color::light_grey() },
|
{ { 4 * 8, 12 * 8 }, "ID:", Color::light_grey() },
|
||||||
{ { 3 * 8, 14 * 8 }, "Pow: /10", Color::light_grey() },
|
{ { 3 * 8, 14 * 8 }, "Pow: /10", Color::light_grey() },
|
||||||
{ { 1 * 8, 16 * 8 }, "Duree: x100ms", Color::light_grey() }
|
{ { 2 * 8, 16 * 8 }, "Time: x100ms", Color::light_grey() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OptionsField options_trame {
|
OptionsField options_trame {
|
||||||
{ 7 * 8, 1 * 8 },
|
{ 7 * 8, 1 * 8 },
|
||||||
13,
|
13,
|
||||||
{
|
{
|
||||||
{ "Touche", 0 },
|
{ "Key", 0 },
|
||||||
{ "Set pseudo", 1 },
|
{ "Set nickname", 1 },
|
||||||
{ "Set equipe", 2 },
|
{ "Set team", 2 },
|
||||||
{ "Brdcst pseudo", 3 },
|
{ "Brdcst nick", 3 },
|
||||||
{ "Start", 4 },
|
{ "Start", 4 },
|
||||||
{ "Game over", 5 },
|
{ "Game over", 5 },
|
||||||
{ "Set collier", 6 }
|
{ "Set vest", 6 }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -241,6 +241,15 @@ SoundBoardView::SoundBoardView(
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_soundboard", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
refresh_list();
|
refresh_list();
|
||||||
|
|
||||||
button_next_page.on_select = [this](Button&) {
|
button_next_page.on_select = [this](Button&) {
|
||||||
@ -280,6 +289,10 @@ SoundBoardView::SoundBoardView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SoundBoardView::~SoundBoardView() {
|
SoundBoardView::~SoundBoardView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_soundboard", &app_settings);
|
||||||
|
|
||||||
stop();
|
stop();
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "lfsr_random.hpp"
|
#include "lfsr_random.hpp"
|
||||||
#include "io_wave.hpp"
|
#include "io_wave.hpp"
|
||||||
#include "tone_key.hpp"
|
#include "tone_key.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@ -50,6 +51,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
NavigationView& nav_;
|
NavigationView& nav_;
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
enum tx_modes {
|
enum tx_modes {
|
||||||
NORMAL = 0,
|
NORMAL = 0,
|
||||||
RANDOM
|
RANDOM
|
||||||
|
@ -313,6 +313,7 @@ ADSBRxView::~ADSBRxView() {
|
|||||||
// save app settings
|
// save app settings
|
||||||
settings.save("rx_adsb", &app_settings);
|
settings.save("rx_adsb", &app_settings);
|
||||||
|
|
||||||
|
//TODO: once all apps keep there own settin previous frequency logic can be removed
|
||||||
receiver_model.set_tuning_frequency(prevFreq);
|
receiver_model.set_tuning_frequency(prevFreq);
|
||||||
rtc_time::signal_tick_second -= signal_token_tick_second;
|
rtc_time::signal_tick_second -= signal_token_tick_second;
|
||||||
receiver_model.disable();
|
receiver_model.disable();
|
||||||
|
@ -284,6 +284,11 @@ void ADSBTxView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ADSBTxView::~ADSBTxView() {
|
ADSBTxView::~ADSBTxView() {
|
||||||
|
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_adsb", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -336,6 +341,14 @@ ADSBTxView::ADSBTxView(
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_adsb", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
tx_view.on_edit_frequency = [this, &nav]() {
|
tx_view.on_edit_frequency = [this, &nav]() {
|
||||||
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
||||||
new_view->on_changed = [this](rf::Frequency f) {
|
new_view->on_changed = [this](rf::Frequency f) {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "ui_transmitter.hpp"
|
#include "ui_transmitter.hpp"
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
|
|
||||||
using namespace adsb;
|
using namespace adsb;
|
||||||
@ -190,6 +191,10 @@ private:
|
|||||||
-1
|
-1
|
||||||
};*/
|
};*/
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
//tx_modes tx_mode = IDLE;
|
//tx_modes tx_mode = IDLE;
|
||||||
NavigationView& nav_;
|
NavigationView& nav_;
|
||||||
std::vector<ADSBFrame> frames { };
|
std::vector<ADSBFrame> frames { };
|
||||||
|
@ -43,6 +43,10 @@ void APRSTXView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
APRSTXView::~APRSTXView() {
|
APRSTXView::~APRSTXView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_aprs", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -66,7 +70,7 @@ void APRSTXView::start_tx() {
|
|||||||
1200,
|
1200,
|
||||||
2200,
|
2200,
|
||||||
1,
|
1,
|
||||||
10000, //transmitter_model.channel_bandwidth(),
|
10000, //APRS uses fixed 10k bandwidth
|
||||||
8
|
8
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -95,6 +99,15 @@ APRSTXView::APRSTXView(NavigationView& nav) {
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_aprs", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
button_set.on_select = [this, &nav](Button&) {
|
button_set.on_select = [this, &nav](Button&) {
|
||||||
text_prompt(
|
text_prompt(
|
||||||
nav,
|
nav,
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
@ -40,16 +41,13 @@ public:
|
|||||||
|
|
||||||
void focus() override;
|
void focus() override;
|
||||||
|
|
||||||
std::string title() const override { return "APRS TX (beta)"; };
|
std::string title() const override { return "APRS TX"; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*enum tx_modes {
|
|
||||||
IDLE = 0,
|
|
||||||
SINGLE,
|
|
||||||
SEQUENCE
|
|
||||||
};
|
|
||||||
|
|
||||||
tx_modes tx_mode = IDLE;*/
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
std::string payload { "" };
|
std::string payload { "" };
|
||||||
|
|
||||||
@ -103,7 +101,7 @@ private:
|
|||||||
TransmitterView tx_view {
|
TransmitterView tx_view {
|
||||||
16 * 16,
|
16 * 16,
|
||||||
5000,
|
5000,
|
||||||
10
|
0 // disable setting bandwith, since APRS used fixed 10k bandwidth
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageHandlerRegistration message_handler_tx_progress {
|
MessageHandlerRegistration message_handler_tx_progress {
|
||||||
|
@ -140,6 +140,10 @@ void BHTView::on_tx_progress(const uint32_t progress, const bool done) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BHTView::~BHTView() {
|
BHTView::~BHTView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_bht", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +160,15 @@ BHTView::BHTView(NavigationView& nav) {
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_bht", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
field_tempo.set_value(1);
|
field_tempo.set_value(1);
|
||||||
|
|
||||||
tx_view.on_edit_frequency = [this, &nav]() {
|
tx_view.on_edit_frequency = [this, &nav]() {
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
#include "encoders.hpp"
|
#include "encoders.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
@ -50,11 +51,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
Labels labels {
|
Labels labels {
|
||||||
{ { 8 * 8, 1 * 8 }, "Header:", Color::light_grey() },
|
{ { 8 * 8, 1 * 8 }, "Header:", Color::light_grey() },
|
||||||
{ { 4 * 8, 3 * 8 }, "Code ville:", Color::light_grey() },
|
{ { 4 * 8, 3 * 8 }, "City code:", Color::light_grey() },
|
||||||
{ { 7 * 8, 5 * 8 }, "Famille:", Color::light_grey() },
|
{ { 7 * 8, 5 * 8 }, "Family:", Color::light_grey() },
|
||||||
{ { 2 * 8, 7 * 8 + 2 }, "Sous-famille:", Color::light_grey() },
|
{ { 2 * 8, 7 * 8 + 2 }, "Subfamily:", Color::light_grey() },
|
||||||
{ { 2 * 8, 11 * 8 }, "ID recepteur:", Color::light_grey() },
|
{ { 2 * 8, 11 * 8 }, "Receiver ID:", Color::light_grey() },
|
||||||
{ { 2 * 8, 14 * 8 }, "Relais:", Color::light_grey() }
|
{ { 2 * 8, 14 * 8 }, "Relay:", Color::light_grey() }
|
||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_header_a {
|
NumberField field_header_a {
|
||||||
@ -98,8 +99,8 @@ private:
|
|||||||
|
|
||||||
Checkbox checkbox_wcsubfamily {
|
Checkbox checkbox_wcsubfamily {
|
||||||
{ 20 * 8, 6 * 8 + 6 },
|
{ 20 * 8, 6 * 8 + 6 },
|
||||||
6,
|
3,
|
||||||
"Toutes"
|
"All"
|
||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_receiver {
|
NumberField field_receiver {
|
||||||
@ -111,8 +112,8 @@ private:
|
|||||||
};
|
};
|
||||||
Checkbox checkbox_wcid {
|
Checkbox checkbox_wcid {
|
||||||
{ 20 * 8, 10 * 8 + 4 },
|
{ 20 * 8, 10 * 8 + 4 },
|
||||||
4,
|
3,
|
||||||
"Tous"
|
"All"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::array<ImageOptionsField, 4> relay_states { };
|
std::array<ImageOptionsField, 4> relay_states { };
|
||||||
@ -139,9 +140,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Labels labels {
|
Labels labels {
|
||||||
{ { 4 * 8, 1 * 8 }, "Code ville:", Color::light_grey() },
|
{ { 4 * 8, 1 * 8 }, "City code:", Color::light_grey() },
|
||||||
{ { 8 * 8, 3 * 8 }, "Groupe:", Color::light_grey() },
|
{ { 8 * 8, 3 * 8 }, "Group:", Color::light_grey() },
|
||||||
{ { 8 * 8, 7 * 8 }, "Relais:", Color::light_grey() }
|
{ { 8 * 8, 7 * 8 }, "Relay:", Color::light_grey() }
|
||||||
};
|
};
|
||||||
|
|
||||||
NumberField field_city {
|
NumberField field_city {
|
||||||
@ -181,6 +182,10 @@ public:
|
|||||||
std::string title() const override { return "BHT Xy/EP TX"; };
|
std::string title() const override { return "BHT Xy/EP TX"; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
void on_tx_progress(const uint32_t progress, const bool done);
|
void on_tx_progress(const uint32_t progress, const bool done);
|
||||||
void start_tx();
|
void start_tx();
|
||||||
void stop_tx();
|
void stop_tx();
|
||||||
@ -222,8 +227,8 @@ private:
|
|||||||
|
|
||||||
Checkbox checkbox_cligno {
|
Checkbox checkbox_cligno {
|
||||||
{ 16 * 8, 25 * 8 },
|
{ 16 * 8, 25 * 8 },
|
||||||
6,
|
8,
|
||||||
"Cligno"
|
"Flashing"
|
||||||
};
|
};
|
||||||
NumberField field_tempo {
|
NumberField field_tempo {
|
||||||
{ 26 * 8, 25 * 8 + 4 },
|
{ 26 * 8, 25 * 8 + 4 },
|
||||||
|
@ -37,6 +37,10 @@ void CoasterPagerView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CoasterPagerView::~CoasterPagerView() {
|
CoasterPagerView::~CoasterPagerView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_coaster", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -119,6 +123,15 @@ CoasterPagerView::CoasterPagerView(NavigationView& nav) {
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_coaster", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
// Bytes to nibbles
|
// Bytes to nibbles
|
||||||
for (c = 0; c < 16; c++)
|
for (c = 0; c < 16; c++)
|
||||||
sym_data.set_sym(c, (data_init[c >> 1] >> ((c & 1) ? 0 : 4)) & 0x0F);
|
sym_data.set_sym(c, (data_init[c >> 1] >> ((c & 1) ? 0 : 4)) & 0x0F);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
@ -50,6 +51,10 @@ private:
|
|||||||
|
|
||||||
tx_modes tx_mode = IDLE;
|
tx_modes tx_mode = IDLE;
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
void start_tx();
|
void start_tx();
|
||||||
void generate_frame();
|
void generate_frame();
|
||||||
void on_tx_progress(const uint32_t progress, const bool done);
|
void on_tx_progress(const uint32_t progress, const bool done);
|
||||||
|
@ -203,6 +203,10 @@ void EncodersView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EncodersView::~EncodersView() {
|
EncodersView::~EncodersView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_ook", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -335,6 +339,15 @@ EncodersView::EncodersView(
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_ook", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
tx_view.on_edit_frequency = [this, &nav]() {
|
tx_view.on_edit_frequency = [this, &nav]() {
|
||||||
auto new_view = nav.push<FrequencyKeypadView>(transmitter_model.tuning_frequency());
|
auto new_view = nav.push<FrequencyKeypadView>(transmitter_model.tuning_frequency());
|
||||||
new_view->on_changed = [this](rf::Frequency f) {
|
new_view->on_changed = [this](rf::Frequency f) {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
#include "encoders.hpp"
|
#include "encoders.hpp"
|
||||||
#include "de_bruijn.hpp"
|
#include "de_bruijn.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
|
|
||||||
using namespace encoders;
|
using namespace encoders;
|
||||||
|
|
||||||
@ -169,6 +170,10 @@ private:
|
|||||||
SCAN
|
SCAN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
tx_modes tx_mode = IDLE;
|
tx_modes tx_mode = IDLE;
|
||||||
uint8_t repeat_index { 0 };
|
uint8_t repeat_index { 0 };
|
||||||
uint8_t repeat_min { 0 };
|
uint8_t repeat_min { 0 };
|
||||||
|
@ -136,6 +136,9 @@ void KeyfobView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
KeyfobView::~KeyfobView() {
|
KeyfobView::~KeyfobView() {
|
||||||
|
// save app settings
|
||||||
|
settings.save("tx_keyfob", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -214,6 +217,13 @@ KeyfobView::KeyfobView(
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_keyfob", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
frame[0] = 0x55;
|
frame[0] = 0x55;
|
||||||
update_symfields();
|
update_symfields();
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "ui.hpp"
|
#include "ui.hpp"
|
||||||
#include "ui_transmitter.hpp"
|
#include "ui_transmitter.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "encoders.hpp"
|
#include "encoders.hpp"
|
||||||
|
|
||||||
using namespace encoders;
|
using namespace encoders;
|
||||||
@ -41,6 +42,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
NavigationView& nav_;
|
NavigationView& nav_;
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
// 1013210ns / bit
|
// 1013210ns / bit
|
||||||
static constexpr uint32_t subaru_samples_per_bit = (OOK_SAMPLERATE * 0.00101321);
|
static constexpr uint32_t subaru_samples_per_bit = (OOK_SAMPLERATE * 0.00101321);
|
||||||
static constexpr uint32_t repeats = 4;
|
static constexpr uint32_t repeats = 4;
|
||||||
|
@ -39,6 +39,10 @@ void LCRView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LCRView::~LCRView() {
|
LCRView::~LCRView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_lcr", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -173,6 +177,15 @@ LCRView::LCRView(NavigationView& nav) {
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_lcr", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
options_scanlist.set_selected_index(0);
|
options_scanlist.set_selected_index(0);
|
||||||
|
|
||||||
const auto button_set_am_fn = [this, &nav](Button& button) {
|
const auto button_set_am_fn = [this, &nav](Button& button) {
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
@ -81,6 +82,10 @@ private:
|
|||||||
SCAN
|
SCAN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
tx_modes tx_mode = IDLE;
|
tx_modes tx_mode = IDLE;
|
||||||
uint8_t scan_count { 0 }, scan_index { 0 };
|
uint8_t scan_count { 0 }, scan_index { 0 };
|
||||||
uint32_t scan_progress { 0 };
|
uint32_t scan_progress { 0 };
|
||||||
|
@ -97,6 +97,10 @@ void MorseView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MorseView::~MorseView() {
|
MorseView::~MorseView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_morse", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -203,6 +207,15 @@ MorseView::MorseView(
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_morse", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
// Default settings
|
// Default settings
|
||||||
field_speed.set_value(15); // 15wps
|
field_speed.set_value(15); // 15wps
|
||||||
field_tone.set_value(700); // 700Hz FM tone
|
field_tone.set_value(700); // 700Hz FM tone
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "ui_widget.hpp"
|
#include "ui_widget.hpp"
|
||||||
#include "ui_navigation.hpp"
|
#include "ui_navigation.hpp"
|
||||||
#include "ui_transmitter.hpp"
|
#include "ui_transmitter.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "portapack.hpp"
|
#include "portapack.hpp"
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "volume.hpp"
|
#include "volume.hpp"
|
||||||
@ -67,6 +67,10 @@ private:
|
|||||||
std::string message { };
|
std::string message { };
|
||||||
uint32_t time_units { 0 };
|
uint32_t time_units { 0 };
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
enum modulation_t {
|
enum modulation_t {
|
||||||
CW = 0,
|
CW = 0,
|
||||||
FM = 1
|
FM = 1
|
||||||
|
@ -38,6 +38,10 @@ void POCSAGTXView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
POCSAGTXView::~POCSAGTXView() {
|
POCSAGTXView::~POCSAGTXView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_pocsag", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -141,6 +145,15 @@ POCSAGTXView::POCSAGTXView(
|
|||||||
&tx_view
|
&tx_view
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_pocsag", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
options_bitrate.set_selected_index(1); // 1200bps
|
options_bitrate.set_selected_index(1); // 1200bps
|
||||||
options_type.set_selected_index(0); // Address only
|
options_type.set_selected_index(0); // Address only
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "bch_code.hpp"
|
#include "bch_code.hpp"
|
||||||
#include "message.hpp"
|
#include "message.hpp"
|
||||||
#include "transmitter_model.hpp"
|
#include "transmitter_model.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "pocsag.hpp"
|
#include "pocsag.hpp"
|
||||||
|
|
||||||
using namespace pocsag;
|
using namespace pocsag;
|
||||||
@ -62,6 +63,10 @@ private:
|
|||||||
5, 31, 21, 2
|
5, 31, 21, 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
void on_set_text(NavigationView& nav);
|
void on_set_text(NavigationView& nav);
|
||||||
void on_tx_progress(const uint32_t progress, const bool done);
|
void on_tx_progress(const uint32_t progress, const bool done);
|
||||||
bool start_tx();
|
bool start_tx();
|
||||||
|
@ -175,6 +175,10 @@ void RDSView::focus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RDSView::~RDSView() {
|
RDSView::~RDSView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_rds", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -226,11 +230,17 @@ RDSView::RDSView(
|
|||||||
&view_radiotext,
|
&view_radiotext,
|
||||||
&view_datetime,
|
&view_datetime,
|
||||||
&view_audio,
|
&view_audio,
|
||||||
//&options_countrycode,
|
|
||||||
//&options_coverage,
|
|
||||||
&tx_view,
|
&tx_view,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_rds", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
check_TP.set_value(true);
|
check_TP.set_value(true);
|
||||||
|
|
||||||
sym_pi_code.set_sym(0, 0xF);
|
sym_pi_code.set_sym(0, 0xF);
|
||||||
@ -242,8 +252,6 @@ RDSView::RDSView(
|
|||||||
};
|
};
|
||||||
|
|
||||||
options_pty.set_selected_index(0); // None
|
options_pty.set_selected_index(0); // None
|
||||||
//options_countrycode.set_selected_index(18); // Baguette du fromage
|
|
||||||
//options_coverage.set_selected_index(0); // Local
|
|
||||||
|
|
||||||
tx_view.on_edit_frequency = [this, &nav]() {
|
tx_view.on_edit_frequency = [this, &nav]() {
|
||||||
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "ui_transmitter.hpp"
|
#include "ui_transmitter.hpp"
|
||||||
#include "ui_textentry.hpp"
|
#include "ui_textentry.hpp"
|
||||||
#include "ui_tabview.hpp"
|
#include "ui_tabview.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
#include "rds.hpp"
|
#include "rds.hpp"
|
||||||
|
|
||||||
using namespace rds;
|
using namespace rds;
|
||||||
@ -150,6 +150,11 @@ private:
|
|||||||
NavigationView& nav_;
|
NavigationView& nav_;
|
||||||
RDS_flags rds_flags { };
|
RDS_flags rds_flags { };
|
||||||
|
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
|
|
||||||
std::vector<RDSGroup> frame_psn { };
|
std::vector<RDSGroup> frame_psn { };
|
||||||
std::vector<RDSGroup> frame_radiotext { };
|
std::vector<RDSGroup> frame_radiotext { };
|
||||||
std::vector<RDSGroup> frame_datetime { };
|
std::vector<RDSGroup> frame_datetime { };
|
||||||
|
@ -88,6 +88,10 @@ void SSTVTXView::paint(Painter&) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSTVTXView::~SSTVTXView() {
|
SSTVTXView::~SSTVTXView() {
|
||||||
|
// save app settings
|
||||||
|
app_settings.tx_frequency = transmitter_model.tuning_frequency();
|
||||||
|
settings.save("tx_sstv", &app_settings);
|
||||||
|
|
||||||
transmitter_model.disable();
|
transmitter_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
@ -215,6 +219,15 @@ SSTVTXView::SSTVTXView(
|
|||||||
options_t mode_options;
|
options_t mode_options;
|
||||||
uint32_t c;
|
uint32_t c;
|
||||||
|
|
||||||
|
// load app settings
|
||||||
|
auto rc = settings.load("tx_sstv", &app_settings);
|
||||||
|
if(rc == SETTINGS_OK) {
|
||||||
|
transmitter_model.set_rf_amp(app_settings.tx_amp);
|
||||||
|
transmitter_model.set_channel_bandwidth(app_settings.channel_bandwidth);
|
||||||
|
transmitter_model.set_tuning_frequency(app_settings.tx_frequency);
|
||||||
|
transmitter_model.set_tx_gain(app_settings.tx_gain);
|
||||||
|
}
|
||||||
|
|
||||||
// Search for valid bitmaps
|
// Search for valid bitmaps
|
||||||
file_list = scan_root_files(u"/sstv", u"*.bmp");
|
file_list = scan_root_files(u"/sstv", u"*.bmp");
|
||||||
if (!file_list.size()) {
|
if (!file_list.size()) {
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "sstv.hpp"
|
#include "sstv.hpp"
|
||||||
#include "file.hpp"
|
#include "file.hpp"
|
||||||
#include "bmp.hpp"
|
#include "bmp.hpp"
|
||||||
|
#include "app_settings.hpp"
|
||||||
|
|
||||||
using namespace sstv;
|
using namespace sstv;
|
||||||
|
|
||||||
@ -58,6 +59,9 @@ private:
|
|||||||
NavigationView& nav_;
|
NavigationView& nav_;
|
||||||
|
|
||||||
sstv_scanline scanline_buffer { };
|
sstv_scanline scanline_buffer { };
|
||||||
|
// app save settings
|
||||||
|
std::app_settings settings { };
|
||||||
|
std::app_settings::AppSettings app_settings { };
|
||||||
|
|
||||||
bool file_error { false };
|
bool file_error { false };
|
||||||
File bmp_file { };
|
File bmp_file { };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user