Пример #1
0
HMI = Hmi(S, OB.BUTTON_CONTACTOR_PIN)


# PID
p=Pid(10.0,0.0,0)
p.setPoint(30)

HMI.activate_contactor() # Activate HMI buttons


t1 = threading.Thread(target=startWebbServer, args=(q,))
t1.start()																										# START WEBBSERVER IN NEW THRED

logging.info('%s', "Enter main loop")
while True:
	q.put(TANK.get_temp(), BOILER.get_temp(), FIRE.get_temp(), int(FAN.get_rpm()), S.input_get_value(OB.BUTTON_AUTO_MAN), TIME_LEFT_OF_BLOCK_TIMER)# UPPDATE VALUE FOR GUI
	if not TIMESTAMP_CFG == time.ctime(os.path.getmtime(CFG)):													# RELOAD CONFIG IF TIMESTAMP CHANGED
		TIMESTAMP_CFG = time.ctime(os.path.getmtime(CFG))
		OB.readConfigFile()
		logging.info('%s', "Reload config file")
	if not S.input_get_value(OB.BUTTON_EMERGENCY_STOP):															# EMRGENCY STOP PRESSED (NC BLOCK)
		logging.info('%s', "Emergency stop pressed")
		FAN.deactivate_contactor()
		SOND.deactivate_contactor()
		SCREW.deactivate_contactor()
		while not S.input_get_value(OB.BUTTON_EMERGENCY_STOP):
			pass
		logging.info('%s', "Emergency stop released")
	else:
		if S.input_get_value(OB.BUTTON_RESET):																	# RESET PRESSED
				logging.info('%s', "Reset pressed")