Просмотр исходного кода

Reset calibration screen touch timer on click (#19951)

Victor Oliveira 4 лет назад
Родитель
Сommit
12e8861a1c
Аккаунт пользователя с таким Email не найден
2 измененных файлов: 7 добавлений и 7 удалений
  1. 2
    2
      Marlin/src/lcd/tft/touch.cpp
  2. 5
    5
      Marlin/src/lcd/tft/touch.h

+ 2
- 2
Marlin/src/lcd/tft/touch.cpp Просмотреть файл

61
   enable();
61
   enable();
62
 }
62
 }
63
 
63
 
64
-void Touch::add_control(TouchControlType type, uint16_t x, uint16_t y, uint16_t width, uint16_t height, int32_t data) {
64
+void Touch::add_control(TouchControlType type, uint16_t x, uint16_t y, uint16_t width, uint16_t height, intptr_t data) {
65
   if (controls_count == MAX_CONTROLS) return;
65
   if (controls_count == MAX_CONTROLS) return;
66
 
66
 
67
   controls[controls_count].type = type;
67
   controls[controls_count].type = type;
306
   return touch.is_clicked();
306
   return touch.is_clicked();
307
 }
307
 }
308
 
308
 
309
-void add_control(uint16_t x, uint16_t y, TouchControlType control_type, int32_t data, MarlinImage image, bool is_enabled, uint16_t color_enabled, uint16_t color_disabled) {
309
+void add_control(uint16_t x, uint16_t y, TouchControlType control_type, intptr_t data, MarlinImage image, bool is_enabled, uint16_t color_enabled, uint16_t color_disabled) {
310
   uint16_t width = Images[image].width;
310
   uint16_t width = Images[image].width;
311
   uint16_t height = Images[image].height;
311
   uint16_t height = Images[image].height;
312
   tft.canvas(x, y, width, height);
312
   tft.canvas(x, y, width, height);

+ 5
- 5
Marlin/src/lcd/tft/touch.h Просмотреть файл

85
 
85
 
86
 typedef void (*screenFunc_t)();
86
 typedef void (*screenFunc_t)();
87
 
87
 
88
-void add_control(uint16_t x, uint16_t y, TouchControlType control_type, int32_t data, MarlinImage image, bool is_enabled = true, uint16_t color_enabled = COLOR_CONTROL_ENABLED, uint16_t color_disabled = COLOR_CONTROL_DISABLED);
88
+void add_control(uint16_t x, uint16_t y, TouchControlType control_type, intptr_t data, MarlinImage image, bool is_enabled = true, uint16_t color_enabled = COLOR_CONTROL_ENABLED, uint16_t color_disabled = COLOR_CONTROL_DISABLED);
89
 inline void add_control(uint16_t x, uint16_t y, TouchControlType control_type, MarlinImage image, bool is_enabled = true, uint16_t color_enabled = COLOR_CONTROL_ENABLED, uint16_t color_disabled = COLOR_CONTROL_DISABLED) { add_control(x, y, control_type, 0, image, is_enabled, color_enabled, color_disabled); }
89
 inline void add_control(uint16_t x, uint16_t y, TouchControlType control_type, MarlinImage image, bool is_enabled = true, uint16_t color_enabled = COLOR_CONTROL_ENABLED, uint16_t color_disabled = COLOR_CONTROL_DISABLED) { add_control(x, y, control_type, 0, image, is_enabled, color_enabled, color_disabled); }
90
-inline void add_control(uint16_t x, uint16_t y, screenFunc_t screen, MarlinImage image, bool is_enabled = true, uint16_t color_enabled = COLOR_CONTROL_ENABLED, uint16_t color_disabled = COLOR_CONTROL_DISABLED) { add_control(x, y, MENU_SCREEN, (int32_t)screen, image, is_enabled, color_enabled, color_disabled); }
90
+inline void add_control(uint16_t x, uint16_t y, screenFunc_t screen, MarlinImage image, bool is_enabled = true, uint16_t color_enabled = COLOR_CONTROL_ENABLED, uint16_t color_disabled = COLOR_CONTROL_DISABLED) { add_control(x, y, MENU_SCREEN, (intptr_t)screen, image, is_enabled, color_enabled, color_disabled); }
91
 
91
 
92
 typedef struct __attribute__((__packed__)) {
92
 typedef struct __attribute__((__packed__)) {
93
   TouchControlType type;
93
   TouchControlType type;
95
   uint16_t y;
95
   uint16_t y;
96
   uint16_t width;
96
   uint16_t width;
97
   uint16_t height;
97
   uint16_t height;
98
-  int32_t data;
98
+  intptr_t data;
99
 } touch_control_t;
99
 } touch_control_t;
100
 
100
 
101
 typedef struct __attribute__((__packed__)) {
101
 typedef struct __attribute__((__packed__)) {
158
 
158
 
159
   public:
159
   public:
160
     static void init();
160
     static void init();
161
-    static void reset() { controls_count = 0; touch_time = -1; current_control = NULL; }
161
+    static void reset() { controls_count = 0; touch_time = 0; current_control = NULL; }
162
     static void clear() { controls_count = 0; }
162
     static void clear() { controls_count = 0; }
163
     static void idle();
163
     static void idle();
164
     static bool is_clicked() {
164
     static bool is_clicked() {
171
     static void disable() { enabled = false; }
171
     static void disable() { enabled = false; }
172
     static void enable() { enabled = true; }
172
     static void enable() { enabled = true; }
173
 
173
 
174
-    static void add_control(TouchControlType type, uint16_t x, uint16_t y, uint16_t width, uint16_t height, int32_t data = 0);
174
+    static void add_control(TouchControlType type, uint16_t x, uint16_t y, uint16_t width, uint16_t height, intptr_t data = 0);
175
 
175
 
176
     static touch_calibration_t calibration;
176
     static touch_calibration_t calibration;
177
     static void calibration_reset() { calibration = {TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y, TOUCH_OFFSET_X, TOUCH_OFFSET_Y, TOUCH_ORIENTATION}; }
177
     static void calibration_reset() { calibration = {TOUCH_CALIBRATION_X, TOUCH_CALIBRATION_Y, TOUCH_OFFSET_X, TOUCH_OFFSET_Y, TOUCH_ORIENTATION}; }

Загрузка…
Отмена
Сохранить