main/task_sound.c

branch
novnc
changeset 42
c6a1a6ca5437
parent 38
537ffe280775
child 43
2079940c3989
--- a/main/task_sound.c	Sat May 04 21:18:51 2019 +0200
+++ b/main/task_sound.c	Tue May 07 22:03:38 2019 +0200
@@ -43,14 +43,26 @@
  */
 void BuzzerPlay(const uint16_t *sound)
 {
+    char	msg[16];
+
     for (int i = 1; i <= sound[0]; i += 2) {
 	gpio_set_level(PIEZO_BUZZER, 1);
+	if (sound != _sound_Startup) {
+	    snprintf(msg, 15, "{\"beep\":\"1\"}");
+    	    ws_server_send_text_clients("/ws", msg, strlen(msg));
+	}
 	vTaskDelay(sound[i] / portTICK_PERIOD_MS);
 	gpio_set_level(PIEZO_BUZZER, 0);
+//	if (sound != _sound_Startup) {
+  //          snprintf(msg, 15, "{\"beep\":\"0\"}");
+  //          ws_server_send_text_clients("/ws", msg, strlen(msg));
+//        }
 	vTaskDelay(sound[i+1] / portTICK_PERIOD_MS);
     }
 
     gpio_set_level(PIEZO_BUZZER, 0);	// Just make sure the sound is off.
+//    snprintf(msg, 15, "{\"beep\":\"0\"}");
+//    ws_server_send_text_clients("/ws", msg, strlen(msg));
 }
 
 

mercurial