mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
Reset touch calibration when holding BOOT for 8 seconds
This commit is contained in:
@@ -12,6 +12,27 @@
|
|||||||
#define CPU_FREQ_LOW 80
|
#define CPU_FREQ_LOW 80
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
unsigned long last_milis = 0;
|
||||||
|
|
||||||
|
inline void lv_handler()
|
||||||
|
{
|
||||||
|
#ifndef CYD_SCREEN_DISABLE_TOUCH_CALIBRATION
|
||||||
|
if (digitalRead(0) == HIGH)
|
||||||
|
{
|
||||||
|
last_milis = millis();
|
||||||
|
}
|
||||||
|
else if (millis() - last_milis > 8000)
|
||||||
|
{
|
||||||
|
global_config.screen_calibrated = false;
|
||||||
|
write_global_config();
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lv_timer_handler();
|
||||||
|
lv_task_handler();
|
||||||
|
}
|
||||||
|
|
||||||
typedef void (*lv_indev_drv_read_cb_t)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
|
typedef void (*lv_indev_drv_read_cb_t)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
|
||||||
|
|
||||||
bool is_screen_in_sleep = false;
|
bool is_screen_in_sleep = false;
|
||||||
@@ -95,8 +116,7 @@ void lv_do_calibration(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (true){
|
while (true){
|
||||||
lv_timer_handler();
|
lv_handler();
|
||||||
lv_task_handler();
|
|
||||||
|
|
||||||
if (point[0] != 0 && point[1] != 0){
|
if (point[0] != 0 && point[1] != 0){
|
||||||
break;
|
break;
|
||||||
@@ -130,8 +150,7 @@ void lv_do_calibration(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (true){
|
while (true){
|
||||||
lv_timer_handler();
|
lv_handler();
|
||||||
lv_task_handler();
|
|
||||||
|
|
||||||
if (point[0] != 0 && point[1] != 0){
|
if (point[0] != 0 && point[1] != 0){
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ void screen_timer_start();
|
|||||||
void screen_timer_stop();
|
void screen_timer_stop();
|
||||||
void set_color_scheme();
|
void set_color_scheme();
|
||||||
void lv_setup();
|
void lv_setup();
|
||||||
bool is_screen_asleep();
|
bool is_screen_asleep();
|
||||||
|
void lv_handler();
|
||||||
@@ -30,8 +30,7 @@ void setup() {
|
|||||||
void loop(){
|
void loop(){
|
||||||
wifi_ok();
|
wifi_ok();
|
||||||
data_loop();
|
data_loop();
|
||||||
lv_timer_handler();
|
lv_handler();
|
||||||
lv_task_handler();
|
|
||||||
|
|
||||||
if (is_ready_for_ota_update())
|
if (is_ready_for_ota_update())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "../core/http_client.h"
|
#include "../core/http_client.h"
|
||||||
#include "switch_printer.h"
|
#include "switch_printer.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
#include "../core/lv_setup.h"
|
||||||
|
|
||||||
lv_obj_t * hostEntry;
|
lv_obj_t * hostEntry;
|
||||||
lv_obj_t * portEntry;
|
lv_obj_t * portEntry;
|
||||||
@@ -232,7 +233,6 @@ void ip_init(){
|
|||||||
|
|
||||||
while (!get_current_printer_config()->ip_configured)
|
while (!get_current_printer_config()->ip_configured)
|
||||||
{
|
{
|
||||||
lv_timer_handler();
|
lv_handler();
|
||||||
lv_task_handler();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,8 +181,7 @@ void settings_section_behaviour(lv_obj_t* panel)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
lv_create_custom_menu_switch("Multi Printer Mode", panel, multi_printer_switch, global_config.multi_printer_mode);
|
lv_create_custom_menu_switch("Multi Printer Mode", panel, multi_printer_switch, global_config.multi_printer_mode);
|
||||||
|
lv_create_custom_menu_button("Configure Printer IP", panel, reset_ip_click, "Restart");
|
||||||
lv_create_custom_menu_button("Configure IP", panel, reset_ip_click, "Restart");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_section_device(lv_obj_t* panel)
|
void settings_section_device(lv_obj_t* panel)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "ui_utils.h"
|
#include "ui_utils.h"
|
||||||
#include "WiFi.h"
|
#include "WiFi.h"
|
||||||
#include "../core/data_setup.h"
|
#include "../core/data_setup.h"
|
||||||
|
#include "../core/lv_setup.h"
|
||||||
|
|
||||||
void wifi_init_inner();
|
void wifi_init_inner();
|
||||||
void wifi_pass_entry(const char* ssid);
|
void wifi_pass_entry(const char* ssid);
|
||||||
@@ -223,8 +224,7 @@ void wifi_init(){
|
|||||||
Serial.printf("WiFi Status: %s\n", errs[WiFi.status()]);
|
Serial.printf("WiFi Status: %s\n", errs[WiFi.status()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_timer_handler();
|
lv_handler();
|
||||||
lv_task_handler();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user