-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed clicks being handled when exiting sleep (#67)
fixes #66
- Loading branch information
Showing
7 changed files
with
84 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "Screen_Sleep.h" | ||
#include <M5Unified.h> | ||
|
||
|
||
void Screen_Sleep::load(lv_event_t *event) | ||
{ | ||
M5.Lcd.setBrightness(0); | ||
}; | ||
void Screen_Sleep::unload(lv_event_t *event) | ||
{ | ||
M5.Lcd.setBrightness(255); | ||
}; | ||
void Screen_Sleep::create() { | ||
lv_timer_create(monitorSleep, 100, this); | ||
}; | ||
void Screen_Sleep::monitorSleep(lv_timer_t *timer) { | ||
Screen_Sleep *screen = (Screen_Sleep*)timer->user_data; | ||
if (screen->isActive()) | ||
{ | ||
if (lv_display_get_inactive_time(NULL) < 1000) | ||
{ | ||
screen->makeLastActive(); | ||
} | ||
} | ||
else | ||
{ | ||
if (lv_display_get_inactive_time(NULL) > 10 * 1000) | ||
{ | ||
screen->makeActive(); | ||
} | ||
} | ||
}; | ||
Screen_Sleep screen_sleep; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#ifndef SCREEN_SLEEP | ||
#define SCREEN_SLEEP | ||
#include <lvgl.h> | ||
#include "Screen.h" | ||
class Screen_Sleep : public Screen | ||
{ | ||
void create(); | ||
void load(lv_event_t *event); | ||
void unload(lv_event_t *event); | ||
static void monitorSleep(lv_timer_t *timer); | ||
}; | ||
extern Screen_Sleep screen_sleep; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters