mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-11-25 14:16:20 -05:00
fix some bugs due to framesync not fired on stealth mode (#2834)
This commit is contained in:
parent
dafe3b7641
commit
200831ad67
4 changed files with 28 additions and 27 deletions
|
|
@ -124,12 +124,12 @@ void EventDispatcher::request_stop() {
|
|||
|
||||
void EventDispatcher::set_display_sleep(const bool sleep) {
|
||||
// TODO: Distribute display sleep message more broadly, shut down data generation
|
||||
// on baseband side, since all that data is being discarded during sleep.
|
||||
// on baseband side, since all that data is being discarded during sleep. -- DON'T TODO it, sincethe stealth mode want to send with screen off!
|
||||
if (sleep) {
|
||||
portapack::backlight()->off();
|
||||
portapack::display.sleep();
|
||||
portapack::display.sleep(false); // when called the hw_sleep = true, the irq wont fire, so the EVT_MASK_LCD_FRAME_SYNC won't set.
|
||||
} else {
|
||||
portapack::display.wake();
|
||||
portapack::display.wake(true); // not important, command not affect if already hw waken up
|
||||
// Don't turn on backlight here.
|
||||
// Let frame sync handler turn on backlight after repaint.
|
||||
}
|
||||
|
|
@ -180,12 +180,10 @@ void EventDispatcher::dispatch(const eventmask_t events) {
|
|||
/*if( events & EVT_MASK_LCD_FRAME_SYNC ) {
|
||||
blink_timer();
|
||||
}*/
|
||||
|
||||
if (events & EVT_MASK_LCD_FRAME_SYNC) {
|
||||
handle_lcd_frame_sync(!EventDispatcher::display_sleep);
|
||||
}
|
||||
if (!EventDispatcher::display_sleep) {
|
||||
if (events & EVT_MASK_LCD_FRAME_SYNC) {
|
||||
handle_lcd_frame_sync();
|
||||
}
|
||||
|
||||
if (events & EVT_MASK_ENCODER) {
|
||||
handle_encoder();
|
||||
}
|
||||
|
|
@ -328,17 +326,16 @@ ui::Widget* EventDispatcher::getFocusedWidget() {
|
|||
return context.focus_manager().focus_widget();
|
||||
}
|
||||
|
||||
void EventDispatcher::handle_lcd_frame_sync() {
|
||||
void EventDispatcher::handle_lcd_frame_sync(bool screen_on) {
|
||||
bool waiting_for_frame = this->waiting_for_frame;
|
||||
|
||||
DisplayFrameSyncMessage message;
|
||||
DisplayFrameSyncMessage message; // send framesync msg all the time, bc some apps relay on it
|
||||
message_map.send(&message);
|
||||
|
||||
static_cast<ui::SystemView*>(top_widget)->paint_overlay();
|
||||
painter.paint_widget_tree(top_widget);
|
||||
|
||||
portapack::backlight()->on();
|
||||
|
||||
if (screen_on) { // only draw when screen is on
|
||||
static_cast<ui::SystemView*>(top_widget)->paint_overlay();
|
||||
painter.paint_widget_tree(top_widget);
|
||||
portapack::backlight()->on();
|
||||
}
|
||||
if (waiting_for_frame)
|
||||
this->waiting_for_frame = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class EventDispatcher {
|
|||
void on_keyboard_event(ui::KeyboardEvent event);
|
||||
|
||||
// void blink_timer();
|
||||
void handle_lcd_frame_sync();
|
||||
void handle_lcd_frame_sync(bool screen_on);
|
||||
void handle_switches();
|
||||
void handle_encoder();
|
||||
void handle_touch();
|
||||
|
|
|
|||
|
|
@ -77,13 +77,17 @@ void lcd_display_off() {
|
|||
io.lcd_data_write_command_and_data(0x28, {});
|
||||
}
|
||||
|
||||
void lcd_sleep() {
|
||||
void lcd_sleep(bool hw_sleep = true) {
|
||||
lcd_display_off();
|
||||
lcd_sleep_in();
|
||||
if (hw_sleep) {
|
||||
lcd_sleep_in();
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_wake() {
|
||||
lcd_sleep_out();
|
||||
void lcd_wake(bool hw_sleep = true) {
|
||||
if (hw_sleep) {
|
||||
lcd_sleep_out();
|
||||
}
|
||||
lcd_display_on();
|
||||
}
|
||||
|
||||
|
|
@ -394,12 +398,12 @@ void ILI9341::shutdown() {
|
|||
lcd_reset();
|
||||
}
|
||||
|
||||
void ILI9341::sleep() {
|
||||
lcd_sleep();
|
||||
void ILI9341::sleep(bool hw_sleep) {
|
||||
lcd_sleep(hw_sleep);
|
||||
}
|
||||
|
||||
void ILI9341::wake() {
|
||||
lcd_wake();
|
||||
void ILI9341::wake(bool hw_sleep) {
|
||||
lcd_wake(hw_sleep);
|
||||
}
|
||||
|
||||
void ILI9341::fill_rectangle(ui::Rect r, const ui::Color c) {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ class ILI9341 {
|
|||
void init();
|
||||
void shutdown();
|
||||
|
||||
void sleep();
|
||||
void wake();
|
||||
void sleep(bool hw_sleep = true);
|
||||
void wake(bool hw_sleep = true);
|
||||
|
||||
void fill_rectangle(ui::Rect r, const ui::Color c);
|
||||
void fill_rectangle_unrolled8(ui::Rect r, const ui::Color c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue