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 {
|
namespace ui {
|
||||||
|
|
||||||
|
bool BattinfoView::needRun = true;
|
||||||
void BattinfoView::focus() {
|
void BattinfoView::focus() {
|
||||||
button_exit.focus();
|
button_exit.focus();
|
||||||
}
|
}
|
||||||
@ -99,6 +100,25 @@ BattinfoView::BattinfoView(NavigationView& nav)
|
|||||||
};
|
};
|
||||||
|
|
||||||
update_result();
|
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
|
} // namespace ui
|
||||||
|
@ -31,7 +31,13 @@
|
|||||||
namespace ui {
|
namespace ui {
|
||||||
class BattinfoView : public View {
|
class BattinfoView : public View {
|
||||||
public:
|
public:
|
||||||
|
~BattinfoView();
|
||||||
BattinfoView(NavigationView& nav);
|
BattinfoView(NavigationView& nav);
|
||||||
|
BattinfoView(const BattinfoView&) = delete;
|
||||||
|
BattinfoView(BattinfoView&&) = delete;
|
||||||
|
BattinfoView& operator=(const BattinfoView&) = delete;
|
||||||
|
BattinfoView& operator=(BattinfoView&&) = delete;
|
||||||
|
|
||||||
void focus() override;
|
void focus() override;
|
||||||
std::string title() const override { return "Battery"; };
|
std::string title() const override { return "Battery"; };
|
||||||
|
|
||||||
@ -70,12 +76,9 @@ class BattinfoView : public View {
|
|||||||
Button button_exit{
|
Button button_exit{
|
||||||
{72, 17 * 16, 96, 32},
|
{72, 17 * 16, 96, 32},
|
||||||
"Back"};
|
"Back"};
|
||||||
|
static msg_t static_fn(void* arg);
|
||||||
MessageHandlerRegistration message_handler_frame_sync{
|
static bool needRun;
|
||||||
Message::ID::DisplayFrameSync,
|
Thread* thread{nullptr};
|
||||||
[this](const Message* const) {
|
|
||||||
this->on_timer();
|
|
||||||
}};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
Loading…
Reference in New Issue
Block a user