Disable Back button during Touch Calibration (#2115)

This commit is contained in:
Mark Thompson 2024-04-21 01:34:55 -05:00 committed by GitHub
parent e7359563c6
commit 282e4da1cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 1 deletions

View File

@ -26,6 +26,8 @@
#include "portapack_persistent_memory.hpp"
using namespace portapack;
extern ui::SystemView* system_view_ptr;
namespace ui {
TouchCalibrationView::TouchCalibrationView(
@ -40,6 +42,7 @@ TouchCalibrationView::TouchCalibrationView(
&image_verify_1,
&image_verify_2,
&label_calibrate,
&label_calibrate_2,
&label_verify,
&label_success,
&label_failure,
@ -51,6 +54,12 @@ TouchCalibrationView::TouchCalibrationView(
button_ok.on_select = [this](Button&) { this->on_ok(); };
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() {
@ -70,6 +79,7 @@ void TouchCalibrationView::update_target() {
image_verify_2.hidden(phase != Phase::Verify2);
label_calibrate.hidden(!phase_calibrate);
label_calibrate_2.hidden(!phase_calibrate && !phase_verify);
label_verify.hidden(!phase_verify);
label_success.hidden(phase != Phase::Success);
label_failure.hidden(phase != Phase::Failure);

View File

@ -31,6 +31,7 @@ namespace ui {
class TouchCalibrationView : public View {
public:
TouchCalibrationView(NavigationView& nav);
~TouchCalibrationView();
void focus() override;
@ -110,9 +111,13 @@ class TouchCalibrationView : public View {
Color::black()};
Text label_calibrate{
{16, 5 * 16, 26 * 8, 1 * 16},
{2 * 8, 5 * 16, 26 * 8, 1 * 16},
"Touch targets to calibrate"};
Text label_calibrate_2{
{1 * 8, 6 * 16, 28 * 8, 1 * 16},
"(hold position using stylus)"};
Text label_verify{
{28, 5 * 16, 23 * 8, 1 * 16},
"Touch targets to verify"};

View File

@ -144,6 +144,7 @@ Continuous (Fox-oring)
#include "rffc507x.hpp" /* c/m, avoiding initial short ON Ant_DC_Bias pulse, from cold reset */
rffc507x::RFFC507x first_if;
ui::SystemView* system_view_ptr;
static void event_loop() {
static ui::Context context;
@ -151,6 +152,8 @@ static void event_loop() {
context,
portapack::display.screen_rect()};
system_view_ptr = &system_view;
EventDispatcher event_dispatcher{&system_view, context};
static MessageHandlerRegistration message_handler_display_sleep{
Message::ID::DisplaySleep,

View File

@ -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) {
if (new_value) {
add_child(&button_title);
@ -896,6 +900,9 @@ Context& SystemView::context() const {
NavigationView* SystemView::get_navigation_view() {
return &navigation_view;
}
SystemStatusView* SystemView::get_status_view() {
return &status_view;
}
void SystemView::toggle_overlay() {
static uint8_t last_perf_counter_status = shared_memory.request_m4_performance_counter;

View File

@ -185,6 +185,7 @@ class SystemStatusView : public View {
SystemStatusView(NavigationView& nav);
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(const std::string new_value);
@ -378,6 +379,7 @@ class SystemView : public View {
void paint_overlay();
NavigationView* get_navigation_view();
SystemStatusView* get_status_view();
private:
uint8_t overlay_active{0};