mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-22 20:51:26 -05:00
Disable Back button during Touch Calibration (#2115)
This commit is contained in:
parent
e7359563c6
commit
282e4da1cb
@ -26,6 +26,8 @@
|
|||||||
#include "portapack_persistent_memory.hpp"
|
#include "portapack_persistent_memory.hpp"
|
||||||
using namespace portapack;
|
using namespace portapack;
|
||||||
|
|
||||||
|
extern ui::SystemView* system_view_ptr;
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
TouchCalibrationView::TouchCalibrationView(
|
TouchCalibrationView::TouchCalibrationView(
|
||||||
@ -40,6 +42,7 @@ TouchCalibrationView::TouchCalibrationView(
|
|||||||
&image_verify_1,
|
&image_verify_1,
|
||||||
&image_verify_2,
|
&image_verify_2,
|
||||||
&label_calibrate,
|
&label_calibrate,
|
||||||
|
&label_calibrate_2,
|
||||||
&label_verify,
|
&label_verify,
|
||||||
&label_success,
|
&label_success,
|
||||||
&label_failure,
|
&label_failure,
|
||||||
@ -51,6 +54,12 @@ TouchCalibrationView::TouchCalibrationView(
|
|||||||
button_ok.on_select = [this](Button&) { this->on_ok(); };
|
button_ok.on_select = [this](Button&) { this->on_ok(); };
|
||||||
|
|
||||||
set_phase(Phase::Calibrate0);
|
set_phase(Phase::Calibrate0);
|
||||||
|
|
||||||
|
system_view_ptr->get_status_view()->set_back_hidden(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
TouchCalibrationView::~TouchCalibrationView() {
|
||||||
|
system_view_ptr->get_status_view()->set_back_hidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchCalibrationView::focus() {
|
void TouchCalibrationView::focus() {
|
||||||
@ -70,6 +79,7 @@ void TouchCalibrationView::update_target() {
|
|||||||
image_verify_2.hidden(phase != Phase::Verify2);
|
image_verify_2.hidden(phase != Phase::Verify2);
|
||||||
|
|
||||||
label_calibrate.hidden(!phase_calibrate);
|
label_calibrate.hidden(!phase_calibrate);
|
||||||
|
label_calibrate_2.hidden(!phase_calibrate && !phase_verify);
|
||||||
label_verify.hidden(!phase_verify);
|
label_verify.hidden(!phase_verify);
|
||||||
label_success.hidden(phase != Phase::Success);
|
label_success.hidden(phase != Phase::Success);
|
||||||
label_failure.hidden(phase != Phase::Failure);
|
label_failure.hidden(phase != Phase::Failure);
|
||||||
|
@ -31,6 +31,7 @@ namespace ui {
|
|||||||
class TouchCalibrationView : public View {
|
class TouchCalibrationView : public View {
|
||||||
public:
|
public:
|
||||||
TouchCalibrationView(NavigationView& nav);
|
TouchCalibrationView(NavigationView& nav);
|
||||||
|
~TouchCalibrationView();
|
||||||
|
|
||||||
void focus() override;
|
void focus() override;
|
||||||
|
|
||||||
@ -110,9 +111,13 @@ class TouchCalibrationView : public View {
|
|||||||
Color::black()};
|
Color::black()};
|
||||||
|
|
||||||
Text label_calibrate{
|
Text label_calibrate{
|
||||||
{16, 5 * 16, 26 * 8, 1 * 16},
|
{2 * 8, 5 * 16, 26 * 8, 1 * 16},
|
||||||
"Touch targets to calibrate"};
|
"Touch targets to calibrate"};
|
||||||
|
|
||||||
|
Text label_calibrate_2{
|
||||||
|
{1 * 8, 6 * 16, 28 * 8, 1 * 16},
|
||||||
|
"(hold position using stylus)"};
|
||||||
|
|
||||||
Text label_verify{
|
Text label_verify{
|
||||||
{28, 5 * 16, 23 * 8, 1 * 16},
|
{28, 5 * 16, 23 * 8, 1 * 16},
|
||||||
"Touch targets to verify"};
|
"Touch targets to verify"};
|
||||||
|
@ -144,6 +144,7 @@ Continuous (Fox-oring)
|
|||||||
|
|
||||||
#include "rffc507x.hpp" /* c/m, avoiding initial short ON Ant_DC_Bias pulse, from cold reset */
|
#include "rffc507x.hpp" /* c/m, avoiding initial short ON Ant_DC_Bias pulse, from cold reset */
|
||||||
rffc507x::RFFC507x first_if;
|
rffc507x::RFFC507x first_if;
|
||||||
|
ui::SystemView* system_view_ptr;
|
||||||
|
|
||||||
static void event_loop() {
|
static void event_loop() {
|
||||||
static ui::Context context;
|
static ui::Context context;
|
||||||
@ -151,6 +152,8 @@ static void event_loop() {
|
|||||||
context,
|
context,
|
||||||
portapack::display.screen_rect()};
|
portapack::display.screen_rect()};
|
||||||
|
|
||||||
|
system_view_ptr = &system_view;
|
||||||
|
|
||||||
EventDispatcher event_dispatcher{&system_view, context};
|
EventDispatcher event_dispatcher{&system_view, context};
|
||||||
static MessageHandlerRegistration message_handler_display_sleep{
|
static MessageHandlerRegistration message_handler_display_sleep{
|
||||||
Message::ID::DisplaySleep,
|
Message::ID::DisplaySleep,
|
||||||
|
@ -422,6 +422,10 @@ void SystemStatusView::set_back_enabled(bool new_value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SystemStatusView::set_back_hidden(bool new_value) {
|
||||||
|
button_back.hidden(new_value);
|
||||||
|
}
|
||||||
|
|
||||||
void SystemStatusView::set_title_image_enabled(bool new_value) {
|
void SystemStatusView::set_title_image_enabled(bool new_value) {
|
||||||
if (new_value) {
|
if (new_value) {
|
||||||
add_child(&button_title);
|
add_child(&button_title);
|
||||||
@ -896,6 +900,9 @@ Context& SystemView::context() const {
|
|||||||
NavigationView* SystemView::get_navigation_view() {
|
NavigationView* SystemView::get_navigation_view() {
|
||||||
return &navigation_view;
|
return &navigation_view;
|
||||||
}
|
}
|
||||||
|
SystemStatusView* SystemView::get_status_view() {
|
||||||
|
return &status_view;
|
||||||
|
}
|
||||||
|
|
||||||
void SystemView::toggle_overlay() {
|
void SystemView::toggle_overlay() {
|
||||||
static uint8_t last_perf_counter_status = shared_memory.request_m4_performance_counter;
|
static uint8_t last_perf_counter_status = shared_memory.request_m4_performance_counter;
|
||||||
|
@ -185,6 +185,7 @@ class SystemStatusView : public View {
|
|||||||
SystemStatusView(NavigationView& nav);
|
SystemStatusView(NavigationView& nav);
|
||||||
|
|
||||||
void set_back_enabled(bool new_value);
|
void set_back_enabled(bool new_value);
|
||||||
|
void set_back_hidden(bool new_value);
|
||||||
void set_title_image_enabled(bool new_value);
|
void set_title_image_enabled(bool new_value);
|
||||||
void set_title(const std::string new_value);
|
void set_title(const std::string new_value);
|
||||||
|
|
||||||
@ -378,6 +379,7 @@ class SystemView : public View {
|
|||||||
void paint_overlay();
|
void paint_overlay();
|
||||||
|
|
||||||
NavigationView* get_navigation_view();
|
NavigationView* get_navigation_view();
|
||||||
|
SystemStatusView* get_status_view();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t overlay_active{0};
|
uint8_t overlay_active{0};
|
||||||
|
Loading…
Reference in New Issue
Block a user