mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Unclever first attempt at display sleep.
This commit is contained in:
parent
1caf6952d8
commit
894d4b955c
@ -98,21 +98,23 @@ void EventDispatcher::dispatch(const eventmask_t events) {
|
||||
if( events & EVT_MASK_RTC_TICK ) {
|
||||
handle_rtc_tick();
|
||||
}
|
||||
|
||||
if( !display_sleep ) {
|
||||
if( events & EVT_MASK_LCD_FRAME_SYNC ) {
|
||||
handle_lcd_frame_sync();
|
||||
}
|
||||
|
||||
if( events & EVT_MASK_LCD_FRAME_SYNC ) {
|
||||
handle_lcd_frame_sync();
|
||||
}
|
||||
if( events & EVT_MASK_SWITCHES ) {
|
||||
handle_switches();
|
||||
}
|
||||
|
||||
if( events & EVT_MASK_SWITCHES ) {
|
||||
handle_switches();
|
||||
}
|
||||
if( events & EVT_MASK_ENCODER ) {
|
||||
handle_encoder();
|
||||
}
|
||||
|
||||
if( events & EVT_MASK_ENCODER ) {
|
||||
handle_encoder();
|
||||
}
|
||||
|
||||
if( events & EVT_MASK_TOUCH ) {
|
||||
handle_touch();
|
||||
if( events & EVT_MASK_TOUCH ) {
|
||||
handle_touch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "ui_widget.hpp"
|
||||
#include "ui_painter.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
|
||||
#include "touch.hpp"
|
||||
@ -53,6 +55,11 @@ public:
|
||||
void run();
|
||||
void request_stop();
|
||||
|
||||
void set_display_sleep(bool new_value) {
|
||||
portapack::io.lcd_backlight(false);
|
||||
display_sleep = new_value;
|
||||
};
|
||||
|
||||
static inline void events_flag(const eventmask_t events) {
|
||||
if( thread_event_loop ) {
|
||||
chEvtSignal(thread_event_loop, events);
|
||||
@ -80,6 +87,7 @@ private:
|
||||
uint32_t encoder_last = 0;
|
||||
bool is_running = true;
|
||||
bool sd_card_present = false;
|
||||
bool display_sleep = false;
|
||||
|
||||
eventmask_t wait();
|
||||
void dispatch(const eventmask_t events);
|
||||
|
@ -81,6 +81,11 @@ int main(void) {
|
||||
event_dispatcher.request_stop();
|
||||
}
|
||||
);
|
||||
EventDispatcher::message_map().register_handler(Message::ID::DisplaySleep,
|
||||
[&event_dispatcher](const Message* const) {
|
||||
event_dispatcher.set_display_sleep(true);
|
||||
}
|
||||
);
|
||||
|
||||
m4_init(portapack::spi_flash::baseband, portapack::memory::map::m4_code);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ui_navigation.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
#include "event_m0.hpp"
|
||||
#include "receiver_model.hpp"
|
||||
|
||||
#include "ui_setup.hpp"
|
||||
@ -42,6 +43,7 @@ SystemStatusView::SystemStatusView() {
|
||||
add_children({ {
|
||||
&button_back,
|
||||
&title,
|
||||
&button_sleep,
|
||||
&sd_card_status_view,
|
||||
} });
|
||||
sd_card_status_view.set_parent_rect({ 28 * 8, 0 * 16, 2 * 8, 1 * 16 });
|
||||
@ -51,6 +53,11 @@ SystemStatusView::SystemStatusView() {
|
||||
this->on_back();
|
||||
}
|
||||
};
|
||||
|
||||
button_sleep.on_select = [this](Button&) {
|
||||
DisplaySleepMessage message;
|
||||
EventDispatcher::message_map().send(&message);
|
||||
};
|
||||
}
|
||||
|
||||
void SystemStatusView::set_back_visible(bool new_value) {
|
||||
|
@ -59,6 +59,11 @@ private:
|
||||
default_title,
|
||||
};
|
||||
|
||||
Button button_sleep {
|
||||
{ 25 * 8, 0, 2 * 8, 1 * 16 },
|
||||
"ZZ",
|
||||
};
|
||||
|
||||
SDCardStatusView sd_card_status_view;
|
||||
};
|
||||
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
AMConfigure = 13,
|
||||
ChannelSpectrumConfig = 14,
|
||||
SpectrumStreamingConfig = 15,
|
||||
DisplaySleep = 16,
|
||||
MAX
|
||||
};
|
||||
|
||||
@ -165,6 +166,14 @@ struct AudioStatistics {
|
||||
}
|
||||
};
|
||||
|
||||
class DisplaySleepMessage : public Message {
|
||||
public:
|
||||
constexpr DisplaySleepMessage(
|
||||
) : Message { ID::DisplaySleep }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class AudioStatisticsMessage : public Message {
|
||||
public:
|
||||
constexpr AudioStatisticsMessage(
|
||||
|
Loading…
Reference in New Issue
Block a user