Merge pull request #482 from zigad/feature/disableTouch

Enable / Disable Touchscreen
This commit is contained in:
ArjanOnwezen 2022-04-08 22:59:18 +02:00 committed by GitHub
commit 1f27af660d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 3 deletions

View File

@ -228,15 +228,17 @@ SetFrequencyCorrectionModel SetRadioView::form_collect() {
SetUIView::SetUIView(NavigationView& nav) {
add_children({
//&checkbox_login,
&checkbox_disable_touchscreen,
&checkbox_speaker,
&checkbox_bloff,
&options_bloff,
&checkbox_showsplash,
&checkbox_showclock,
&options_clockformat,
&options_clockformat,
&button_ok
});
checkbox_disable_touchscreen.set_value(persistent_memory::disable_touchscreen());
checkbox_speaker.set_value(persistent_memory::config_speaker());
checkbox_showsplash.set_value(persistent_memory::config_splash());
checkbox_showclock.set_value(!persistent_memory::hide_clock());
@ -278,6 +280,7 @@ SetUIView::SetUIView(NavigationView& nav) {
}
persistent_memory::set_config_splash(checkbox_showsplash.value());
persistent_memory::set_clock_hidden(!checkbox_showclock.value());
persistent_memory::set_disable_touchscreen(checkbox_disable_touchscreen.value());
//persistent_memory::set_config_login(checkbox_login.value());
nav.pop();
};

View File

@ -220,6 +220,12 @@ public:
private:
Checkbox checkbox_disable_touchscreen {
{ 3 * 8, 2 * 16 },
20,
"Disable touchscreen"
};
Checkbox checkbox_speaker {
{ 3 * 8, 4 * 16 },
20,

View File

@ -109,7 +109,7 @@ void Manager::feed(const Frame& frame) {
switch(state) {
case State::NoTouch:
if( touch_stable && touch_pressure ) {
if( touch_stable && touch_pressure && !persistent_memory::disable_touchscreen()) {
if( point_stable() ) {
state = State::TouchDetected;
touch_started();

View File

@ -227,9 +227,13 @@ void set_playdead_sequence(const uint32_t new_value) {
// ui_config is an uint32_t var storing information bitwise
// bits 0,1,2 store the backlight timer
// bits 31, 30,29,28,27, 26, 25 stores the different single bit configs depicted below
// bits 31, 30,29,28,27, 26, 25, 24 stores the different single bit configs depicted below
// bits on position 4 to 19 (16 bits) store the clkout frequency
bool disable_touchscreen() { // Option to disable touch screen
return data->ui_config & (1 << 24);
}
bool show_bigger_qr_code() { // show bigger QR code
return data->ui_config & (1 << 23);
}
@ -270,6 +274,10 @@ uint32_t config_backlight_timer() {
return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values
}
void set_disable_touchscreen(bool v) {
data->ui_config = (data->ui_config & ~(1 << 24)) | (v << 24);
}
void set_show_bigger_qr_code(bool v) {
data->ui_config = (data->ui_config & ~(1 << 23)) | (v << 23);
}

View File

@ -84,6 +84,7 @@ bool clock_with_date();
bool config_login();
bool config_speaker();
uint32_t config_backlight_timer();
bool disable_touchscreen();
void set_config_splash(bool v);
void set_show_bigger_qr_code(bool v);
@ -92,6 +93,7 @@ void set_clock_with_date(bool v);
void set_config_login(bool v);
void set_config_speaker(bool v);
void set_config_backlight_timer(uint32_t i);
void set_disable_touchscreen(bool v);
//uint8_t ui_config_textentry();
//void set_config_textentry(uint8_t new_value);