mirror of
				https://github.com/revspace/operame
				synced 2025-10-31 03:25:37 +00:00 
			
		
		
		
	Display message before restarting
This commit is contained in:
		
							parent
							
								
									28bfd78e28
								
							
						
					
					
						commit
						e70efe35d7
					
				
							
								
								
									
										14
									
								
								operame.ino
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								operame.ino
									
									
									
									
									
								
							| @ -102,6 +102,12 @@ void display_logo() { | |||||||
|     sprite.pushSprite(0, 0); |     sprite.pushSprite(0, 0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void panic(const String& message) { | ||||||
|  |     display_big(message, TFT_RED); | ||||||
|  |     delay(5000); | ||||||
|  |     ESP.restart(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void setup_ota() { | void setup_ota() { | ||||||
|     ArduinoOTA.setHostname(WiFiSettings.hostname.c_str()); |     ArduinoOTA.setHostname(WiFiSettings.hostname.c_str()); | ||||||
|     ArduinoOTA.setPassword(WiFiSettings.password.c_str()); |     ArduinoOTA.setPassword(WiFiSettings.password.c_str()); | ||||||
| @ -284,7 +290,9 @@ void setup() { | |||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (portal_phase == 0 && millis() > 10*60*1000) ESP.restart(); |         if (portal_phase == 0 && millis() > 10*60*1000) { | ||||||
|  |             panic("Tijd verstreken"); | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
|         if (ota_enabled) ArduinoOTA.handle(); |         if (ota_enabled) ArduinoOTA.handle(); | ||||||
|         if (!digitalRead(portalbutton)) { |         if (!digitalRead(portalbutton)) { | ||||||
| @ -311,7 +319,7 @@ void connect_mqtt() { | |||||||
|         failures = 0; |         failures = 0; | ||||||
|     } else { |     } else { | ||||||
|         failures++; |         failures++; | ||||||
|         if (failures >= max_failures) ESP.restart(); |         if (failures >= max_failures) panic("MQTT onbereikbaar"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -391,7 +399,7 @@ int get_co2() { | |||||||
|     if (driver == MHZ) return mhz_get_co2(); |     if (driver == MHZ) return mhz_get_co2(); | ||||||
| 
 | 
 | ||||||
|     // Should be unreachable
 |     // Should be unreachable
 | ||||||
|     ESP.restart(); |     panic("driverfout"); | ||||||
|     return -1;  // suppress warning
 |     return -1;  // suppress warning
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user