mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
MsgDblReg fix (#2144)
This commit is contained in:
parent
963c6e5238
commit
e666eb1797
@ -31,6 +31,7 @@ using namespace portapack;
|
||||
|
||||
namespace ui {
|
||||
|
||||
bool BattinfoView::needRun = true;
|
||||
void BattinfoView::focus() {
|
||||
button_exit.focus();
|
||||
}
|
||||
@ -99,6 +100,25 @@ BattinfoView::BattinfoView(NavigationView& nav)
|
||||
};
|
||||
|
||||
update_result();
|
||||
needRun = true;
|
||||
thread = chThdCreateFromHeap(NULL, 512, NORMALPRIO + 10, BattinfoView::static_fn, this);
|
||||
}
|
||||
|
||||
msg_t BattinfoView::static_fn(void* arg) {
|
||||
auto obj = static_cast<BattinfoView*>(arg);
|
||||
while (needRun) {
|
||||
chThdSleepMilliseconds(16);
|
||||
obj->on_timer();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
BattinfoView::~BattinfoView() {
|
||||
needRun = false;
|
||||
if (thread) {
|
||||
chThdTerminate(thread);
|
||||
chThdWait(thread);
|
||||
thread = nullptr;
|
||||
}
|
||||
}
|
||||
} // namespace ui
|
||||
|
@ -31,7 +31,13 @@
|
||||
namespace ui {
|
||||
class BattinfoView : public View {
|
||||
public:
|
||||
~BattinfoView();
|
||||
BattinfoView(NavigationView& nav);
|
||||
BattinfoView(const BattinfoView&) = delete;
|
||||
BattinfoView(BattinfoView&&) = delete;
|
||||
BattinfoView& operator=(const BattinfoView&) = delete;
|
||||
BattinfoView& operator=(BattinfoView&&) = delete;
|
||||
|
||||
void focus() override;
|
||||
std::string title() const override { return "Battery"; };
|
||||
|
||||
@ -70,12 +76,9 @@ class BattinfoView : public View {
|
||||
Button button_exit{
|
||||
{72, 17 * 16, 96, 32},
|
||||
"Back"};
|
||||
|
||||
MessageHandlerRegistration message_handler_frame_sync{
|
||||
Message::ID::DisplayFrameSync,
|
||||
[this](const Message* const) {
|
||||
this->on_timer();
|
||||
}};
|
||||
static msg_t static_fn(void* arg);
|
||||
static bool needRun;
|
||||
Thread* thread{nullptr};
|
||||
};
|
||||
|
||||
} /* namespace ui */
|
||||
|
Loading…
Reference in New Issue
Block a user