main/buttons.c

changeset 45
71b4c3d1b429
parent 41
7639cfa6aec0
child 54
7b134c27fadb
equal deleted inserted replaced
36:1230b81ac36f 45:71b4c3d1b429
7 7
8 8
9 sButton Buttons[MAXBUTTONS]; ///< 40 buttons on a screen. 9 sButton Buttons[MAXBUTTONS]; ///< 40 buttons on a screen.
10 int level = 1; ///< Keyboard level. 10 int level = 1; ///< Keyboard level.
11 11
12 extern uint8_t VNC_pointer_button; ///< Mouse buttons mask
13 extern uint16_t VNC_pointer_x; ///< Mouse coordinate X
14 extern uint16_t VNC_pointer_y; ///< Mouse coordinate Y
15
16 const char *mashTypes[] = { "Infusion", "Temperature", "Decoction" }; 12 const char *mashTypes[] = { "Infusion", "Temperature", "Decoction" };
17 const char *SSR2Types[] = { "Uit", "HLT of MLT", "HLT en MLT", "Idle" }; 13 const char *SSR2Types[] = { "Uit", "HLT of MLT", "HLT en MLT", "Idle" };
18 14
15 uint8_t WS_pressed = 0; ///< Websocket button received
16 uint16_t WS_pointer_x = 0; ///< Websocket coordinate x
17 uint16_t WS_pointer_y = 0; ///< Websocket coordinate y
19 18
20 #define EDIT_TYPE_TEXT 0 ///< Editor type is text 19 #define EDIT_TYPE_TEXT 0 ///< Editor type is text
21 #define EDIT_TYPE_INT 1 ///< Editor type is integer 20 #define EDIT_TYPE_INT 1 ///< Editor type is integer
22 #define EDIT_TYPE_FLOAT 2 ///< Editor type is float 21 #define EDIT_TYPE_FLOAT 2 ///< Editor type is float
23 22
136 t_pressed = false; 135 t_pressed = false;
137 ox = oy = -1; 136 ox = oy = -1;
138 return rc; 137 return rc;
139 } 138 }
140 139
141 if (VNC_pointer_button & 0x07) { 140 if (WS_pressed) {
142 v_pressed = true; 141 v_pressed = true;
143 vx = VNC_pointer_x; 142 vx = WS_pointer_x;
144 vy = VNC_pointer_y; 143 vy = WS_pointer_y;
145 return -1; 144 WS_pressed = 0;
145 return -1;
146 } else if (v_pressed) { 146 } else if (v_pressed) {
147 rc = Buttons_Search(vx, vy); 147 rc = Buttons_Search(vx, vy);
148 v_pressed = false; 148 v_pressed = false;
149 vx = vy = -1; 149 vx = vy = -1;
150 return rc; 150 return rc;
151 } 151 }
152 152
153 return -1; 153 return -1;
154 }
155
156
157
158 void WS_touched(int x, int y)
159 {
160 WS_pointer_x = x;
161 WS_pointer_y = y;
162 WS_pressed = 1;
154 } 163 }
155 164
156 165
157 166
158 static const uint8_t alphalow_tab[] = { 'q','w','e','r','t','y','u','i','o','p', 167 static const uint8_t alphalow_tab[] = { 'q','w','e','r','t','y','u','i','o','p',

mercurial