mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-11-24 05:43:11 -05:00
Log function for search app (#2782)
This commit is contained in:
parent
b15bb59678
commit
325f295ee8
2 changed files with 39 additions and 1 deletions
|
|
@ -31,6 +31,10 @@ using namespace portapack;
|
|||
|
||||
namespace ui {
|
||||
|
||||
void SearchLogger::log_data(SearchRecentEntry& data) {
|
||||
log_file.write_entry(";" + to_string_short_freq(data.frequency) + ";" + std::to_string(data.duration));
|
||||
}
|
||||
|
||||
template <>
|
||||
void RecentEntriesTable<SearchRecentEntries>::draw(
|
||||
const Entry& entry,
|
||||
|
|
@ -75,6 +79,7 @@ SearchView::SearchView(
|
|||
&check_snap,
|
||||
&options_snap,
|
||||
&big_display,
|
||||
&check_log,
|
||||
&recent_entries_view});
|
||||
|
||||
baseband::set_spectrum(SEARCH_SLICE_WIDTH, 31);
|
||||
|
|
@ -100,6 +105,14 @@ SearchView::SearchView(
|
|||
on_range_changed();
|
||||
});
|
||||
|
||||
check_log.on_select = [this](Checkbox&, bool v) {
|
||||
logging = v;
|
||||
if (logging) {
|
||||
logger.append(logs_dir.string() + "/SEARCH_" + to_string_timestamp(rtc_time::now()) + ".CSV");
|
||||
logger.write_header();
|
||||
}
|
||||
};
|
||||
|
||||
bind(field_threshold, settings_.power_threshold);
|
||||
bind(check_snap, settings_.snap_search);
|
||||
bind(options_snap, settings_.snap_step);
|
||||
|
|
@ -192,7 +205,6 @@ void SearchView::do_detection() {
|
|||
|
||||
locked = true;
|
||||
locked_bin = bin_max;
|
||||
|
||||
// TODO: open Audio.
|
||||
} else
|
||||
text_infos.set("Out of range");
|
||||
|
|
@ -210,6 +222,7 @@ void SearchView::do_detection() {
|
|||
|
||||
auto& entry = ::on_packet(recent, resolved_frequency);
|
||||
entry.set_duration(duration);
|
||||
if (logging) logger.log_data(entry);
|
||||
recent_entries_view.set_dirty();
|
||||
|
||||
text_infos.set("Listening");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue