logger.debug('Time: ' + rtc.get_localtime()) # initialize the MQTT module logger.debug('Initializing MQTT...') mqtt = MQTT(settings) # initialize the fermentation process logger.debug('Initializing main process logic...') main_process = Process(fermenter_temp_ctrl, process_tim, recovery, wifi, mqtt) # Set up HTTP server logger.debug('Initializing Web server...') web = HttpServer(main_process, wifi, rtc, settings) web.start() utime.sleep(3) if web.is_started(): logger.debug('HTTP service has started.') led.set_color('green') # 初始化全部完成后设置为绿色,表示处于待机状态 # Set up DNS Server logger.debug('Initializing DNS...') if MicroDNSSrv.Create({'*': '192.168.4.1'}): logger.debug("DNS service has started.") else: logger.debug("Failed to start DNS service...") # Check if the crash recovery is needed if recovery.is_needed(): logger.debug('Recovering the fermentation process...') recovered_process_info = recovery.retrieve_backup() beer_name = recovered_process_info['beerName']