main/buttons.c

branch
novnc
changeset 41
7639cfa6aec0
parent 38
537ffe280775
child 54
7b134c27fadb
--- a/main/buttons.c	Sat May 04 11:41:16 2019 +0200
+++ b/main/buttons.c	Sat May 04 21:18:51 2019 +0200
@@ -12,6 +12,9 @@
 const char 			*mashTypes[] = { "Infusion", "Temperature", "Decoction" };
 const char			*SSR2Types[] = { "Uit", "HLT of MLT", "HLT en MLT", "Idle" };
 
+uint8_t				WS_pressed = 0;		///< Websocket button received
+uint16_t			WS_pointer_x = 0;	///< Websocket coordinate x
+uint16_t			WS_pointer_y = 0;	///< Websocket coordinate y
 
 #define	EDIT_TYPE_TEXT		0			///< Editor type is text
 #define	EDIT_TYPE_INT		1			///< Editor type is integer
@@ -134,7 +137,13 @@
 	return rc;
     }
 
-    if (v_pressed) {
+    if (WS_pressed) {
+	v_pressed = true;
+        vx = WS_pointer_x;
+        vy = WS_pointer_y;
+	WS_pressed = 0;
+        return -1;
+    } else if (v_pressed) {
 	rc = Buttons_Search(vx, vy);
 	v_pressed = false;
 	vx = vy = -1;
@@ -146,6 +155,15 @@
 
 
 
+void WS_touched(int x, int y)
+{
+    WS_pointer_x = x;
+    WS_pointer_y = y;
+    WS_pressed = 1;
+}
+
+
+
 static const uint8_t alphalow_tab[] = { 'q','w','e','r','t','y','u','i','o','p',
 					'a','s','d','f','g','h','j','k','l',
 					'z','x','c','v','b','n','m' };

mercurial