| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -6,18 +6,15 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "uart_driver.h" | 
					 | 
					 | 
					 | 
					#include "uart_driver.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "screen.h" | 
					 | 
					 | 
					 | 
					#include "screen.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/**
 | 
					 | 
					 | 
					 | 
					static volatile bool timer_running = false; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Broadcast screen state to sockets. | 
					 | 
					 | 
					 | 
					static ETSTimer notifyTim; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * This is a callback for the Screen module, | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * called after each visible screen modification. | 
					 | 
					 | 
					 | 
					static void notifyTimCb(void *arg) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
						timer_running = false; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void ICACHE_FLASH_ATTR screen_notifyChange() | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						// TODO cooldown / buffering to reduce nr of such events
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						void *data = NULL; | 
					 | 
					 | 
					 | 
						void *data = NULL; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						const int bufsiz = 512; | 
					 | 
					 | 
					 | 
						const int bufsiz = 1024; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						char buff[bufsiz]; | 
					 | 
					 | 
					 | 
						char buff[bufsiz]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for (int i = 0; i < 20; i++) { | 
					 | 
					 | 
					 | 
						for (int i = 0; i < 20; i++) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &data); | 
					 | 
					 | 
					 | 
							httpd_cgi_state cont = screenSerializeToBuffer(buff, bufsiz, &data); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -31,6 +28,21 @@ void ICACHE_FLASH_ATTR screen_notifyChange() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						screenSerializeToBuffer(NULL, bufsiz, &data); | 
					 | 
					 | 
					 | 
						screenSerializeToBuffer(NULL, bufsiz, &data); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					/**
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 * Broadcast screen state to sockets. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 * This is a callback for the Screen module, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 * called after each visible screen modification. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					void ICACHE_FLASH_ATTR screen_notifyChange(void) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						if (timer_running) return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						timer_running = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						os_timer_disarm(¬ifyTim); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						os_timer_setfn(¬ifyTim, notifyTimCb, NULL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						os_timer_arm(¬ifyTim, 20, 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** Socket received a message */ | 
					 | 
					 | 
					 | 
					/** Socket received a message */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void ICACHE_FLASH_ATTR updateSockRx(Websock *ws, char *data, int len, int flags) | 
					 | 
					 | 
					 | 
					void ICACHE_FLASH_ATTR updateSockRx(Websock *ws, char *data, int len, int flags) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |