mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-11 07:19:34 -05:00
Added USB serial checkbox (#1664)
This commit is contained in:
parent
337e3f4449
commit
d0bd8e50be
@ -426,6 +426,7 @@ BLERxView::BLERxView(NavigationView& nav)
|
|||||||
&options_sort,
|
&options_sort,
|
||||||
&label_found,
|
&label_found,
|
||||||
&text_found_count,
|
&text_found_count,
|
||||||
|
&check_serial_log,
|
||||||
&button_filter,
|
&button_filter,
|
||||||
&button_save_list,
|
&button_save_list,
|
||||||
&button_clear_list,
|
&button_clear_list,
|
||||||
@ -436,7 +437,15 @@ BLERxView::BLERxView(NavigationView& nav)
|
|||||||
nav_.push<BleRecentEntryDetailView>(entry);
|
nav_.push<BleRecentEntryDetailView>(entry);
|
||||||
};
|
};
|
||||||
|
|
||||||
usb_serial_thread = std::make_unique<UsbSerialThread>();
|
check_serial_log.on_select = [this](Checkbox&, bool v) {
|
||||||
|
serial_logging = v;
|
||||||
|
if (v) {
|
||||||
|
usb_serial_thread = std::make_unique<UsbSerialThread>();
|
||||||
|
} else {
|
||||||
|
usb_serial_thread.reset();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
check_serial_log.set_value(serial_logging);
|
||||||
|
|
||||||
ensure_directory(find_packet_path);
|
ensure_directory(find_packet_path);
|
||||||
ensure_directory(log_packets_path);
|
ensure_directory(log_packets_path);
|
||||||
@ -456,8 +465,6 @@ BLERxView::BLERxView(NavigationView& nav)
|
|||||||
|
|
||||||
logger = std::make_unique<BLELogger>();
|
logger = std::make_unique<BLELogger>();
|
||||||
|
|
||||||
check_log.set_value(logging);
|
|
||||||
|
|
||||||
check_log.on_select = [this](Checkbox&, bool v) {
|
check_log.on_select = [this](Checkbox&, bool v) {
|
||||||
str_log = "";
|
str_log = "";
|
||||||
logging = v;
|
logging = v;
|
||||||
@ -468,6 +475,7 @@ BLERxView::BLERxView(NavigationView& nav)
|
|||||||
"/BLELOG_" +
|
"/BLELOG_" +
|
||||||
to_string_timestamp(rtc_time::now()) + ".TXT");
|
to_string_timestamp(rtc_time::now()) + ".TXT");
|
||||||
};
|
};
|
||||||
|
check_log.set_value(logging);
|
||||||
|
|
||||||
button_save_list.on_select = [this, &nav](const ui::Button&) {
|
button_save_list.on_select = [this, &nav](const ui::Button&) {
|
||||||
listFileBuffer = "";
|
listFileBuffer = "";
|
||||||
@ -723,8 +731,10 @@ void BLERxView::on_data(BlePacketData* packet) {
|
|||||||
logger->log_raw_data(str_console + "\r\n");
|
logger->log_raw_data(str_console + "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
usb_serial_thread->serial_str = str_console + "\r\n";
|
if (serial_logging) {
|
||||||
usb_serial_thread->str_ready = true;
|
usb_serial_thread->serial_str = str_console + "\r\n";
|
||||||
|
usb_serial_thread->str_ready = true;
|
||||||
|
}
|
||||||
str_console = "";
|
str_console = "";
|
||||||
|
|
||||||
if (!searchList.empty()) {
|
if (!searchList.empty()) {
|
||||||
|
@ -215,6 +215,7 @@ class BLERxView : public View {
|
|||||||
uint8_t sort_index{0};
|
uint8_t sort_index{0};
|
||||||
std::string filter{};
|
std::string filter{};
|
||||||
bool logging{false};
|
bool logging{false};
|
||||||
|
bool serial_logging{false};
|
||||||
|
|
||||||
bool name_enable{true};
|
bool name_enable{true};
|
||||||
app_settings::SettingsManager settings_{
|
app_settings::SettingsManager settings_{
|
||||||
@ -225,6 +226,8 @@ class BLERxView : public View {
|
|||||||
{"sort_index"sv, &sort_index},
|
{"sort_index"sv, &sort_index},
|
||||||
{"filter"sv, &filter},
|
{"filter"sv, &filter},
|
||||||
{"log"sv, &logging},
|
{"log"sv, &logging},
|
||||||
|
// disabled to always start without USB serial activated until we can make it non blocking if not connected
|
||||||
|
// {"serial_log"sv, &serial_logging},
|
||||||
{"name"sv, &name_enable},
|
{"name"sv, &name_enable},
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@ -320,6 +323,12 @@ class BLERxView : public View {
|
|||||||
{11 * 8, 3 * 16, 20 * 8, 16},
|
{11 * 8, 3 * 16, 20 * 8, 16},
|
||||||
"0/0"};
|
"0/0"};
|
||||||
|
|
||||||
|
Checkbox check_serial_log{
|
||||||
|
{17 * 8, 3 * 16 - 2},
|
||||||
|
7,
|
||||||
|
"USB Log",
|
||||||
|
true};
|
||||||
|
|
||||||
Console console{
|
Console console{
|
||||||
{0, 4 * 16, 240, 240}};
|
{0, 4 * 16, 240, 240}};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user