mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-07 22:22:21 -04:00
refactor the serial log logic of BLE Rx (#2660)
This commit is contained in:
parent
43a1bc0445
commit
6f6d863a14
2 changed files with 8 additions and 4 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include "portapack_persistent_memory.hpp"
|
#include "portapack_persistent_memory.hpp"
|
||||||
#include "ui_fileman.hpp"
|
#include "ui_fileman.hpp"
|
||||||
#include "ui_textentry.hpp"
|
#include "ui_textentry.hpp"
|
||||||
|
#include "usb_serial_asyncmsg.hpp"
|
||||||
|
|
||||||
using namespace portapack;
|
using namespace portapack;
|
||||||
using namespace modems;
|
using namespace modems;
|
||||||
|
@ -446,6 +447,8 @@ BLERxView::BLERxView(NavigationView& nav)
|
||||||
&button_switch,
|
&button_switch,
|
||||||
&recent_entries_view});
|
&recent_entries_view});
|
||||||
|
|
||||||
|
async_tx_states_when_entered = portapack::async_tx_enabled;
|
||||||
|
|
||||||
recent_entries_view.on_select = [this](const BleRecentEntry& entry) {
|
recent_entries_view.on_select = [this](const BleRecentEntry& entry) {
|
||||||
nav_.push<BleRecentEntryDetailView>(entry);
|
nav_.push<BleRecentEntryDetailView>(entry);
|
||||||
};
|
};
|
||||||
|
@ -453,9 +456,9 @@ BLERxView::BLERxView(NavigationView& nav)
|
||||||
check_serial_log.on_select = [this](Checkbox&, bool v) {
|
check_serial_log.on_select = [this](Checkbox&, bool v) {
|
||||||
serial_logging = v;
|
serial_logging = v;
|
||||||
if (v) {
|
if (v) {
|
||||||
usb_serial_thread = std::make_unique<UsbSerialThread>();
|
portapack::async_tx_enabled = true;
|
||||||
} else {
|
} else {
|
||||||
usb_serial_thread.reset();
|
portapack::async_tx_enabled = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
check_serial_log.set_value(serial_logging);
|
check_serial_log.set_value(serial_logging);
|
||||||
|
@ -755,8 +758,7 @@ void BLERxView::on_data(BlePacketData* packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (serial_logging) {
|
if (serial_logging) {
|
||||||
usb_serial_thread->serial_str = str_console + "\r\n";
|
UsbSerialAsyncmsg::asyncmsg(str_console); // new line handled there, no need here.
|
||||||
usb_serial_thread->str_ready = true;
|
|
||||||
}
|
}
|
||||||
str_console = "";
|
str_console = "";
|
||||||
|
|
||||||
|
@ -916,6 +918,7 @@ void BLERxView::set_parent_rect(const Rect new_parent_rect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BLERxView::~BLERxView() {
|
BLERxView::~BLERxView() {
|
||||||
|
portapack::async_tx_enabled = async_tx_states_when_entered;
|
||||||
receiver_model.disable();
|
receiver_model.disable();
|
||||||
baseband::shutdown();
|
baseband::shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,6 +219,7 @@ class BLERxView : public View {
|
||||||
std::string filter{};
|
std::string filter{};
|
||||||
bool logging{false};
|
bool logging{false};
|
||||||
bool serial_logging{false};
|
bool serial_logging{false};
|
||||||
|
bool async_tx_states_when_entered{false};
|
||||||
|
|
||||||
bool name_enable{true};
|
bool name_enable{true};
|
||||||
app_settings::SettingsManager settings_{
|
app_settings::SettingsManager settings_{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue