Added some skeletons

Renamed "Scanner" to "Search"
Modified splash bitmap
Disabled Nuoptix TX
This commit is contained in:
furrtek 2018-03-27 12:52:07 +01:00
parent 8573f760be
commit d0ce9610b5
23 changed files with 1969 additions and 1690 deletions

View File

@ -227,10 +227,12 @@ set(CPPSRC
apps/ui_mictx.cpp apps/ui_mictx.cpp
apps/ui_modemsetup.cpp apps/ui_modemsetup.cpp
apps/ui_morse.cpp apps/ui_morse.cpp
apps/ui_nuoptix.cpp # apps/ui_nuoptix.cpp
apps/ui_pocsag_tx.cpp apps/ui_pocsag_tx.cpp
apps/ui_rds.cpp apps/ui_rds.cpp
apps/ui_remote.cpp
apps/ui_scanner.cpp apps/ui_scanner.cpp
apps/ui_search.cpp
apps/ui_sd_wipe.cpp apps/ui_sd_wipe.cpp
apps/ui_setup.cpp apps/ui_setup.cpp
apps/ui_siggen.cpp apps/ui_siggen.cpp

View File

@ -41,11 +41,13 @@ void RecentEntriesTable<AircraftRecentEntries>::draw(
) { ) {
char aged_color; char aged_color;
Color target_color; Color target_color;
auto entry_age = entry.age;
if (entry.age < 10) { // Color decay for flights not being updated anymore
if (entry_age < ADSB_DECAY_A) {
aged_color = 0x10; aged_color = 0x10;
target_color = Color::green(); target_color = Color::green();
} else if ((entry.age >= 10) && (entry.age < 30)) { } else if ((entry_age >= ADSB_DECAY_A) && (entry_age < ADSB_DECAY_B)) {
aged_color = 0x07; aged_color = 0x07;
target_color = Color::light_grey(); target_color = Color::light_grey();
} else { } else {
@ -53,9 +55,9 @@ void RecentEntriesTable<AircraftRecentEntries>::draw(
target_color = Color::dark_grey(); target_color = Color::dark_grey();
} }
std::string string = "\x1B"; std::string entry_string = "\x1B";
string += aged_color; entry_string += aged_color;
string += to_string_hex(entry.ICAO_address, 6) + " " + entry_string += to_string_hex(entry.ICAO_address, 6) + " " +
entry.callsign + " " + entry.callsign + " " +
(entry.hits <= 999 ? to_string_dec_uint(entry.hits, 4) : "999+") + " " + (entry.hits <= 999 ? to_string_dec_uint(entry.hits, 4) : "999+") + " " +
entry.time_string; entry.time_string;
@ -63,7 +65,7 @@ void RecentEntriesTable<AircraftRecentEntries>::draw(
painter.draw_string( painter.draw_string(
target_rect.location(), target_rect.location(),
style, style,
string entry_string
); );
if (entry.pos.valid) if (entry.pos.valid)
@ -125,6 +127,7 @@ ADSBRxDetailsView::ADSBRxDetailsView(
&text_frame_pos_odd, &text_frame_pos_odd,
&button_see_map &button_see_map
}); });
std::unique_ptr<ADSBLogger> logger { }; std::unique_ptr<ADSBLogger> logger { };
update(entry_copy); update(entry_copy);
@ -206,8 +209,9 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
entry.set_time_string(str_timestamp); entry.set_time_string(str_timestamp);
entry.inc_hit(); entry.inc_hit();
logentry+=to_string_hex_array(frame.get_raw_data(), 14)+" "; logentry += to_string_hex_array(frame.get_raw_data(), 14) + " ";
logentry+="ICAO:"+to_string_hex(ICAO_address, 6) +" "; logentry += "ICAO:" + to_string_hex(ICAO_address, 6) + " ";
if (frame.get_DF() == DF_ADSB) { if (frame.get_DF() == DF_ADSB) {
uint8_t msg_type = frame.get_msg_type(); uint8_t msg_type = frame.get_msg_type();
uint8_t * raw_data = frame.get_raw_data(); uint8_t * raw_data = frame.get_raw_data();
@ -235,24 +239,29 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) {
} }
} }
recent_entries_view.set_dirty(); recent_entries_view.set_dirty();
logger = std::make_unique<ADSBLogger>(); logger = std::make_unique<ADSBLogger>();
if( logger ) { if (logger) {
logger->append(u"adsb.txt"); logger->append(u"adsb.txt");
// will log each frame in format: // will log each frame in format:
// 20171103100227 8DADBEEFDEADBEEFDEADBEEFDEADBEEF ICAO:nnnnnn callsign Alt:nnnnnn Latnnn.nn Lonnnn.nn // 20171103100227 8DADBEEFDEADBEEFDEADBEEFDEADBEEF ICAO:nnnnnn callsign Alt:nnnnnn Latnnn.nn Lonnnn.nn
logger->log_str(logentry); logger->log_str(logentry);
} }
} }
} }
void ADSBRxView::on_tick_second() { void ADSBRxView::on_tick_second() {
// Decay and refresh if needed
for (auto& entry : recent) { for (auto& entry : recent) {
entry.inc_age(); entry.inc_age();
if ((entry.age == 10) || (entry.age == 30))
recent_entries_view.set_dirty(); if (details_view) {
if (details_view && send_updates && (entry.key() == detailed_entry_key)) if (send_updates && (entry.key() == detailed_entry_key))
details_view->update(entry); details_view->update(entry);
} else {
if ((entry.age == ADSB_DECAY_A) || (entry.age == ADSB_DECAY_B))
recent_entries_view.set_dirty();
}
} }
} }

View File

@ -21,10 +21,12 @@
*/ */
#include "ui.hpp" #include "ui.hpp"
#include "file.hpp"
#include "ui_receiver.hpp" #include "ui_receiver.hpp"
#include "ui_geomap.hpp" #include "ui_geomap.hpp"
#include "ui_font_fixed_8x16.hpp" #include "ui_font_fixed_8x16.hpp"
#include "file.hpp"
#include "recent_entries.hpp" #include "recent_entries.hpp"
#include "log_file.hpp" #include "log_file.hpp"
#include "adsb.hpp" #include "adsb.hpp"
@ -34,6 +36,10 @@ using namespace adsb;
namespace ui { namespace ui {
#define ADSB_DECAY_A 10 // In seconds
#define ADSB_DECAY_B 30
#define ADSB_DECAY_C 60 // Can be used for removing old entries, RecentEntries already caps to 64
struct AircraftRecentEntry { struct AircraftRecentEntry {
using Key = uint32_t; using Key = uint32_t;

View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2018 Furrtek
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "ui_remote.hpp"
#include "baseband_api.hpp"
#include "string_format.hpp"
using namespace portapack;
namespace ui {
void RemoteView::focus() {
button.focus();
}
RemoteView::~RemoteView() {
//transmitter_model.disable();
//baseband::shutdown();
}
RemoteView::RemoteView(
NavigationView& nav
) {
add_children({
&labels,
&button
});
button.on_select = [this, &nav](Button&) {
nav.pop();
};
}
} /* namespace ui */

View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2018 Furrtek
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "ui.hpp"
#include "ui_transmitter.hpp"
#include "transmitter_model.hpp"
namespace ui {
class RemoteView : public View {
public:
RemoteView(NavigationView& nav);
~RemoteView();
void focus() override;
std::string title() const override { return "Custom remote"; };
private:
/*enum tx_modes {
IDLE = 0,
SINGLE,
SCAN
};
tx_modes tx_mode = IDLE;
struct remote_layout_t {
Point position;
std::string text;
};
const std::array<remote_layout_t, 32> remote_layout { };*/
Labels labels {
{ { 1 * 8, 0 }, "Work in progress...", Color::light_grey() }
};
Button button {
{ 60, 64, 120, 32 },
"Exit"
};
};
} /* namespace ui */

View File

@ -29,405 +29,29 @@ using namespace portapack;
namespace ui { namespace ui {
template<>
void RecentEntriesTable<ScannerRecentEntries>::draw(
const Entry& entry,
const Rect& target_rect,
Painter& painter,
const Style& style
) {
std::string str_duration = "";
if (entry.duration < 600)
str_duration = to_string_dec_uint(entry.duration / 10) + "." + to_string_dec_uint(entry.duration % 10) + "s";
else
str_duration = to_string_dec_uint(entry.duration / 600) + "m" + to_string_dec_uint((entry.duration / 10) % 60) + "s";
str_duration.resize(target_rect.width() / 8, ' ');
painter.draw_string(target_rect.location(), style, to_string_short_freq(entry.frequency) + " " + entry.time + " " + str_duration);
}
void ScannerView::focus() { void ScannerView::focus() {
field_frequency_min.focus(); button.focus();
} }
ScannerView::~ScannerView() { ScannerView::~ScannerView() {
receiver_model.disable(); //receiver_model.disable();
baseband::shutdown(); //baseband::shutdown();
}
void ScannerView::do_detection() {
uint8_t power_max = 0;
int32_t bin_max = -1;
uint32_t slice_max = 0;
uint32_t snap_value;
uint8_t power;
rtc::RTC datetime;
std::string str_approx, str_timestamp;
// Display spectrum
bin_skip_acc = 0;
pixel_index = 0;
display.draw_pixels(
{ { 0, 88 }, { (Dim)spectrum_row.size(), 1 } },
spectrum_row
);
mean_power = mean_acc / (SCAN_BIN_NB_NO_DC * slices_nb);
mean_acc = 0;
overall_power_max = 0;
// Find max power over threshold for all slices
for (size_t slice = 0; slice < slices_nb; slice++) {
power = slices[slice].max_power;
if (power > overall_power_max)
overall_power_max = power;
if ((power >= mean_power + power_threshold) && (power > power_max)) {
power_max = power;
bin_max = slices[slice].max_index;
slice_max = slice;
}
}
// Lock / release
if ((bin_max >= last_bin - 2) && (bin_max <= last_bin + 2) && (bin_max > -1) && (slice_max == last_slice)) {
// Staying around the same bin
if (detect_timer >= DETECT_DELAY) {
if ((bin_max != locked_bin) || (!locked)) {
if (!locked) {
resolved_frequency = slices[slice_max].center_frequency + (SCAN_BIN_WIDTH * (bin_max - 128));
if (check_snap.value()) {
snap_value = options_snap.selected_index_value();
resolved_frequency = round(resolved_frequency / snap_value) * snap_value;
}
// Check range
if ((resolved_frequency >= f_min) && (resolved_frequency <= f_max)) {
duration = 0;
auto& entry = ::on_packet(recent, resolved_frequency);
rtcGetTime(&RTCD1, &datetime);
str_timestamp = to_string_dec_uint(datetime.hour(), 2, '0') + ":" +
to_string_dec_uint(datetime.minute(), 2, '0') + ":" +
to_string_dec_uint(datetime.second(), 2, '0');
entry.set_time(str_timestamp);
recent_entries_view.set_dirty();
text_infos.set("Locked ! ");
big_display.set_style(&style_locked);
locked = true;
locked_bin = bin_max;
// TODO
/*nav_.pop();
receiver_model.disable();
baseband::shutdown();
nav_.pop();*/
/*if (options_goto.selected_index() == 1)
nav_.push<AnalogAudioView>(false);
else if (options_goto.selected_index() == 2)
nav_.push<POCSAGAppView>();
*/
} else
text_infos.set("Out of range");
}
big_display.set(resolved_frequency);
}
}
release_timer = 0;
} else {
detect_timer = 0;
if (locked) {
if (release_timer >= RELEASE_DELAY) {
locked = false;
auto& entry = ::on_packet(recent, resolved_frequency);
entry.set_duration(duration);
recent_entries_view.set_dirty();
text_infos.set("Listening");
big_display.set_style(&style_grey);
}
}
}
last_bin = bin_max;
last_slice = slice_max;
scan_counter++;
// Refresh red tick
portapack::display.fill_rectangle({last_tick_pos, 90, 1, 6}, Color::black());
if (bin_max > -1) {
last_tick_pos = (Coord)(bin_max / slices_nb);
portapack::display.fill_rectangle({last_tick_pos, 90, 1, 6}, Color::red());
}
}
void ScannerView::add_spectrum_pixel(Color color) {
// Is avoiding floats really necessary ?
bin_skip_acc += bin_skip_frac;
if (bin_skip_acc < 0x10000)
return;
bin_skip_acc -= 0x10000;
if (pixel_index < 240)
spectrum_row[pixel_index++] = color;
}
void ScannerView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
uint8_t max_power = 0;
int16_t max_bin = 0;
uint8_t power;
size_t bin;
baseband::spectrum_streaming_stop();
// Add pixels to spectrum display and find max power for this slice
// Center 12 bins are ignored (DC spike is blanked)
// Leftmost and rightmost 2 bins are ignored
for (bin = 0; bin < 256; bin++) {
if ((bin < 2) || (bin > 253) || ((bin >= 122) && (bin < 134))) {
power = 0;
} else {
if (bin < 128)
power = spectrum.db[128 + bin];
else
power = spectrum.db[bin - 128];
}
add_spectrum_pixel(spectrum_rgb3_lut[power]);
mean_acc += power;
if (power > max_power) {
max_power = power;
max_bin = bin;
}
}
slices[slice_counter].max_power = max_power;
slices[slice_counter].max_index = max_bin;
if (slices_nb > 1) {
// Slice sequence
if (slice_counter >= slices_nb) {
do_detection();
slice_counter = 0;
} else
slice_counter++;
receiver_model.set_tuning_frequency(slices[slice_counter].center_frequency);
baseband::set_spectrum(SCAN_SLICE_WIDTH, 31); // Clear
} else {
// Unique slice
do_detection();
}
baseband::spectrum_streaming_start();
}
void ScannerView::on_show() {
baseband::spectrum_streaming_start();
}
void ScannerView::on_hide() {
baseband::spectrum_streaming_stop();
}
void ScannerView::on_range_changed() {
rf::Frequency slices_span, center_frequency;
int64_t offset;
size_t slice;
f_min = field_frequency_min.value();
f_max = field_frequency_max.value();
scan_span = abs(f_max - f_min);
if (scan_span > SCAN_SLICE_WIDTH) {
// ex: 100M~115M (15M span):
// slices_nb = (115M-100M)/2.5M = 6
slices_nb = (scan_span + SCAN_SLICE_WIDTH - 1) / SCAN_SLICE_WIDTH;
if (slices_nb > 32) {
text_slices.set("!!");
slices_nb = 32;
} else {
text_slices.set(to_string_dec_uint(slices_nb, 2, ' '));
}
// slices_span = 6 * 2.5M = 15M
slices_span = slices_nb * SCAN_SLICE_WIDTH;
// offset = 0 + 2.5/2 = 1.25M
offset = ((scan_span - slices_span) / 2) + (SCAN_SLICE_WIDTH / 2);
// slice_start = 100M + 1.25M = 101.25M
center_frequency = std::min(f_min, f_max) + offset;
for (slice = 0; slice < slices_nb; slice++) {
slices[slice].center_frequency = center_frequency;
center_frequency += SCAN_SLICE_WIDTH;
}
} else {
slices[0].center_frequency = (f_max + f_min) / 2;
receiver_model.set_tuning_frequency(slices[0].center_frequency);
slices_nb = 1;
text_slices.set(" 1");
}
bin_skip_frac = 0xF000 / slices_nb;
slice_counter = 0;
}
void ScannerView::on_lna_changed(int32_t v_db) {
receiver_model.set_lna(v_db);
}
void ScannerView::on_vga_changed(int32_t v_db) {
receiver_model.set_vga(v_db);
}
void ScannerView::do_timers() {
if (timing_div >= 60) {
// ~1Hz
timing_div = 0;
// Update scan rate
text_rate.set(to_string_dec_uint(scan_counter, 3));
scan_counter = 0;
}
if (timing_div % 12 == 0) {
// ~5Hz
// Update power levels
text_mean.set(to_string_dec_uint(mean_power, 3));
vu_max.set_value(overall_power_max);
vu_max.set_mark(mean_power + power_threshold);
}
if (timing_div % 6 == 0) {
// ~10Hz
// Update timing indicator
if (locked) {
progress_timers.set_max(RELEASE_DELAY);
progress_timers.set_value(RELEASE_DELAY - release_timer);
} else {
progress_timers.set_max(DETECT_DELAY);
progress_timers.set_value(detect_timer);
}
// Increment timers
if (detect_timer < DETECT_DELAY) detect_timer++;
if (release_timer < RELEASE_DELAY) release_timer++;
if (locked) duration++;
}
timing_div++;
} }
ScannerView::ScannerView( ScannerView::ScannerView(
NavigationView& nav NavigationView& nav
) : nav_ (nav) )
{ {
baseband::run_image(portapack::spi_flash::image_tag_wideband_spectrum); //baseband::run_image(portapack::spi_flash::image_tag_wideband_spectrum);
add_children({ add_children({
&labels, &labels,
&field_frequency_min, &button
&field_frequency_max,
&field_lna,
&field_vga,
&field_threshold,
&text_mean,
&text_slices,
&text_rate,
&text_infos,
&vu_max,
&progress_timers,
&check_snap,
&options_snap,
&big_display,
&recent_entries_view
}); });
baseband::set_spectrum(SCAN_SLICE_WIDTH, 31); button.on_select = [this, &nav](Button&) {
nav.pop();
recent_entries_view.set_parent_rect({ 0, 28 * 8, 240, 12 * 8 });
recent_entries_view.on_select = [this, &nav](const ScannerRecentEntry& entry) {
nav.push<FrequencyKeypadView>(entry.frequency);
}; };
text_mean.set_style(&style_grey);
text_slices.set_style(&style_grey);
text_rate.set_style(&style_grey);
progress_timers.set_style(&style_grey);
big_display.set_style(&style_grey);
check_snap.set_value(true);
options_snap.set_selected_index(1); // 12.5kHz
field_threshold.set_value(80);
field_threshold.on_change = [this](int32_t value) {
power_threshold = value;
};
field_frequency_min.set_value(receiver_model.tuning_frequency() - 1000000);
field_frequency_min.set_step(100000);
field_frequency_min.on_change = [this](rf::Frequency) {
this->on_range_changed();
};
field_frequency_min.on_edit = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
this->field_frequency_min.set_value(f);
};
};
field_frequency_max.set_value(receiver_model.tuning_frequency() + 1000000);
field_frequency_max.set_step(100000);
field_frequency_max.on_change = [this](rf::Frequency) {
this->on_range_changed();
};
field_frequency_max.on_edit = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
this->field_frequency_max.set_value(f);
};
};
field_lna.set_value(receiver_model.lna());
field_lna.on_change = [this](int32_t v) {
this->on_lna_changed(v);
};
field_vga.set_value(receiver_model.vga());
field_vga.on_change = [this](int32_t v_db) {
this->on_vga_changed(v_db);
};
progress_timers.set_max(DETECT_DELAY);
on_range_changed();
receiver_model.set_modulation(ReceiverModel::Mode::SpectrumAnalysis);
receiver_model.set_sampling_rate(SCAN_SLICE_WIDTH);
receiver_model.set_baseband_bandwidth(2500000);
receiver_model.enable();
} }
} /* namespace ui */ } /* namespace ui */

View File

@ -26,224 +26,26 @@
#include "ui_receiver.hpp" #include "ui_receiver.hpp"
#include "ui_font_fixed_8x16.hpp" #include "ui_font_fixed_8x16.hpp"
#include "recent_entries.hpp"
namespace ui { namespace ui {
#define SCAN_SLICE_WIDTH 2500000 // Scan slice bandwidth
#define SCAN_BIN_NB 256 // FFT power bins
#define SCAN_BIN_NB_NO_DC (SCAN_BIN_NB - 16) // Bins after trimming
#define SCAN_BIN_WIDTH (SCAN_SLICE_WIDTH / SCAN_BIN_NB)
#define DETECT_DELAY 5 // In 100ms units
#define RELEASE_DELAY 6
struct ScannerRecentEntry {
using Key = rf::Frequency;
static constexpr Key invalid_key = 0xffffffff;
rf::Frequency frequency;
uint32_t duration { 0 }; // In 100ms units
std::string time { "" };
ScannerRecentEntry(
) : ScannerRecentEntry { 0 }
{
}
ScannerRecentEntry(
const rf::Frequency frequency
) : frequency { frequency }
{
}
Key key() const {
return frequency;
}
void set_time(std::string& new_time) {
time = new_time;
}
void set_duration(uint32_t new_duration) {
duration = new_duration;
}
};
using ScannerRecentEntries = RecentEntries<ScannerRecentEntry>;
class ScannerView : public View { class ScannerView : public View {
public: public:
ScannerView(NavigationView& nav); ScannerView(NavigationView& nav);
~ScannerView(); ~ScannerView();
ScannerView(const ScannerView&) = delete;
ScannerView(ScannerView&&) = delete;
ScannerView& operator=(const ScannerView&) = delete;
ScannerView& operator=(ScannerView&&) = delete;
void on_show() override;
void on_hide() override;
void focus() override; void focus() override;
std::string title() const override { return "Close Call"; }; std::string title() const override { return "Scanner"; };
private: private:
NavigationView& nav_;
const Style style_grey { // For informations and lost signal
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::grey(),
};
const Style style_locked {
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::green(),
};
struct slice_t {
rf::Frequency center_frequency;
uint8_t max_power;
int16_t max_index;
uint8_t power;
int16_t index;
} slices[32];
uint32_t bin_skip_acc { 0 }, bin_skip_frac { };
uint32_t pixel_index { 0 };
std::array<Color, 240> spectrum_row = { 0 };
ChannelSpectrumFIFO* fifo { nullptr };
rf::Frequency f_min { 0 }, f_max { 0 };
uint8_t detect_timer { 0 }, release_timer { 0 }, timing_div { 0 };
uint8_t overall_power_max { 0 };
uint32_t mean_power { 0 }, mean_acc { 0 };
uint32_t duration { 0 };
uint32_t power_threshold { 80 }; // Todo: Put this in persistent / settings
rf::Frequency slice_start { 0 };
uint8_t slices_nb { 0 };
uint8_t slice_counter { 0 };
int16_t last_bin { 0 };
uint32_t last_slice { 0 };
Coord last_tick_pos { 0 };
rf::Frequency scan_span { 0 }, resolved_frequency { 0 };
uint16_t locked_bin { 0 };
uint8_t scan_counter { 0 };
bool locked { false };
void on_channel_spectrum(const ChannelSpectrum& spectrum);
void on_range_changed();
void do_detection();
void on_lna_changed(int32_t v_db);
void on_vga_changed(int32_t v_db);
void do_timers();
void add_spectrum_pixel(Color color);
const RecentEntriesColumns columns { {
{ "Frequency", 9 },
{ "Time", 8 },
{ "Duration", 11 }
} };
ScannerRecentEntries recent { };
RecentEntriesView<RecentEntries<ScannerRecentEntry>> recent_entries_view { columns, recent };
Labels labels { Labels labels {
{ { 1 * 8, 0 }, "Min: Max: LNA VGA", Color::light_grey() }, { { 1 * 8, 0 }, "Work in progress...", Color::light_grey() }
{ { 1 * 8, 4 * 8 }, "Trig: /255 Mean: /255", Color::light_grey() },
{ { 1 * 8, 6 * 8 }, "Slices: /32 Rate: Hz", Color::light_grey() },
{ { 6 * 8, 10 * 8 }, "Timer Status", Color::light_grey() },
{ { 1 * 8, 25 * 8 }, "Accuracy +/-4.9kHz", Color::light_grey() },
{ { 26 * 8, 25 * 8 }, "MHz", Color::light_grey() }
}; };
FrequencyField field_frequency_min { Button button {
{ 1 * 8, 1 * 16 }, { 60, 64, 120, 32 },
}; "Exit"
FrequencyField field_frequency_max {
{ 11 * 8, 1 * 16 },
};
LNAGainField field_lna {
{ 22 * 8, 1 * 16 }
};
VGAGainField field_vga {
{ 26 * 8, 1 * 16 }
};
NumberField field_threshold {
{ 6 * 8, 2 * 16 },
3,
{ 5, 255 },
5,
' '
};
Text text_mean {
{ 22 * 8, 2 * 16, 3 * 8, 16 },
"---"
};
Text text_slices {
{ 8 * 8, 3 * 16, 2 * 8, 16 },
"--"
};
Text text_rate {
{ 24 * 8, 3 * 16, 3 * 8, 16 },
"---"
};
VuMeter vu_max {
{ 1 * 8, 11 * 8 - 4, 3 * 8, 48 },
18,
false
};
ProgressBar progress_timers {
{ 6 * 8, 12 * 8, 6 * 8, 16 }
};
Text text_infos {
{ 13 * 8, 12 * 8, 15 * 8, 16 },
"Listening"
};
Checkbox check_snap {
{ 6 * 8, 15 * 8 },
7,
"Snap to:",
true
};
OptionsField options_snap {
{ 17 * 8, 15 * 8 },
7,
{
{ "25kHz ", 25000 },
{ "12.5kHz", 12500 },
{ "8.33kHz", 8333 }
}
};
BigFrequency big_display {
{ 4, 9 * 16, 28 * 8, 52 },
0
};
MessageHandlerRegistration message_handler_spectrum_config {
Message::ID::ChannelSpectrumConfig,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const ChannelSpectrumConfigMessage*>(p);
this->fifo = message.fifo;
}
};
MessageHandlerRegistration message_handler_frame_sync {
Message::ID::DisplayFrameSync,
[this](const Message* const) {
if( this->fifo ) {
ChannelSpectrum channel_spectrum;
while( fifo->out(channel_spectrum) ) {
this->on_channel_spectrum(channel_spectrum);
}
}
this->do_timers();
}
}; };
}; };

View File

@ -0,0 +1,433 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "ui_search.hpp"
#include "baseband_api.hpp"
#include "string_format.hpp"
using namespace portapack;
namespace ui {
template<>
void RecentEntriesTable<SearchRecentEntries>::draw(
const Entry& entry,
const Rect& target_rect,
Painter& painter,
const Style& style
) {
std::string str_duration = "";
if (entry.duration < 600)
str_duration = to_string_dec_uint(entry.duration / 10) + "." + to_string_dec_uint(entry.duration % 10) + "s";
else
str_duration = to_string_dec_uint(entry.duration / 600) + "m" + to_string_dec_uint((entry.duration / 10) % 60) + "s";
str_duration.resize(target_rect.width() / 8, ' ');
painter.draw_string(target_rect.location(), style, to_string_short_freq(entry.frequency) + " " + entry.time + " " + str_duration);
}
void SearchView::focus() {
field_frequency_min.focus();
}
SearchView::~SearchView() {
receiver_model.disable();
baseband::shutdown();
}
void SearchView::do_detection() {
uint8_t power_max = 0;
int32_t bin_max = -1;
uint32_t slice_max = 0;
uint32_t snap_value;
uint8_t power;
rtc::RTC datetime;
std::string str_approx, str_timestamp;
// Display spectrum
bin_skip_acc = 0;
pixel_index = 0;
display.draw_pixels(
{ { 0, 88 }, { (Dim)spectrum_row.size(), 1 } },
spectrum_row
);
mean_power = mean_acc / (SEARCH_BIN_NB_NO_DC * slices_nb);
mean_acc = 0;
overall_power_max = 0;
// Find max power over threshold for all slices
for (size_t slice = 0; slice < slices_nb; slice++) {
power = slices[slice].max_power;
if (power > overall_power_max)
overall_power_max = power;
if ((power >= mean_power + power_threshold) && (power > power_max)) {
power_max = power;
bin_max = slices[slice].max_index;
slice_max = slice;
}
}
// Lock / release
if ((bin_max >= last_bin - 2) && (bin_max <= last_bin + 2) && (bin_max > -1) && (slice_max == last_slice)) {
// Staying around the same bin
if (detect_timer >= DETECT_DELAY) {
if ((bin_max != locked_bin) || (!locked)) {
if (!locked) {
resolved_frequency = slices[slice_max].center_frequency + (SEARCH_BIN_WIDTH * (bin_max - 128));
if (check_snap.value()) {
snap_value = options_snap.selected_index_value();
resolved_frequency = round(resolved_frequency / snap_value) * snap_value;
}
// Check range
if ((resolved_frequency >= f_min) && (resolved_frequency <= f_max)) {
duration = 0;
auto& entry = ::on_packet(recent, resolved_frequency);
rtcGetTime(&RTCD1, &datetime);
str_timestamp = to_string_dec_uint(datetime.hour(), 2, '0') + ":" +
to_string_dec_uint(datetime.minute(), 2, '0') + ":" +
to_string_dec_uint(datetime.second(), 2, '0');
entry.set_time(str_timestamp);
recent_entries_view.set_dirty();
text_infos.set("Locked ! ");
big_display.set_style(&style_locked);
locked = true;
locked_bin = bin_max;
// TODO
/*nav_.pop();
receiver_model.disable();
baseband::shutdown();
nav_.pop();*/
/*if (options_goto.selected_index() == 1)
nav_.push<AnalogAudioView>(false);
else if (options_goto.selected_index() == 2)
nav_.push<POCSAGAppView>();
*/
} else
text_infos.set("Out of range");
}
big_display.set(resolved_frequency);
}
}
release_timer = 0;
} else {
detect_timer = 0;
if (locked) {
if (release_timer >= RELEASE_DELAY) {
locked = false;
auto& entry = ::on_packet(recent, resolved_frequency);
entry.set_duration(duration);
recent_entries_view.set_dirty();
text_infos.set("Listening");
big_display.set_style(&style_grey);
}
}
}
last_bin = bin_max;
last_slice = slice_max;
search_counter++;
// Refresh red tick
portapack::display.fill_rectangle({last_tick_pos, 90, 1, 6}, Color::black());
if (bin_max > -1) {
last_tick_pos = (Coord)(bin_max / slices_nb);
portapack::display.fill_rectangle({last_tick_pos, 90, 1, 6}, Color::red());
}
}
void SearchView::add_spectrum_pixel(Color color) {
// Is avoiding floats really necessary ?
bin_skip_acc += bin_skip_frac;
if (bin_skip_acc < 0x10000)
return;
bin_skip_acc -= 0x10000;
if (pixel_index < 240)
spectrum_row[pixel_index++] = color;
}
void SearchView::on_channel_spectrum(const ChannelSpectrum& spectrum) {
uint8_t max_power = 0;
int16_t max_bin = 0;
uint8_t power;
size_t bin;
baseband::spectrum_streaming_stop();
// Add pixels to spectrum display and find max power for this slice
// Center 12 bins are ignored (DC spike is blanked)
// Leftmost and rightmost 2 bins are ignored
for (bin = 0; bin < 256; bin++) {
if ((bin < 2) || (bin > 253) || ((bin >= 122) && (bin < 134))) {
power = 0;
} else {
if (bin < 128)
power = spectrum.db[128 + bin];
else
power = spectrum.db[bin - 128];
}
add_spectrum_pixel(spectrum_rgb3_lut[power]);
mean_acc += power;
if (power > max_power) {
max_power = power;
max_bin = bin;
}
}
slices[slice_counter].max_power = max_power;
slices[slice_counter].max_index = max_bin;
if (slices_nb > 1) {
// Slice sequence
if (slice_counter >= slices_nb) {
do_detection();
slice_counter = 0;
} else
slice_counter++;
receiver_model.set_tuning_frequency(slices[slice_counter].center_frequency);
baseband::set_spectrum(SEARCH_SLICE_WIDTH, 31); // Clear
} else {
// Unique slice
do_detection();
}
baseband::spectrum_streaming_start();
}
void SearchView::on_show() {
baseband::spectrum_streaming_start();
}
void SearchView::on_hide() {
baseband::spectrum_streaming_stop();
}
void SearchView::on_range_changed() {
rf::Frequency slices_span, center_frequency;
int64_t offset;
size_t slice;
f_min = field_frequency_min.value();
f_max = field_frequency_max.value();
search_span = abs(f_max - f_min);
if (search_span > SEARCH_SLICE_WIDTH) {
// ex: 100M~115M (15M span):
// slices_nb = (115M-100M)/2.5M = 6
slices_nb = (search_span + SEARCH_SLICE_WIDTH - 1) / SEARCH_SLICE_WIDTH;
if (slices_nb > 32) {
text_slices.set("!!");
slices_nb = 32;
} else {
text_slices.set(to_string_dec_uint(slices_nb, 2, ' '));
}
// slices_span = 6 * 2.5M = 15M
slices_span = slices_nb * SEARCH_SLICE_WIDTH;
// offset = 0 + 2.5/2 = 1.25M
offset = ((search_span - slices_span) / 2) + (SEARCH_SLICE_WIDTH / 2);
// slice_start = 100M + 1.25M = 101.25M
center_frequency = std::min(f_min, f_max) + offset;
for (slice = 0; slice < slices_nb; slice++) {
slices[slice].center_frequency = center_frequency;
center_frequency += SEARCH_SLICE_WIDTH;
}
} else {
slices[0].center_frequency = (f_max + f_min) / 2;
receiver_model.set_tuning_frequency(slices[0].center_frequency);
slices_nb = 1;
text_slices.set(" 1");
}
bin_skip_frac = 0xF000 / slices_nb;
slice_counter = 0;
}
void SearchView::on_lna_changed(int32_t v_db) {
receiver_model.set_lna(v_db);
}
void SearchView::on_vga_changed(int32_t v_db) {
receiver_model.set_vga(v_db);
}
void SearchView::do_timers() {
if (timing_div >= 60) {
// ~1Hz
timing_div = 0;
// Update scan rate
text_rate.set(to_string_dec_uint(search_counter, 3));
search_counter = 0;
}
if (timing_div % 12 == 0) {
// ~5Hz
// Update power levels
text_mean.set(to_string_dec_uint(mean_power, 3));
vu_max.set_value(overall_power_max);
vu_max.set_mark(mean_power + power_threshold);
}
if (timing_div % 6 == 0) {
// ~10Hz
// Update timing indicator
if (locked) {
progress_timers.set_max(RELEASE_DELAY);
progress_timers.set_value(RELEASE_DELAY - release_timer);
} else {
progress_timers.set_max(DETECT_DELAY);
progress_timers.set_value(detect_timer);
}
// Increment timers
if (detect_timer < DETECT_DELAY) detect_timer++;
if (release_timer < RELEASE_DELAY) release_timer++;
if (locked) duration++;
}
timing_div++;
}
SearchView::SearchView(
NavigationView& nav
) : nav_ (nav)
{
baseband::run_image(portapack::spi_flash::image_tag_wideband_spectrum);
add_children({
&labels,
&field_frequency_min,
&field_frequency_max,
&field_lna,
&field_vga,
&field_threshold,
&text_mean,
&text_slices,
&text_rate,
&text_infos,
&vu_max,
&progress_timers,
&check_snap,
&options_snap,
&big_display,
&recent_entries_view
});
baseband::set_spectrum(SEARCH_SLICE_WIDTH, 31);
recent_entries_view.set_parent_rect({ 0, 28 * 8, 240, 12 * 8 });
recent_entries_view.on_select = [this, &nav](const SearchRecentEntry& entry) {
nav.push<FrequencyKeypadView>(entry.frequency);
};
text_mean.set_style(&style_grey);
text_slices.set_style(&style_grey);
text_rate.set_style(&style_grey);
progress_timers.set_style(&style_grey);
big_display.set_style(&style_grey);
check_snap.set_value(true);
options_snap.set_selected_index(1); // 12.5kHz
field_threshold.set_value(80);
field_threshold.on_change = [this](int32_t value) {
power_threshold = value;
};
field_frequency_min.set_value(receiver_model.tuning_frequency() - 1000000);
field_frequency_min.set_step(100000);
field_frequency_min.on_change = [this](rf::Frequency) {
this->on_range_changed();
};
field_frequency_min.on_edit = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
this->field_frequency_min.set_value(f);
};
};
field_frequency_max.set_value(receiver_model.tuning_frequency() + 1000000);
field_frequency_max.set_step(100000);
field_frequency_max.on_change = [this](rf::Frequency) {
this->on_range_changed();
};
field_frequency_max.on_edit = [this, &nav]() {
auto new_view = nav.push<FrequencyKeypadView>(receiver_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
this->field_frequency_max.set_value(f);
};
};
field_lna.set_value(receiver_model.lna());
field_lna.on_change = [this](int32_t v) {
this->on_lna_changed(v);
};
field_vga.set_value(receiver_model.vga());
field_vga.on_change = [this](int32_t v_db) {
this->on_vga_changed(v_db);
};
progress_timers.set_max(DETECT_DELAY);
on_range_changed();
receiver_model.set_modulation(ReceiverModel::Mode::SpectrumAnalysis);
receiver_model.set_sampling_rate(SEARCH_SLICE_WIDTH);
receiver_model.set_baseband_bandwidth(2500000);
receiver_model.enable();
}
} /* namespace ui */

View File

@ -0,0 +1,250 @@
/*
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "receiver_model.hpp"
#include "spectrum_color_lut.hpp"
#include "ui_receiver.hpp"
#include "ui_font_fixed_8x16.hpp"
#include "recent_entries.hpp"
namespace ui {
#define SEARCH_SLICE_WIDTH 2500000 // Search slice bandwidth
#define SEARCH_BIN_NB 256 // FFT power bins
#define SEARCH_BIN_NB_NO_DC (SEARCH_BIN_NB - 16) // Bins after trimming
#define SEARCH_BIN_WIDTH (SEARCH_SLICE_WIDTH / SEARCH_BIN_NB)
#define DETECT_DELAY 5 // In 100ms units
#define RELEASE_DELAY 6
struct SearchRecentEntry {
using Key = rf::Frequency;
static constexpr Key invalid_key = 0xffffffff;
rf::Frequency frequency;
uint32_t duration { 0 }; // In 100ms units
std::string time { "" };
SearchRecentEntry(
) : SearchRecentEntry { 0 }
{
}
SearchRecentEntry(
const rf::Frequency frequency
) : frequency { frequency }
{
}
Key key() const {
return frequency;
}
void set_time(std::string& new_time) {
time = new_time;
}
void set_duration(uint32_t new_duration) {
duration = new_duration;
}
};
using SearchRecentEntries = RecentEntries<SearchRecentEntry>;
class SearchView : public View {
public:
SearchView(NavigationView& nav);
~SearchView();
SearchView(const SearchView&) = delete;
SearchView(SearchView&&) = delete;
SearchView& operator=(const SearchView&) = delete;
SearchView& operator=(SearchView&&) = delete;
void on_show() override;
void on_hide() override;
void focus() override;
std::string title() const override { return "Search"; };
private:
NavigationView& nav_;
const Style style_grey { // For informations and lost signal
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::grey(),
};
const Style style_locked {
.font = font::fixed_8x16,
.background = Color::black(),
.foreground = Color::green(),
};
struct slice_t {
rf::Frequency center_frequency;
uint8_t max_power;
int16_t max_index;
uint8_t power;
int16_t index;
} slices[32];
uint32_t bin_skip_acc { 0 }, bin_skip_frac { };
uint32_t pixel_index { 0 };
std::array<Color, 240> spectrum_row = { 0 };
ChannelSpectrumFIFO* fifo { nullptr };
rf::Frequency f_min { 0 }, f_max { 0 };
uint8_t detect_timer { 0 }, release_timer { 0 }, timing_div { 0 };
uint8_t overall_power_max { 0 };
uint32_t mean_power { 0 }, mean_acc { 0 };
uint32_t duration { 0 };
uint32_t power_threshold { 80 }; // Todo: Put this in persistent / settings
rf::Frequency slice_start { 0 };
uint8_t slices_nb { 0 };
uint8_t slice_counter { 0 };
int16_t last_bin { 0 };
uint32_t last_slice { 0 };
Coord last_tick_pos { 0 };
rf::Frequency search_span { 0 }, resolved_frequency { 0 };
uint16_t locked_bin { 0 };
uint8_t search_counter { 0 };
bool locked { false };
void on_channel_spectrum(const ChannelSpectrum& spectrum);
void on_range_changed();
void do_detection();
void on_lna_changed(int32_t v_db);
void on_vga_changed(int32_t v_db);
void do_timers();
void add_spectrum_pixel(Color color);
const RecentEntriesColumns columns { {
{ "Frequency", 9 },
{ "Time", 8 },
{ "Duration", 11 }
} };
SearchRecentEntries recent { };
RecentEntriesView<RecentEntries<SearchRecentEntry>> recent_entries_view { columns, recent };
Labels labels {
{ { 1 * 8, 0 }, "Min: Max: LNA VGA", Color::light_grey() },
{ { 1 * 8, 4 * 8 }, "Trig: /255 Mean: /255", Color::light_grey() },
{ { 1 * 8, 6 * 8 }, "Slices: /32 Rate: Hz", Color::light_grey() },
{ { 6 * 8, 10 * 8 }, "Timer Status", Color::light_grey() },
{ { 1 * 8, 25 * 8 }, "Accuracy +/-4.9kHz", Color::light_grey() },
{ { 26 * 8, 25 * 8 }, "MHz", Color::light_grey() }
};
FrequencyField field_frequency_min {
{ 1 * 8, 1 * 16 },
};
FrequencyField field_frequency_max {
{ 11 * 8, 1 * 16 },
};
LNAGainField field_lna {
{ 22 * 8, 1 * 16 }
};
VGAGainField field_vga {
{ 26 * 8, 1 * 16 }
};
NumberField field_threshold {
{ 6 * 8, 2 * 16 },
3,
{ 5, 255 },
5,
' '
};
Text text_mean {
{ 22 * 8, 2 * 16, 3 * 8, 16 },
"---"
};
Text text_slices {
{ 8 * 8, 3 * 16, 2 * 8, 16 },
"--"
};
Text text_rate {
{ 24 * 8, 3 * 16, 3 * 8, 16 },
"---"
};
VuMeter vu_max {
{ 1 * 8, 11 * 8 - 4, 3 * 8, 48 },
18,
false
};
ProgressBar progress_timers {
{ 6 * 8, 12 * 8, 6 * 8, 16 }
};
Text text_infos {
{ 13 * 8, 12 * 8, 15 * 8, 16 },
"Listening"
};
Checkbox check_snap {
{ 6 * 8, 15 * 8 },
7,
"Snap to:",
true
};
OptionsField options_snap {
{ 17 * 8, 15 * 8 },
7,
{
{ "25kHz ", 25000 },
{ "12.5kHz", 12500 },
{ "8.33kHz", 8333 }
}
};
BigFrequency big_display {
{ 4, 9 * 16, 28 * 8, 52 },
0
};
MessageHandlerRegistration message_handler_spectrum_config {
Message::ID::ChannelSpectrumConfig,
[this](const Message* const p) {
const auto message = *reinterpret_cast<const ChannelSpectrumConfigMessage*>(p);
this->fifo = message.fifo;
}
};
MessageHandlerRegistration message_handler_frame_sync {
Message::ID::DisplayFrameSync,
[this](const Message* const) {
if( this->fifo ) {
ChannelSpectrum channel_spectrum;
while( fifo->out(channel_spectrum) ) {
this->on_channel_spectrum(channel_spectrum);
}
}
this->do_timers();
}
};
};
} /* namespace ui */

View File

@ -155,23 +155,23 @@ private:
}; };
Text text_description_1 { Text text_description_1 {
{ 24, 6 * 16, 24 * 8, 16 }, { 24, 7 * 16, 24 * 8, 16 },
"CAUTION: Ensure that all" "\x1B" "\x0C" "CAUTION: Ensure that all"
}; };
Text text_description_2 { Text text_description_2 {
{ 28, 7 * 16, 23 * 8, 16 }, { 28, 8 * 16, 23 * 8, 16 },
"devices attached to the" "\x1B" "\x0C" "devices attached to the"
}; };
Text text_description_3 { Text text_description_3 {
{ 8, 8 * 16, 28 * 8, 16 }, { 8, 9 * 16, 28 * 8, 16 },
"antenna connector can accept" "\x1B" "\x0C" "antenna connector can accept"
}; };
Text text_description_4 { Text text_description_4 {
{ 68, 9 * 16, 13 * 8, 16 }, { 68, 10 * 16, 13 * 8, 16 },
"a DC voltage!" "\x1B" "\x0C" "a DC voltage!"
}; };
Checkbox check_bias { Checkbox check_bias {

View File

@ -153,6 +153,28 @@ static constexpr Bitmap bitmap_sd_card_unknown {
{ 16, 16 }, bitmap_sd_card_unknown_data { 16, 16 }, bitmap_sd_card_unknown_data
}; };
static constexpr uint8_t bitmap_icon_lora_data[] = {
0xC0, 0x03,
0x30, 0x0C,
0x00, 0x00,
0xC0, 0x03,
0x00, 0x00,
0xC0, 0x03,
0x60, 0x06,
0x60, 0x06,
0x60, 0x06,
0x60, 0x06,
0xC0, 0x03,
0x00, 0x00,
0xC0, 0x03,
0x00, 0x00,
0x30, 0x0C,
0xC0, 0x03,
};
static constexpr Bitmap bitmap_icon_lora {
{ 16, 16 }, bitmap_icon_lora_data
};
static constexpr uint8_t bitmap_play_data[] = { static constexpr uint8_t bitmap_play_data[] = {
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@ -537,6 +559,28 @@ static constexpr Bitmap bitmap_icon_pocsag {
{ 16, 16 }, bitmap_icon_pocsag_data { 16, 16 }, bitmap_icon_pocsag_data
}; };
static constexpr uint8_t bitmap_icon_tetra_data[] = {
0xE0, 0x0F,
0x18, 0x38,
0xE4, 0x67,
0x7E, 0xCE,
0xC7, 0xCC,
0x00, 0x00,
0xFF, 0x4F,
0xBA, 0xB2,
0x9A, 0xEE,
0xBA, 0xB2,
0x00, 0x00,
0x3B, 0xE3,
0x73, 0x7E,
0xC6, 0x27,
0x1C, 0x18,
0xF0, 0x07,
};
static constexpr Bitmap bitmap_icon_tetra {
{ 16, 16 }, bitmap_icon_tetra_data
};
static constexpr uint8_t bitmap_icon_lcr_data[] = { static constexpr uint8_t bitmap_icon_lcr_data[] = {
0x0C, 0x00, 0x0C, 0x00,
0xFF, 0x7F, 0xFF, 0x7F,
@ -639,6 +683,28 @@ static constexpr Bitmap bitmap_sd_card_ok {
{ 16, 16 }, bitmap_sd_card_ok_data { 16, 16 }, bitmap_sd_card_ok_data
}; };
static constexpr uint8_t bitmap_icon_scanner_data[] = {
0x00, 0x00,
0x80, 0x3F,
0x00, 0x11,
0x00, 0x0A,
0x00, 0x04,
0x00, 0x00,
0x00, 0x00,
0x44, 0x44,
0x44, 0x44,
0x00, 0x04,
0x00, 0x04,
0x00, 0x04,
0x00, 0x0A,
0x00, 0x0A,
0xFF, 0xF1,
0x00, 0x00,
};
static constexpr Bitmap bitmap_icon_scanner {
{ 16, 16 }, bitmap_icon_scanner_data
};
static constexpr uint8_t bitmap_icon_microphone_data[] = { static constexpr uint8_t bitmap_icon_microphone_data[] = {
0xC0, 0x03, 0xC0, 0x03,
0xA0, 0x06, 0xA0, 0x06,
@ -1053,6 +1119,28 @@ static constexpr Bitmap bitmap_rssipwm {
{ 24, 16 }, bitmap_rssipwm_data { 24, 16 }, bitmap_rssipwm_data
}; };
static constexpr uint8_t bitmap_icon_dmr_data[] = {
0x00, 0x00,
0xFE, 0x1F,
0xFE, 0x3F,
0x0E, 0x78,
0x0E, 0x70,
0x0E, 0x70,
0x0E, 0x70,
0x0E, 0x78,
0xFE, 0x3F,
0xFE, 0x1F,
0x8E, 0x07,
0x0E, 0x0F,
0x0E, 0x1E,
0x0E, 0x3C,
0x0E, 0x78,
0x00, 0x00,
};
static constexpr Bitmap bitmap_icon_dmr {
{ 16, 16 }, bitmap_icon_dmr_data
};
static constexpr uint8_t bitmap_target_calibrate_data[] = { static constexpr uint8_t bitmap_target_calibrate_data[] = {
0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40,
0x07, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0xE0,

File diff suppressed because it is too large Load Diff

View File

@ -32,9 +32,11 @@
//BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one //BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one
//BUG: SCANNER Multiple slices //BUG: SCANNER Multiple slices
//TODO: Disable Nuoptix timecode TX, useless (almost)
//TODO: Move Touchtunes remote to Custom remote
//TODO: Use escapes \x1B to set colors in text, it works !
//TODO: Open files in File Manager //TODO: Open files in File Manager
//TODO: Ask for filename after record //TODO: Ask for filename after record
//TODO: Make entries disappear from RecentEntries list in ADS-B RX (after 2 minutes with no update ?)
//TODO: Super simple text file viewer //TODO: Super simple text file viewer
//TODO: Clean up ReplayThread //TODO: Clean up ReplayThread
//TODO: Cap Wav viewer position //TODO: Cap Wav viewer position

View File

@ -47,11 +47,13 @@
#include "ui_mictx.hpp" #include "ui_mictx.hpp"
#include "ui_morse.hpp" #include "ui_morse.hpp"
//#include "ui_numbers.hpp" //#include "ui_numbers.hpp"
#include "ui_nuoptix.hpp" //#include "ui_nuoptix.hpp"
#include "ui_playdead.hpp" #include "ui_playdead.hpp"
#include "ui_pocsag_tx.hpp" #include "ui_pocsag_tx.hpp"
#include "ui_rds.hpp" #include "ui_rds.hpp"
#include "ui_remote.hpp"
#include "ui_scanner.hpp" #include "ui_scanner.hpp"
#include "ui_search.hpp"
#include "ui_sd_wipe.hpp" #include "ui_sd_wipe.hpp"
#include "ui_setup.hpp" #include "ui_setup.hpp"
#include "ui_siggen.hpp" #include "ui_siggen.hpp"
@ -332,12 +334,14 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
{ "AFSK", ui::Color::yellow(),&bitmap_icon_receivers, [&nav](){ nav.push<AFSKRxView>(); } }, { "AFSK", ui::Color::yellow(),&bitmap_icon_receivers, [&nav](){ nav.push<AFSKRxView>(); } },
{ "APRS", ui::Color::grey(), &bitmap_icon_aprs, [&nav](){ nav.push<NotImplementedView>(); } }, { "APRS", ui::Color::grey(), &bitmap_icon_aprs, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Audio", ui::Color::green(), &bitmap_icon_speaker, [&nav](){ nav.push<AnalogAudioView>(false); } }, { "Audio", ui::Color::green(), &bitmap_icon_speaker, [&nav](){ nav.push<AnalogAudioView>(false); } },
{ "DMR framing", ui::Color::grey(), &bitmap_icon_dmr, [&nav](){ nav.push<NotImplementedView>(); } },
{ "ERT: Utility Meters", ui::Color::green(), &bitmap_icon_ert, [&nav](){ nav.push<ERTAppView>(); } }, { "ERT: Utility Meters", ui::Color::green(), &bitmap_icon_ert, [&nav](){ nav.push<ERTAppView>(); } },
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGAppView>(); } }, { "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGAppView>(); } },
{ "SIGFOX", ui::Color::grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView { "SIGFOX", ui::Color::grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
{ "LoRa", ui::Color::grey(), nullptr, [&nav](){ nav.push<NotImplementedView>(); } }, { "LoRa", ui::Color::grey(), &bitmap_icon_lora, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Radiosondes", ui::Color::yellow(),&bitmap_icon_sonde, [&nav](){ nav.push<SondeView>(); } }, { "Radiosondes", ui::Color::yellow(),&bitmap_icon_sonde, [&nav](){ nav.push<SondeView>(); } },
{ "SSTV", ui::Color::grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } }, { "SSTV", ui::Color::grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } },
{ "TETRA framing", ui::Color::grey(), &bitmap_icon_tetra, [&nav](){ nav.push<NotImplementedView>(); } },
{ "TPMS: Cars", ui::Color::green(), &bitmap_icon_tpms, [&nav](){ nav.push<TPMSAppView>(); } }, { "TPMS: Cars", ui::Color::green(), &bitmap_icon_tpms, [&nav](){ nav.push<TPMSAppView>(); } },
}); });
on_left = [&nav](){ nav.pop(); }; on_left = [&nav](){ nav.pop(); };
@ -352,13 +356,14 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
{ "ADS-B Mode S", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } }, { "ADS-B Mode S", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } },
{ "APRS", ui::Color::orange(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } }, { "APRS", ui::Color::orange(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } },
{ "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } }, { "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } },
{ "Custom remote", ui::Color::grey(), &bitmap_icon_remote, [&nav](){ nav.push<RemoteView>(); } },
{ "Jammer", ui::Color::yellow(), &bitmap_icon_jammer, [&nav](){ nav.push<JammerView>(); } }, { "Jammer", ui::Color::yellow(), &bitmap_icon_jammer, [&nav](){ nav.push<JammerView>(); } },
{ "Key fob", ui::Color::orange(), &bitmap_icon_keyfob, [&nav](){ nav.push<KeyfobView>(); } }, { "Key fob", ui::Color::orange(), &bitmap_icon_keyfob, [&nav](){ nav.push<KeyfobView>(); } },
{ "Microphone", ui::Color::green(), &bitmap_icon_microphone, [&nav](){ nav.push<MicTXView>(); } }, { "Microphone", ui::Color::green(), &bitmap_icon_microphone, [&nav](){ nav.push<MicTXView>(); } },
{ "Morse code", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } }, { "Morse code", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } },
{ "NTTWorks burger pager", ui::Color::yellow(), &bitmap_icon_burger, [&nav](){ nav.push<CoasterPagerView>(); } }, { "NTTWorks burger pager", ui::Color::yellow(), &bitmap_icon_burger, [&nav](){ nav.push<CoasterPagerView>(); } },
{ "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } }, //{ "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } },
{ "Generic OOK remotes", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } }, { "OOK encoders", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } },
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } }, { "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } },
{ "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push<RDSView>(); } }, { "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push<RDSView>(); } },
{ "Soundboard", ui::Color::green(), &bitmap_icon_soundboard, [&nav](){ nav.push<SoundBoardView>(); } }, { "Soundboard", ui::Color::green(), &bitmap_icon_soundboard, [&nav](){ nav.push<SoundBoardView>(); } },
@ -404,7 +409,8 @@ SystemMenuView::SystemMenuView(NavigationView& nav) {
{ "Transmitters", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } }, { "Transmitters", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } }, { "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } }, { "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
{ "Scanner/search", ui::Color::orange(), &bitmap_icon_closecall, [&nav](){ nav.push<ScannerView>(); } }, { "Search/Close call", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } },
{ "Scanner", ui::Color::grey(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } },
{ "Wave file viewer", ui::Color::blue(), nullptr, [&nav](){ nav.push<ViewWavView>(); } }, { "Wave file viewer", ui::Color::blue(), nullptr, [&nav](){ nav.push<ViewWavView>(); } },
{ "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } }, { "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
{ "Setup", ui::Color::white(), &bitmap_icon_setup, [&nav](){ nav.push<SetupMenuView>(); } }, { "Setup", ui::Color::white(), &bitmap_icon_setup, [&nav](){ nav.push<SetupMenuView>(); } },

BIN
firmware/graphics/aprs.bmp Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

BIN
firmware/graphics/splash.bmp Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -0,0 +1,41 @@
f=433920000
mod=ook
rate=1786
repeat=4
pause=100
pre=11111111111111110000000001011101PPPPPPPP
post=1
0=10
1=1000
B:Pause,96,0,1011001101001100
B:On/Off,168,0,0111100010000111
B:P1,112,40,1111000100001110
B:P2,144,40,0110000010011111
B:P3,176,40,1100101000110101
B:F1,112,80,0010000011011111
B:^,148,80,1111001000001101
B:F2,176,80,1010000001011111
B:<,112,112,1000010001111011
B:OK,144,112,1101110100100010
B:>,184,112,1100010000111011
B:F3,112,144,0011000011001111
B:V,148,144,1000000001111111
B:F4,176,144,1011000001001111
B:1,0,40,1111000000001111
B:2,32,40,0000100011110111
B:3,64,40,1000100001110111
B:4,0,80,0100100010110111
B:5,32,80,1100100000110111
B:6,64,80,0010100011010111
B:7,0,120,1010100001010111
B:8,32,120,0110100010010111
B:9,64,120,1110100000010111
B:*,0,160,0001100011100111
B:0,32,160,1001100001100111
B:#,64,160,0101100010100111
B:Zone1+,104,184,1111010000001011
B:Zone2+,144,184,1111011000001001
B:Zone3+,184,184,1111110000000011
B:Zone1-,104,232,0101000010101111
B:Zone2-,144,232,0001000011101111
B:Zone3-,184,232,0100000010111111