Add code for feature "Disable Touch"

This commit is contained in:
Žiga Deisinger 2022-01-26 14:53:31 +01:00
parent ea251a87c0
commit 96879d3664
4 changed files with 12 additions and 1 deletions

View File

@ -294,6 +294,7 @@ SetUIView::SetUIView(NavigationView& nav) {
checkbox_showsplash.set_value(persistent_memory::config_splash());
checkbox_showclock.set_value(!persistent_memory::hide_clock());
//checkbox_login.set_value(persistent_memory::config_login());
//Add code for touch disabled
uint32_t backlight_timer = persistent_memory::config_backlight_timer();
if (backlight_timer) {

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 ) {//Add code for touch disabled
if( point_stable() ) {
state = State::TouchDetected;
touch_started();

View File

@ -254,6 +254,10 @@ bool config_splash() {
return data->ui_config & (1 << 31);
}
bool touch_screen_enabled() {
return data->ui_config & (1 << 32);
}
uint32_t config_backlight_timer() {
const uint32_t timer_seconds[8] = { 0, 5, 15, 30, 60, 180, 300, 600 };
return timer_seconds[data->ui_config & 7]; //first three bits, 8 possible values
@ -291,6 +295,10 @@ void set_config_backlight_timer(uint32_t i) {
data->ui_config = (data->ui_config & ~7) | (i & 7);
}
void set_touch_screen_enabled(bool v) {
data->ui_config = (data->ui_config & ~(1 << 32)) | (v << 32);
}
/*void set_config_textentry(uint8_t new_value) {
data->ui_config = (data->ui_config & ~0b100) | ((new_value & 1) << 2);
}

View File

@ -80,6 +80,7 @@ bool clock_with_date();
bool config_login();
bool config_speaker();
uint32_t config_backlight_timer();
bool touch_screen_enabled();
void set_config_splash(bool v);
void set_clock_hidden(bool v);
@ -87,6 +88,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_touch_screen_enabled(bool v);
//uint8_t ui_config_textentry();
//void set_config_textentry(uint8_t new_value);