Various improvements (#264)
- Replace C function pointers with C++ `std::function` in `Thread`, `Timer` and `DispatcherThread` - Rename `SystemEvent`-related functions - WiFi: fix auto-connect when WiFi disconnects from bad signal - WiFi: fix auto-connect when WiFi fails to auto-connect - WiFi: implement disconnect() when tapping connected WiFi ap in WiFi management app
This commit is contained in:
committed by
GitHub
parent
d72852a6e2
commit
3f1bfee3f5
@@ -72,15 +72,10 @@ static void onModeSetCallback(TT_UNUSED lv_event_t* event) {
|
||||
}
|
||||
}
|
||||
|
||||
static void onTimerCallback(TT_UNUSED std::shared_ptr<void> context) {
|
||||
auto app = optApp();
|
||||
if (app != nullptr) {
|
||||
app->onTimerTick();
|
||||
}
|
||||
}
|
||||
|
||||
ScreenshotApp::ScreenshotApp() {
|
||||
updateTimer = std::make_unique<Timer>(Timer::Type::Periodic, onTimerCallback, nullptr);
|
||||
updateTimer = std::make_unique<Timer>(Timer::Type::Periodic, [this]() {
|
||||
onTimerTick();
|
||||
});
|
||||
}
|
||||
|
||||
ScreenshotApp::~ScreenshotApp() {
|
||||
@@ -90,8 +85,8 @@ ScreenshotApp::~ScreenshotApp() {
|
||||
}
|
||||
|
||||
void ScreenshotApp::onTimerTick() {
|
||||
auto lvgl_lock = lvgl::getSyncLock()->scoped();
|
||||
if (lvgl_lock->lock(50 / portTICK_PERIOD_MS)) {
|
||||
auto lock = lvgl::getSyncLock()->asScopedLock();
|
||||
if (lock.lock(lvgl::defaultLockTime)) {
|
||||
updateScreenshotMode();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user