Merge branch 'next' into feature/disableTouch

This commit is contained in:
ArjanOnwezen 2022-04-08 16:10:55 +02:00 committed by GitHub
commit a9d2b2ff8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 37068 additions and 35942 deletions

View file

@ -22,6 +22,7 @@
#include "ais_app.hpp"
#include "string_format.hpp"
#include "database.hpp"
#include "baseband_api.hpp"
@ -62,6 +63,25 @@ static std::string mmsi(
return to_string_dec_uint(mmsi, 9, '0'); // MMSI is always is always 9 characters pre-padded with zeros
}
static std::string mid(
const ais::MMSI& mmsi
) {
std::database db;
std::string mid_code = "";
std::database::MidDBRecord mid_record = {};
int return_code = 0;
// Try getting the country name from mids.db using MID code for given MMSI
mid_code = to_string_dec_uint(mmsi, 9, ' ').substr(0, 3);
return_code = db.retrieve_mid_record(&mid_record, mid_code);
switch(return_code) {
case DATABASE_RECORD_FOUND: return mid_record.country;
case DATABASE_NOT_FOUND: return "No mids.db file";
default: return "";
}
}
static std::string navigational_status(const unsigned int value) {
switch(value) {
case 0: return "under way w/engine";
@ -271,6 +291,7 @@ void AISRecentEntryDetailView::paint(Painter& painter) {
auto field_rect = Rect { rect.left(), rect.top() + 16, rect.width(), 16 };
field_rect = draw_field(painter, field_rect, s, "MMSI", ais::format::mmsi(entry_.mmsi));
field_rect = draw_field(painter, field_rect, s, "Ctry", ais::format::mid(entry_.mmsi));
field_rect = draw_field(painter, field_rect, s, "Name", entry_.name);
field_rect = draw_field(painter, field_rect, s, "Call", entry_.call_sign);
field_rect = draw_field(painter, field_rect, s, "Dest", entry_.destination);
@ -307,8 +328,13 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
recent_entry_detail_view.hidden(true);
target_frequency_ = initial_target_frequency;
receiver_model.set_tuning_frequency(tuning_frequency());
receiver_model.set_sampling_rate(sampling_rate);
receiver_model.set_baseband_bandwidth(baseband_bandwidth);
receiver_model.enable(); // Before using radio::enable(), but not updating Ant.DC-Bias.
radio::enable({
/* radio::enable({ // this can be removed, previous version,no DC-bias control.
tuning_frequency(),
sampling_rate,
baseband_bandwidth,
@ -316,8 +342,8 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
receiver_model.rf_amp(),
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga()),
});
}); */
options_channel.on_change = [this](size_t, OptionsField::value_t v) {
this->on_frequency_changed(v);
};
@ -337,7 +363,8 @@ AISAppView::AISAppView(NavigationView& nav) : nav_ { nav } {
}
AISAppView::~AISAppView() {
radio::disable();
/* radio::disable(); */
receiver_model.disable(); // to switch off all, including DC bias.
baseband::shutdown();
}

View file

@ -131,11 +131,11 @@ private:
AISRecentEntry entry_ { };
Button button_done {
{ 125, 216, 96, 24 },
{ 125, 224, 96, 24 },
"Done"
};
Button button_see_map {
{ 19, 216, 96, 24 },
{ 19, 224, 96, 24 },
"See on map"
};
GeoMapView* geomap_view { nullptr };
@ -169,6 +169,7 @@ private:
static constexpr uint32_t initial_target_frequency = 162025000;
static constexpr uint32_t sampling_rate = 2457600;
static constexpr uint32_t baseband_bandwidth = 1750000;
NavigationView& nav_;
AISRecentEntries recent { };

View file

@ -129,6 +129,9 @@ AnalogAudioView::AnalogAudioView(
&waterfall
});
//Filename Datetime and Frequency
record_view.set_filename_date_frequency(true);
field_frequency.set_value(receiver_model.tuning_frequency());
field_frequency.set_step(receiver_model.frequency_step());
field_frequency.on_change = [this](rf::Frequency f) {

View file

@ -28,11 +28,11 @@
#include "ui_receiver.hpp"
#include "ui_spectrum.hpp"
#include "ui_record_view.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "tone_key.hpp"
namespace ui {
constexpr Style style_options_group {
@ -216,7 +216,10 @@ private:
RecordView record_view {
{ 0 * 8, 2 * 16, 30 * 8, 1 * 16 },
u"AUD_????", RecordView::FileType::WAV, 4096, 4
u"AUD",
RecordView::FileType::WAV,
4096,
4
};
spectrum::WaterfallWidget waterfall { true };

View file

@ -75,8 +75,8 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
option_bandwidth.on_change = [this](size_t, uint32_t base_rate) {
sampling_rate = 8 * base_rate; // Decimation by 8 done on baseband side
/* base_rate is used for FFT calculation and display LCD, and also in recording writing SD Card rate. */
/* ex. sampling_rate values, 4Mhz, when recording 500 khz (BW) and fs 8 Mhz , when selected 1 Mhz BW ...*/
/* ex. recording 500khz BW to .C16 file, base_rate clock 500khz x2(I,Q) x 2 bytes (int signed) =2MB/sec rate SD Card */
/* ex. sampling_rate values, 4Mhz, when recording 500 kHz (BW) and fs 8 Mhz , when selected 1 Mhz BW ...*/
/* ex. recording 500kHz BW to .C16 file, base_rate clock 500kHz x2(I,Q) x 2 bytes (int signed) =2MB/sec rate SD Card */
waterfall.on_hide();
record_view.set_sampling_rate(sampling_rate);
@ -85,12 +85,12 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
switch(sampling_rate) { // we use the var fs (sampling_rate) , to set up BPF aprox < fs_max/2 by Nyquist theorem.
case 0 ... 2000000: // BW Captured range (0 <= 250Khz max ) fs = 8 x 250 Khz
case 0 ... 2000000: // BW Captured range (0 <= 250kHz max ) fs = 8 x 250 kHz
anti_alias_baseband_bandwidth_filter = 1750000; // Minimum BPF MAX2837 for all those lower BW options.
break;
case 4000000 ... 6000000: // BW capture range (500k ... 750Khz max ) fs_max = 8 x 750Khz = 6Mhz
// BW 500k ... 750khz , ex. 500khz (fs = 8*BW = 4Mhz) , BW 600Khz (fs = 4,8Mhz) , BW 750 Khz (fs = 6Mhz)
case 4000000 ... 6000000: // BW capture range (500k ... 750kHz max ) fs_max = 8 x 750kHz = 6Mhz
// BW 500k ... 750kHz , ex. 500kHz (fs = 8*BW = 4Mhz) , BW 600kHz (fs = 4,8Mhz) , BW 750 kHz (fs = 6Mhz)
anti_alias_baseband_bandwidth_filter = 2500000; // in some IC MAX2837 appear 2250000 , but both works similar.
break;
@ -123,7 +123,7 @@ CaptureAppView::CaptureAppView(NavigationView& nav) {
waterfall.on_show();
};
option_bandwidth.set_selected_index(7); // 500k, Preselected starting default option 500khz
option_bandwidth.set_selected_index(7); // 500k, Preselected starting default option 500kHz
receiver_model.set_modulation(ReceiverModel::Mode::Capture);
receiver_model.enable();

View file

@ -140,13 +140,24 @@ void GpsSimAppView::start() {
}
);
}
field_rfgain.on_change = [this](int32_t v) {
tx_gain = v;
};
field_rfgain.set_value(tx_gain);
receiver_model.set_tx_gain(tx_gain);
field_rfamp.on_change = [this](int32_t v) {
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);
radio::enable({
receiver_model.tuning_frequency(),
sample_rate ,
baseband_bandwidth,
rf::Direction::Transmit,
receiver_model.rf_amp(),
rf_amp, // previous code line : "receiver_model.rf_amp()," was passing the same rf_amp of all Receiver Apps
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga())
});
@ -181,6 +192,9 @@ GpsSimAppView::GpsSimAppView(
NavigationView& nav
) : nav_ (nav)
{
tx_gain = 35;field_rfgain.set_value(tx_gain); // Initial default value (-12 dB's max 47dBs ).
field_rfamp.set_value(rf_amp ? 14 : 0); // Initial default value True. (TX RF amp on , +14dB's)
baseband::run_image(portapack::spi_flash::image_tag_gps);
add_children({
@ -191,8 +205,8 @@ GpsSimAppView::GpsSimAppView(
&text_duration,
&progressbar,
&field_frequency,
&field_lna,
&field_rf_amp,
&field_rfgain,
&field_rfamp, // let's not use common persistent rf_amp , local rfamp is enough
&check_loop,
&button_play,
&waterfall,

View file

@ -52,6 +52,8 @@ private:
static constexpr ui::Dim header_height = 3 * 16;
uint32_t sample_rate = 0;
int32_t tx_gain { 47 };
bool rf_amp { true }; // aux private var to store temporal, same as Replay App rf_amp user selection.
static constexpr uint32_t baseband_bandwidth = 3000000; //filter bandwidth
const size_t read_size { 16384 };
const size_t buffer_count { 3 };
@ -76,7 +78,7 @@ private:
bool ready_signal { false };
Labels labels {
{ { 10 * 8, 2 * 16 }, "LNA: A:", Color::light_grey() }
{ { 10 * 8, 2 * 16 }, "GAIN A:", Color::light_grey() }
};
Button button_open {
@ -104,11 +106,19 @@ private:
FrequencyField field_frequency {
{ 0 * 8, 2 * 16 },
};
LNAGainField field_lna {
{ 14 * 8, 2 * 16 }
NumberField field_rfgain {
{ 14 * 8, 2 * 16 },
2,
{ 0, 47 },
1,
' '
};
RFAmpField field_rf_amp {
{ 19 * 8, 2 * 16 }
NumberField field_rfamp { // previously we were using "RFAmpField field_rf_amp" but that is general Receiver amp setting.
{ 19 * 8, 2 * 16 },
2,
{ 0, 14 }, // this time we will display GUI , 0 or 14 dBs same as Mic and Replay App
14,
' '
};
Checkbox check_loop {
{ 21 * 8, 2 * 16 },

View file

@ -1,6 +1,7 @@
/*
* Copyright (C) 2016 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
* Copyleft () 2022 NotPike
*
* This file is part of PortaPack.
*
@ -121,6 +122,7 @@ void ReplayAppView::start() {
auto open_error = p->open(file_path);
if( open_error.is_valid() ) {
file_error();
return; // Fixes TX bug if there's a file error
} else {
reader = std::move(p);
}
@ -150,17 +152,19 @@ void ReplayAppView::start() {
rf_amp = (bool)v;
};
field_rfamp.set_value(rf_amp ? 14 : 0);
//Enable Bias Tee if selected
radio::set_antenna_bias(portapack::get_antenna_bias());
radio::enable({
receiver_model.tuning_frequency(),
sample_rate * 8 ,
sample_rate * 8,
baseband_bandwidth,
rf::Direction::Transmit,
rf_amp, // previous code line : "receiver_model.rf_amp()," was passing the same rf_amp of all Receiver Apps
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga())
});
});
}
void ReplayAppView::stop(const bool do_loop) {
@ -170,6 +174,7 @@ void ReplayAppView::stop(const bool do_loop) {
if (do_loop && check_loop.value()) {
start();
} else {
radio::set_antenna_bias(false); //Turn off Bias Tee
radio::disable();
button_play.set_bitmap(&bitmap_play);
}

View file

@ -34,6 +34,8 @@ namespace tpms {
namespace format {
static bool use_kpa = true;
std::string type(Reading::Type type) {
return to_string_dec_uint(toUType(type), 2);
}
@ -43,7 +45,11 @@ std::string id(TransponderID id) {
}
std::string pressure(Pressure pressure) {
return to_string_dec_int(pressure.kilopascal(), 3);
if(use_kpa){
return to_string_dec_int(pressure.kilopascal(), 3);
}
return to_string_dec_int(pressure.psi(), 3);
}
std::string temperature(Temperature temperature) {
@ -142,7 +148,7 @@ TPMSAppView::TPMSAppView(NavigationView&) {
&field_rf_amp,
&field_lna,
&field_vga,
&recent_entries_view,
&options_type,
});
radio::enable({
@ -160,6 +166,17 @@ TPMSAppView::TPMSAppView(NavigationView&) {
};
options_band.set_by_value(target_frequency());
options_type.on_change = [this](size_t, int32_t i) {
if (i == 0){
tpms::format::use_kpa = true;
} else if (i == 1){
tpms::format::use_kpa = false;
}
update_type();
};
options_type.set_selected_index(0, true);
logger = std::make_unique<TPMSLogger>();
if( logger ) {
logger->append(u"tpms.txt");
@ -176,9 +193,24 @@ void TPMSAppView::focus() {
options_band.focus();
}
void TPMSAppView::update_type() {
if (tpms::format::use_kpa){
remove_child(&recent_entries_view_psi);
add_child(&recent_entries_view_kpa);
recent_entries_view_kpa.set_parent_rect(view_normal_rect);
} else {
remove_child(&recent_entries_view_kpa);
add_child(&recent_entries_view_psi);
recent_entries_view_psi.set_parent_rect(view_normal_rect);
}
}
void TPMSAppView::set_parent_rect(const Rect new_parent_rect) {
View::set_parent_rect(new_parent_rect);
recent_entries_view.set_parent_rect({ 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height });
view_normal_rect = { 0, header_height, new_parent_rect.width(), new_parent_rect.height() - header_height };
update_type();
}
void TPMSAppView::on_packet(const tpms::Packet& packet) {
@ -191,13 +223,23 @@ void TPMSAppView::on_packet(const tpms::Packet& packet) {
const auto reading = reading_opt.value();
auto& entry = ::on_packet(recent, TPMSRecentEntry::Key { reading.type(), reading.id() });
entry.update(reading);
recent_entries_view.set_dirty();
if(tpms::format::use_kpa){
recent_entries_view_kpa.set_dirty();
} else {
recent_entries_view_psi.set_dirty();
}
}
}
void TPMSAppView::on_show_list() {
recent_entries_view.hidden(false);
recent_entries_view.focus();
if(tpms::format::use_kpa){
recent_entries_view_kpa.hidden(false);
recent_entries_view_kpa.focus();
} else {
recent_entries_view_psi.hidden(false);
recent_entries_view_psi.focus();
}
}
void TPMSAppView::on_band_changed(const uint32_t new_band_frequency) {

View file

@ -121,6 +121,8 @@ private:
static constexpr ui::Dim header_height = 1 * 16;
ui::Rect view_normal_rect { };
RSSI rssi {
{ 21 * 8, 0, 6 * 8, 4 },
};
@ -134,7 +136,16 @@ private:
3,
{
{ "315", 315000000 },
{ "434", 433920000 },
{ "433", 433920000 },
}
};
OptionsField options_type {
{ 5 * 8, 0 * 16 },
3,
{
{ "kPa", 0 },
{ "PSI", 1 }
}
};
@ -153,7 +164,7 @@ private:
TPMSRecentEntries recent { };
std::unique_ptr<TPMSLogger> logger { };
const RecentEntriesColumns columns { {
const RecentEntriesColumns columns_kpa { {
{ "Tp", 2 },
{ "ID", 8 },
{ "kPa", 3 },
@ -161,12 +172,23 @@ private:
{ "Cnt", 3 },
{ "Fl", 2 },
} };
TPMSRecentEntriesView recent_entries_view { columns, recent };
TPMSRecentEntriesView recent_entries_view_kpa { columns_kpa, recent };
const RecentEntriesColumns columns_psi { {
{ "Tp", 2 },
{ "ID", 8 },
{ "PSI", 3 },
{ "C", 3 },
{ "Cnt", 3 },
{ "Fl", 2 },
} };
TPMSRecentEntriesView recent_entries_view_psi { columns_psi, recent };
uint32_t target_frequency_ = initial_target_frequency;
void on_packet(const tpms::Packet& packet);
void on_show_list();
void update_type();
void on_band_changed(const uint32_t new_band_frequency);

View file

@ -37,7 +37,8 @@ namespace ui
console.writeln("vXxOinvizioNxX,teixeluis");
console.writeln("Brumi-2021,texasyojimbo");
console.writeln("heurist1,intoxsick,ckuethe");
console.writeln("notpike");
console.writeln("notpike,jLynx,zigad");
console.writeln("MichalLeonBorsuk");
console.writeln("");
break;

View file

@ -107,11 +107,7 @@ ADSBRxAircraftDetailsView::ADSBRxAircraftDetailsView(
const std::function<void(void)> on_close
) : entry_copy(entry),
on_close_(on_close)
{
char file_buffer[32] { 0 };
bool found = false;
size_t number_of_icao_codes = 0;
std::string icao_code;
{
add_children({
&labels,
@ -130,46 +126,22 @@ ADSBRxAircraftDetailsView::ADSBRxAircraftDetailsView(
std::unique_ptr<ADSBLogger> logger { };
//update(entry_copy);
icao_code = to_string_hex(entry_copy.ICAO_address, 6);
text_icao_address.set(to_string_hex(entry_copy.ICAO_address, 6));
// Try getting the aircraft information from icao24.db
auto result = db_file.open("ADSB/icao24.db");
if (!result.is_valid()) {
// determine number of ICAO24 codes in file, total size / (single index + record size)
number_of_icao_codes = (db_file.size() / 153);
icao_code = to_string_hex(entry_copy.ICAO_address, 6);
// binary search
int first = 0, // First search element
last = number_of_icao_codes - 1, // Last search element
middle, // Mid point of search
position = -1; // Position of search value
while (!found && first <= last) {
middle = (first + last) / 2; // Calculate mid point
db_file.seek(middle * 7);
db_file.read(file_buffer, 6);
if (file_buffer == icao_code) { // If value is found at mid
found = true;
position = middle;
}
else if (file_buffer > icao_code) // If value is in lower half
last = middle - 1;
else
first = middle + 1; // If value is in upper half
}
if (position > -1) {
db_file.seek((number_of_icao_codes * 7) + (position * 146)); // seek starting after index
db_file.read(file_buffer, 9);
text_registration.set(file_buffer);
db_file.read(file_buffer, 33);
text_manufacturer.set(file_buffer);
db_file.read(file_buffer, 33);
text_model.set(file_buffer);
db_file.read(file_buffer, 5); // ICAO type decripton
if(strlen(file_buffer) == 3) {
switch(file_buffer[0]) {
return_code = db.retrieve_aircraft_record(&aircraft_record, icao_code);
switch(return_code) {
case DATABASE_RECORD_FOUND:
text_registration.set(aircraft_record.aircraft_registration);
text_manufacturer.set(aircraft_record.aircraft_manufacturer);
text_model.set(aircraft_record.aircraft_model);
text_owner.set(aircraft_record.aircraft_owner);
text_operator.set(aircraft_record.aircraft_operator);
// Check for ICAO type, e.g. L2J
if(strlen(aircraft_record.icao_type) == 3) {
switch(aircraft_record.icao_type[0]) {
case 'L':
text_type.set("Landplane");
break;
@ -189,8 +161,8 @@ ADSBRxAircraftDetailsView::ADSBRxAircraftDetailsView(
text_type.set("Tilt-wing aircraft");
break;
}
text_number_of_engines.set(std::string(1, file_buffer[1]));
switch(file_buffer[2]) {
text_number_of_engines.set(std::string(1, aircraft_record.icao_type[1]));
switch(aircraft_record.icao_type[2]) {
case 'P':
text_engine_type.set("Piston engine");
break;
@ -206,30 +178,22 @@ ADSBRxAircraftDetailsView::ADSBRxAircraftDetailsView(
}
}
// check for ICAO type designator
else if(strlen(file_buffer) == 4) {
if(strcmp(file_buffer,"SHIP") == 0) text_type.set("Airship");
else if(strcmp(file_buffer,"BALL") == 0) text_type.set("Balloon");
else if(strcmp(file_buffer,"GLID") == 0) text_type.set("Glider / sailplane");
else if(strcmp(file_buffer,"ULAC") == 0) text_type.set("Micro/ultralight aircraft");
else if(strcmp(file_buffer,"GYRO") == 0) text_type.set("Micro/ultralight autogyro");
else if(strcmp(file_buffer,"UHEL") == 0) text_type.set("Micro/ultralight helicopter");
else if(strcmp(file_buffer,"SHIP") == 0) text_type.set("Airship");
else if(strcmp(file_buffer,"PARA") == 0) text_type.set("Powered parachute/paraplane");
}
db_file.read(file_buffer, 33);
text_owner.set(file_buffer);
db_file.read(file_buffer, 33);
text_operator.set(file_buffer);
} else {
text_registration.set("Unknown");
text_manufacturer.set("Unknown");
}
} else {
text_manufacturer.set("No icao24.db file");
// Check for ICAO type designator
else if(strlen(aircraft_record.icao_type) == 4) {
if(strcmp(aircraft_record.icao_type,"SHIP") == 0) text_type.set("Airship");
else if(strcmp(aircraft_record.icao_type,"BALL") == 0) text_type.set("Balloon");
else if(strcmp(aircraft_record.icao_type,"GLID") == 0) text_type.set("Glider / sailplane");
else if(strcmp(aircraft_record.icao_type,"ULAC") == 0) text_type.set("Micro/ultralight aircraft");
else if(strcmp(aircraft_record.icao_type,"GYRO") == 0) text_type.set("Micro/ultralight autogyro");
else if(strcmp(aircraft_record.icao_type,"UHEL") == 0) text_type.set("Micro/ultralight helicopter");
else if(strcmp(aircraft_record.icao_type,"SHIP") == 0) text_type.set("Airship");
else if(strcmp(aircraft_record.icao_type,"PARA") == 0) text_type.set("Powered parachute/paraplane");
}
break;
case DATABASE_NOT_FOUND:
text_manufacturer.set("No icao24.db file");
break;
}
button_close.on_select = [&nav](Button&){
nav.pop();
};
@ -275,11 +239,7 @@ ADSBRxDetailsView::ADSBRxDetailsView(
) : entry_copy(entry),
on_close_(on_close)
{
char file_buffer[32] { 0 };
bool found = false;
size_t number_of_airlines = 0;
std::string airline_code;
add_children({
&labels,
&text_icao_address,
@ -300,46 +260,19 @@ ADSBRxDetailsView::ADSBRxDetailsView(
// The following won't (shouldn't !) change for a given airborne aircraft
// Try getting the airline's name from airlines.db
auto result = db_file.open("ADSB/airlines.db");
if (!result.is_valid()) {
// Search for 3-letter code
number_of_airlines = (db_file.size() / 68); // determine number of airlines in file
airline_code = entry_copy.callsign.substr(0, 3);
// binary search
int first = 0, // First search element
last = number_of_airlines - 1, // Last search element
middle, // Mid point of search
position = -1; // Position of search value
while (!found && first <= last) {
middle = (first + last) / 2; // Calculate mid point
db_file.seek(middle * 4);
db_file.read(file_buffer, 3);
if (file_buffer == airline_code) { // If value is found at mid
found = true;
position = middle;
}
else if (file_buffer > airline_code) // If value is in lower half
last = middle - 1;
else
first = middle + 1; // If value is in upper half
}
if (position > -1) {
db_file.seek((number_of_airlines * 4) + (position << 6)); // seek starting after index
db_file.read(file_buffer, 32);
text_airline.set(file_buffer);
db_file.read(file_buffer, 32);
text_country.set(file_buffer);
} else {
text_airline.set("Unknown");
text_country.set("Unknown");
}
} else {
text_airline.set("No airlines.db file");
text_country.set("No airlines.db file");
airline_code = entry_copy.callsign.substr(0, 3);
return_code = db.retrieve_airline_record(&airline_record, airline_code);
switch(return_code) {
case DATABASE_RECORD_FOUND:
text_airline.set(airline_record.airline);
text_country.set(airline_record.country);
break;
case DATABASE_NOT_FOUND:
text_airline.set("No airlines.db file");
break;
}
text_callsign.set(entry_copy.callsign);
text_icao_address.set(to_string_hex(entry_copy.ICAO_address, 6));

View file

@ -27,6 +27,7 @@
#include "ui_font_fixed_8x16.hpp"
#include "file.hpp"
#include "database.hpp"
#include "recent_entries.hpp"
#include "log_file.hpp"
#include "adsb.hpp"
@ -176,13 +177,17 @@ public:
std::string title() const override { return "AC Details"; };
AircraftRecentEntry get_current_entry() { return entry_copy; }
std::database::AircraftDBRecord aircraft_record = {};
private:
AircraftRecentEntry entry_copy { 0 };
std::function<void(void)> on_close_ { };
bool send_updates { false };
File db_file { };
AircraftRecentEntry entry_copy { 0 };
std::function<void(void)> on_close_ { };
bool send_updates { false };
std::database db;
std::string icao_code = "";
int return_code = 0;
Labels labels {
{ { 0 * 8, 1 * 16 }, "ICAO:", Color::light_grey() },
{ { 0 * 8, 2 * 16 }, "Registration:", Color::light_grey() },
@ -264,14 +269,19 @@ public:
std::string title() const override { return "Details"; };
AircraftRecentEntry get_current_entry() { return entry_copy; }
std::database::AirlinesDBRecord airline_record = {};
private:
AircraftRecentEntry entry_copy { 0 };
std::function<void(void)> on_close_ { };
GeoMapView* geomap_view { nullptr };
ADSBRxAircraftDetailsView* aircraft_details_view { nullptr };
bool send_updates { false };
File db_file { };
AircraftRecentEntry entry_copy { 0 };
std::function<void(void)> on_close_ { };
GeoMapView* geomap_view { nullptr };
ADSBRxAircraftDetailsView* aircraft_details_view { nullptr };
bool send_updates { false };
std::database db;
std::string airline_code = "";
int return_code = 0;
Labels labels {
{ { 0 * 8, 1 * 16 }, "ICAO:", Color::light_grey() },

View file

@ -108,12 +108,12 @@ APRSRxView::APRSRxView(NavigationView& nav, Rect parent_rect) : View(parent_rect
options_region.on_change = [this](size_t, int32_t i) {
if (i == 0){
field_frequency.set_value(144390000);
}
if(i == 1){
} else if(i == 1){
field_frequency.set_value(144800000);
}
if(i == 2){
} else if(i == 2){
field_frequency.set_value(145175000);
} else if(i == 3){
field_frequency.set_value(144575000);
}
};

View file

@ -217,7 +217,8 @@ private:
{
{ "NA ", 0 },
{ "EUR", 1 },
{ "AUS", 2 }
{ "AUS", 2 },
{ "NZ ", 3 }
}
};

View file

@ -24,6 +24,10 @@
#include "baseband_api.hpp"
#include "audio.hpp"
#include "wm8731.hpp"
using wolfson::wm8731::WM8731;
#include "tonesets.hpp"
#include "portapack_hal.hpp"
#include "string_format.hpp"
@ -34,6 +38,10 @@
using namespace tonekey;
using namespace portapack;
WM8731 audio_codec_wm8731 { i2c0, 0x1a };
namespace ui {
void MicTXView::focus() {
@ -178,7 +186,7 @@ void MicTXView::rxaudio(bool is_on) {
baseband::run_image(portapack::spi_flash::image_tag_mic_tx);
audio::output::stop();
audio::input::start();
audio::input::start(ak4951_alc_GUI_selected); // set up audio input = mic config of any audio coded AK4951/WM8731, (in WM8731 parameter will be ignored)
portapack::pin_i2s0_rx_sda.mode(3);
configure_baseband();
}
@ -203,10 +211,12 @@ MicTXView::MicTXView(
baseband::run_image(portapack::spi_flash::image_tag_mic_tx);
add_children({
&labels,
if ( audio_codec_wm8731.detected() ) {
add_children({
&labels_WM8731, // we have audio codec WM8731, same MIC menu as original.
&vumeter,
&options_gain,
&options_gain, // MIC GAIN float factor on the GUI.
// &check_va,
&field_va,
&field_va_level,
@ -229,6 +239,37 @@ MicTXView::MicTXView(
&field_rxamp,
&tx_button
});
} else {
add_children({
&labels_AK4951, // we have audio codec AK4951, enable Automatic Level Control
&vumeter,
&options_gain,
&options_ak4951_alc_mode,
// &check_va,
&field_va,
&field_va_level,
&field_va_attack,
&field_va_decay,
&field_bw,
&field_rfgain,
&field_rfamp,
&options_mode,
&field_frequency,
&options_tone_key,
&check_rogerbeep,
&check_rxactive,
&field_volume,
&field_rxbw,
&field_squelch,
&field_rxfrequency,
&field_rxlna,
&field_rxvga,
&field_rxamp,
&tx_button
});
}
tone_keys_populate(options_tone_key);
options_tone_key.on_change = [this](size_t i, int32_t) {
@ -242,6 +283,12 @@ MicTXView::MicTXView(
};
options_gain.set_selected_index(1); // x1.0
options_ak4951_alc_mode.on_change = [this](size_t, int8_t v) {
ak4951_alc_GUI_selected = v;
audio::input::start(ak4951_alc_GUI_selected);
};
// options_ak4951_alc_mode.set_selected_index(0);
tx_frequency = transmitter_model.tuning_frequency();
field_frequency.set_value(transmitter_model.tuning_frequency());
field_frequency.set_step(receiver_model.frequency_step());
@ -478,7 +525,7 @@ MicTXView::MicTXView(
set_tx(false);
audio::set_rate(audio::Rate::Hz_24000);
audio::input::start();
audio::input::start(ak4951_alc_GUI_selected); // originally , audio::input::start(); (we added parameter)
}
MicTXView::~MicTXView() {

View file

@ -83,6 +83,7 @@ private:
bool rx_enabled { false };
uint32_t tone_key_index { };
float mic_gain { 1.0 };
uint8_t ak4951_alc_GUI_selected { 0 };
uint32_t audio_level { 0 };
uint32_t va_level { };
uint32_t attack_ms { };
@ -106,8 +107,8 @@ private:
bool enable_lsb { false };
Labels labels {
{ { 3 * 8, 1 * 8 }, "MIC. GAIN:", Color::light_grey() },
Labels labels_WM8731 {
{ { 3 * 8, 1 * 8 }, "MIC-GAIN:", Color::light_grey() },
{ { 3 * 8, 3 * 8 }, "F:", Color::light_grey() },
{ { 15 * 8, 3 * 8 }, "BW: FM kHz", Color::light_grey() },
{ { 3 * 8, 5 * 8 }, "GAIN:", Color::light_grey() },
@ -118,15 +119,36 @@ private:
{ {12 * 8, 10 * 8 }, "ATT:", Color::light_grey() },
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
{ { 9 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
{ {17 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
{ {15 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
{ {12 * 8, 27 * 8 }, "VGA:", Color::light_grey()},
{ {19 * 8, 27 * 8 }, "AMP:", Color::light_grey()}
};
Labels labels_AK4951 {
{ { 3 * 8, 1 * 8 }, "MIC-GAIN:", Color::light_grey() },
{ { 17 * 8, 1 * 8 }, "ALC", Color::light_grey() },
{ { 3 * 8, 3 * 8 }, "F:", Color::light_grey() },
{ { 15 * 8, 3 * 8 }, "BW: FM kHz", Color::light_grey() },
{ { 3 * 8, 5 * 8 }, "GAIN:", Color::light_grey() },
{ {11 * 8, 5 * 8 }, "Amp:", Color::light_grey() },
{ { 18 * 8, (5 * 8) }, "Mode:", Color::light_grey() },
{ { 3 * 8, 8 * 8 }, "TX Activation:", Color::light_grey() },
{ { 4 * 8, 10 * 8 }, "LVL:", Color::light_grey() },
{ {12 * 8, 10 * 8 }, "ATT:", Color::light_grey() },
{ {20 * 8, 10 * 8 }, "DEC:", Color::light_grey() },
{ { 4 * 8, ( 13 * 8 ) - 2 }, "TONE KEY:", Color::light_grey() },
{ { 7 * 8, 23 * 8 }, "VOL:", Color::light_grey() },
{ {15 * 8, 23 * 8 }, "FM RXBW:", Color::light_grey() },
{ {17 * 8, 25 * 8 }, "SQ:", Color::light_grey() },
{ { 5 * 8, 25 * 8 }, "F:", Color::light_grey() },
{ { 5 * 8, 27 * 8 }, "LNA:", Color::light_grey()},
{ {12 * 8, 27 * 8 }, "VGA:", Color::light_grey()},
{ {19 * 8, 27 * 8 }, "AMP:", Color::light_grey()}
};
VuMeter vumeter {
{ 0 * 8, 1 * 8, 2 * 8, 33 * 8 },
12,
@ -135,7 +157,7 @@ private:
OptionsField options_gain {
{ 13 * 8, 1 * 8 },
{ 12 * 8, 1 * 8 },
4,
{
{ "x0.5", 5 },
@ -145,6 +167,25 @@ private:
}
};
OptionsField options_ak4951_alc_mode {
{ 20 * 8, 1 * 8 }, // Coordinates are: int:x (px), int:y (px)
11,
{
{ " OFF-20kHz", 0 }, // Nothing changed from ORIGINAL,keeping ALL programm. AK4951 Dig. block->OFF)
{ "+12dB-6kHz", 1 }, // ALC-> on, (+12dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "+09dB-6kHz", 2 }, // ALC-> on, (+09dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "+06dB-6kHz", 3 }, // ALC-> on, (+06dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "+03dB-2kHz", 4 }, // ALC-> on, (+03dB's) Auto Vol max + Wind Noise cancel + LPF 3,5k + Pre-amp Mic (+21dB=original)+ EQ boosting ~<2kHz (f0~1k1,fb:1,7K, k=1,8)
{ "+03dB-4kHz", 5 }, // ALC-> on, (+03dB's) Auto Vol max + Wind Noise cancel + LPF 4kHz + Pre-amp Mic (+21dB=original)+ EQ boosting ~<3kHz (f0~1k4,fb~2,4k, k=1,8)
{ "+03dB-6kHz", 6 }, // ALC-> on, (+03dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "+00dB-6kHz", 7 }, // ALC-> on, (+00dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "-03dB-6kHz", 8 }, // ALC-> on, (-03dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "-06dB-6kHz", 9 }, // ALC-> on, (-06dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz + Pre-amp Mic (+21dB=original)
{ "-09dB-6kHz", 10 }, // ALC-> on, (-09dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz - Pre-amp MIC -3dB (18dB's)
{ "-12dB-6kHz", 11 }, // ALC-> on, (-12dB's) Auto Vol max + Wind Noise cancel + LPF 6kHz - Pre-amp MIC -6dB (15dB's)
}
};
FrequencyField field_frequency {
{ 5 * 8, 3 * 8 },
};
@ -244,7 +285,7 @@ private:
};
NumberField field_volume {
{ 13 * 8, 23 * 8 },
{ 11* 8, 23 * 8 },
2,
{ 0, 99 },
1,
@ -252,7 +293,7 @@ private:
};
OptionsField field_rxbw {
{ 25 * 8, 23 * 8},
{ 23* 8, 23 * 8},
3,
{
{"8k5", 0},

View file

@ -484,6 +484,7 @@ void ScannerView::scan_pause() {
scan_thread->set_freq_lock(0); //Reset the scanner lock (because user paused, or MAX_FREQ_LOCK reached) for next freq scan
scan_thread->set_scanning(false); // WE STOP SCANNING
audio::output::start();
on_headphone_volume_changed(field_volume.value()); // quick fix to make sure WM8731S chips don't stay silent after pause
}
}

View file

@ -242,16 +242,16 @@ private:
{ 17 * 8, (26 * 8) + 4 },
12,
{
{ "5Khz (SA AM)", 5000 },
{ "9Khz (EU AM)", 9000 },
{ "10Khz(US AM)", 10000 },
{ "50Khz (FM1)", 50000 },
{ "100Khz(FM2)", 100000 },
{ "6.25khz(NFM)", 6250 },
{ "12.5khz(NFM)", 12500 },
{ "25khz (N1)", 25000 },
{ "250khz (N2)", 250000 },
{ "8.33khz(AIR)", 8330 }
{ "5kHz (SA AM)", 5000 },
{ "9kHz (EU AM)", 9000 },
{ "10kHz(US AM)", 10000 },
{ "50kHz (FM1)", 50000 },
{ "100kHz(FM2)", 100000 },
{ "6.25kHz(NFM)", 6250 },
{ "12.5kHz(NFM)", 12500 },
{ "25kHz (N1)", 25000 },
{ "250kHz (N2)", 250000 },
{ "8.33kHz(AIR)", 8330 }
}
};
@ -308,4 +308,4 @@ private:
};
};
} /* namespace ui */
} /* namespace ui */

View file

@ -224,59 +224,6 @@ SetFrequencyCorrectionModel SetRadioView::form_collect() {
};
}
/*
SetPlayDeadView::SetPlayDeadView(NavigationView& nav) {
add_children({
&text_sequence,
&button_enter,
&button_cancel
});
button_enter.on_select = [this, &nav](Button&){
if (!entermode) {
sequence = 0;
keycount = 0;
memset(sequence_txt, '-', 10);
text_sequence.set(sequence_txt);
entermode = true;
button_cancel.hidden(true);
set_dirty();
} else {
if (sequence == 0x8D1) // U D L R
nav.display_modal("Warning", "Default sequence entered !", ABORT, nullptr);
else {
persistent_memory::set_playdead_sequence(sequence);
nav.pop();
}
}
};
button_enter.on_dir = [this](Button&, KeyEvent key){
if ((entermode == true) && (keycount < 10)) {
key_code = static_cast<std::underlying_type<KeyEvent>::type>(key);
if (key_code == 0)
sequence_txt[keycount] = 'R';
else if (key_code == 1)
sequence_txt[keycount] = 'L';
else if (key_code == 2)
sequence_txt[keycount] = 'D';
else if (key_code == 3)
sequence_txt[keycount] = 'U';
text_sequence.set(sequence_txt);
sequence = (sequence << 3) | (key_code + 1);
keycount++;
return true;
}
return false;
};
button_cancel.on_select = [&nav](Button&){ nav.pop(); };
}
void SetPlayDeadView::focus() {
button_cancel.focus();
}
*/
SetUIView::SetUIView(NavigationView& nav) {
add_children({
@ -295,7 +242,6 @@ SetUIView::SetUIView(NavigationView& nav) {
checkbox_speaker.set_value(persistent_memory::config_speaker());
checkbox_showsplash.set_value(persistent_memory::config_splash());
checkbox_showclock.set_value(!persistent_memory::hide_clock());
//checkbox_login.set_value(persistent_memory::config_login());
uint32_t backlight_timer = persistent_memory::config_backlight_timer();
if (backlight_timer) {
@ -348,209 +294,58 @@ SetAudioView::SetAudioView(NavigationView& nav) {
add_children({
&labels,
&field_tone_mix,
&button_ok
&button_save,
&button_cancel
});
field_tone_mix.set_value(persistent_memory::tone_mix());
button_ok.on_select = [&nav, this](Button&) {
button_save.on_select = [&nav, this](Button&) {
persistent_memory::set_tone_mix(field_tone_mix.value());
nav.pop();
};
button_cancel.on_select = [&nav, this](Button&) {
nav.pop();
};
}
void SetAudioView::focus() {
field_tone_mix.focus();
button_save.focus();
}
/*void ModInfoView::on_show() {
if (modules_nb) update_infos(0);
}
SetQRCodeView::SetQRCodeView(NavigationView& nav) {
add_children({
&checkbox_bigger_qr,
&button_save,
&button_cancel
});
void ModInfoView::update_infos(uint8_t modn) {
char info_str[27];
char ch;
uint8_t c;
Point pos = { 0, 0 };
Rect rect = { { 16, 144 }, { 208, 144 } };
checkbox_bigger_qr.set_value(persistent_memory::show_bigger_qr_code());
info_str[0] = 0;
strcat(info_str, module_list[modn].name);
text_namestr.set(info_str);
info_str[0] = 0;
strcat(info_str, to_string_dec_uint(module_list[modn].size).c_str());
strcat(info_str, " bytes");
text_sizestr.set(info_str);
info_str[0] = 0;
for (c = 0; c < 8; c++)
strcat(info_str, to_string_hex(module_list[modn].md5[c], 2).c_str());
text_md5_a.set(info_str);
info_str[0] = 0;
for (c = 8; c < 16; c++)
strcat(info_str, to_string_hex(module_list[modn].md5[c], 2).c_str());
text_md5_b.set(info_str);
// TODO: Use ui_console
display.fill_rectangle(rect, Color::black());
const Font& font = font::fixed_8x16;
const auto line_height = font.line_height();
c = 0;
while((ch = module_list[modn].description[c++])) {
const auto glyph = font.glyph(ch);
const auto advance = glyph.advance();
if((pos.x + advance.x) > rect.width()) {
pos.x = 0;
pos.y += line_height;
}
const Point pos_glyph {
static_cast<Coord>(rect.pos.x + pos.x),
static_cast<Coord>(rect.pos.y + pos.y)
};
display.draw_glyph(pos_glyph, glyph, Color::white(), Color::black());
pos.x += advance.x;
}
}
ModInfoView::ModInfoView(NavigationView& nav) {
const char magic[4] = {'P', 'P', 'M', ' '};
UINT bw;
uint8_t i;
char read_buf[16];
char info_str[25];
FILINFO modinfo;
FIL modfile;
DIR rootdir;
FRESULT res;
uint8_t c;
using option_t = std::pair<std::string, int32_t>;
using options_t = std::vector<option_t>;
option_t opt;
options_t opts;
static constexpr Style style_orange {
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::orange(),
};
add_children({{
&text_modcount,
&text_name,
&text_namestr,
&text_size,
&text_sizestr,
&text_md5,
&text_md5_a,
&text_md5_b,
&button_ok
}});
text_name.set_style(&style_orange);
text_size.set_style(&style_orange);
text_md5.set_style(&style_orange);
// TODO: Find a way to merge this with m4_load_image() in m4_startup.cpp
// Scan SD card root directory for files starting with the magic bytes
c = 0;
if (f_opendir(&rootdir, "/") == FR_OK) {
for (;;) {
res = f_readdir(&rootdir, &modinfo);
if (res != FR_OK || modinfo.fname[0] == 0) break; // Reached last file, abort
// Only care about files with .bin extension
if ((!(modinfo.fattrib & AM_DIR)) && (modinfo.fname[9] == 'B') && (modinfo.fname[10] == 'I') && (modinfo.fname[11] == 'N')) {
f_open(&modfile, modinfo.fname, FA_OPEN_EXISTING | FA_READ);
// Magic bytes check
f_read(&modfile, &read_buf, 4, &bw);
for (i = 0; i < 4; i++)
if (read_buf[i] != magic[i]) break;
if (i == 4) {
memcpy(&module_list[c].filename, modinfo.fname, 8);
module_list[c].filename[8] = 0;
f_lseek(&modfile, 4);
f_read(&modfile, &module_list[c].version, 2, &bw);
f_lseek(&modfile, 6);
f_read(&modfile, &module_list[c].size, 4, &bw);
f_lseek(&modfile, 10);
f_read(&modfile, &module_list[c].name, 16, &bw);
f_lseek(&modfile, 26);
f_read(&modfile, &module_list[c].md5, 16, &bw);
f_lseek(&modfile, 42);
f_read(&modfile, &module_list[c].description, 214, &bw);
f_lseek(&modfile, 256);
// Sanitize
module_list[c].name[15] = 0;
module_list[c].description[213] = 0;
memcpy(info_str, module_list[c].filename, 16);
strcat(info_str, "(V");
strcat(info_str, to_string_dec_uint(module_list[c].version, 4, '0').c_str());
strcat(info_str, ")");
while(strlen(info_str) < 24)
strcat(info_str, " ");
opt = std::make_pair(info_str, c);
opts.insert(opts.end(), opt);
c++;
}
f_close(&modfile);
}
if (c == 8) break;
}
}
f_closedir(&rootdir);
modules_nb = c;
if (modules_nb) {
strcpy(info_str, "Found ");
strcat(info_str, to_string_dec_uint(modules_nb, 1).c_str());
strcat(info_str, " module(s)");
text_modcount.set(info_str);
option_modules.set_options(opts);
add_child(&option_modules);
option_modules.on_change = [this](size_t n, OptionsField::value_t v) {
(void)n;
update_infos(v);
};
} else {
strcpy(info_str, "No modules found");
text_modcount.set(info_str);
}
button_ok.on_select = [&nav,this](Button&){
button_save.on_select = [&nav, this](Button&) {
persistent_memory::set_show_bigger_qr_code(checkbox_bigger_qr.value());
nav.pop();
};
button_cancel.on_select = [&nav, this](Button&) {
nav.pop();
};
}
void ModInfoView::focus() {
if (modules_nb)
option_modules.focus();
else
button_ok.focus();
}*/
void SetQRCodeView::focus() {
button_save.focus();
}
SettingsMenuView::SettingsMenuView(NavigationView& nav) {
add_items({
//{ "..", ui::Color::light_grey(), &bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
{ "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetRadioView>(); } },
{ "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
{ "Radio", ui::Color::dark_cyan(), &bitmap_icon_options_radio, [&nav](){ nav.push<SetRadioView>(); } },
{ "Interface", ui::Color::dark_cyan(), &bitmap_icon_options_ui, [&nav](){ nav.push<SetUIView>(); } },
//{ "SD card modules", ui::Color::dark_cyan(), [&nav](){ nav.push<ModInfoView>(); } },
{ "Date/Time", ui::Color::dark_cyan(), &bitmap_icon_options_datetime, [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Date/Time", ui::Color::dark_cyan(), &bitmap_icon_options_datetime, [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Touchscreen", ui::Color::dark_cyan(), &bitmap_icon_options_touch, [&nav](){ nav.push<TouchCalibrationView>(); } },
//{ "Play dead", ui::Color::dark_cyan(), &bitmap_icon_playdead, [&nav](){ nav.push<SetPlayDeadView>(); } }
{ "QR code", ui::Color::dark_cyan(), &bitmap_icon_qr_code, [&nav](){ nav.push<SetQRCodeView>(); } }
});
set_max_rows(2); // allow wider buttons
}

View file

@ -219,11 +219,6 @@ public:
std::string title() const override { return "UI settings"; };
private:
/*Checkbox checkbox_login {
{ 3 * 8, 2 * 16 },
20,
"Login with play dead"
};*/
Checkbox checkbox_disable_touchscreen {
{ 3 * 8, 2 * 16 },
@ -304,111 +299,43 @@ private:
'0'
};
Button button_ok {
Button button_save {
{ 2 * 8, 16 * 16, 12 * 8, 32 },
"Save"
};
Button button_cancel {
{ 16 * 8, 16 * 16, 12 * 8, 32 },
"Cancel",
};
};
/*
class SetPlayDeadView : public View {
public:
SetPlayDeadView(NavigationView& nav);
void focus() override;
std::string title() const override { return "Playdead settings"; };
private:
bool entermode = false;
uint32_t sequence { 0 };
uint8_t keycount { 0 }, key_code { };
char sequence_txt[11] = { 0 };
Text text_sequence {
{ 64, 32, 14 * 8, 16 },
"Enter sequence",
};
Button button_enter {
{ 16, 192, 96, 24 },
"Enter"
};
Button button_cancel {
{ 128, 192, 96, 24 },
"Cancel"
};
};*/
/*class ModInfoView : public View {
class SetQRCodeView : public View {
public:
ModInfoView(NavigationView& nav);
SetQRCodeView(NavigationView& nav);
void focus() override;
void on_show() override;
std::string title() const override { return "QR code settings"; };
private:
void update_infos(uint8_t modn);
typedef struct moduleinfo_t{
char filename[9];
uint16_t version;
uint32_t size;
char md5[16];
char name[16];
char description[214];
} moduleinfo_t;
moduleinfo_t module_list[8]; // 8 max for now
uint8_t modules_nb;
Text text_modcount {
{ 2 * 8, 1 * 16, 18 * 8, 16 },
"Searching..."
Checkbox checkbox_bigger_qr {
{ 3 * 8, 9 * 16 },
20,
"Show large QR code"
};
OptionsField option_modules {
{ 2 * 8, 2 * 16 },
24,
{
{ "-", 0 }
}
Button button_save {
{ 2 * 8, 16 * 16, 12 * 8, 32 },
"Save"
};
Text text_name {
{ 2 * 8, 4 * 16, 5 * 8, 16 },
"Name:"
Button button_cancel {
{ 16 * 8, 16 * 16, 12 * 8, 32 },
"Cancel",
};
Text text_namestr {
{ 8 * 8, 4 * 16, 16 * 8, 16 },
"..."
};
Text text_size {
{ 2 * 8, 5 * 16, 5 * 8, 16 },
"Size:"
};
Text text_sizestr {
{ 8 * 8, 5 * 16, 16 * 8, 16 },
"..."
};
Text text_md5 {
{ 2 * 8, 6 * 16, 4 * 8, 16 },
"MD5:"
};
Text text_md5_a {
{ 7 * 8, 6 * 16, 16 * 8, 16 },
"..."
};
Text text_md5_b {
{ 7 * 8, 7 * 16, 16 * 8, 16 },
"..."
};
Button button_ok {
{ 4 * 8, 272, 64, 24 },
"Ok"
};
};*/
};
class SettingsMenuView : public BtnGridView {
public:

View file

@ -100,7 +100,12 @@ SondeView::SondeView(NavigationView& nav) {
use_crc = v;
};
radio::enable({
receiver_model.set_tuning_frequency(tuning_frequency());
receiver_model.set_sampling_rate(sampling_rate);
receiver_model.set_baseband_bandwidth(baseband_bandwidth);
receiver_model.enable(); // Before using radio::enable(), but not updating Ant.DC-Bias.
/* radio::enable({ // this can be removed, previous version, no DC-bias ant. control.
tuning_frequency(),
sampling_rate,
baseband_bandwidth,
@ -108,7 +113,7 @@ SondeView::SondeView(NavigationView& nav) {
receiver_model.rf_amp(),
static_cast<int8_t>(receiver_model.lna()),
static_cast<int8_t>(receiver_model.vga()),
});
}); */
// QR code with geo URI
@ -153,7 +158,8 @@ SondeView::SondeView(NavigationView& nav) {
SondeView::~SondeView() {
baseband::set_pitch_rssi(0, false);
radio::disable();
/* radio::disable(); */
receiver_model.disable(); // to switch off all, including DC bias.
baseband::shutdown();
audio::output::stop();
}