Current location - Recipe Complete Network - Complete cookbook - Wall-hung boiler menu setting code
Wall-hung boiler menu setting code

The wall-hung boiler menu is the display panel of the wall-hung boiler controller. It has functions such as displaying temperature, adjusting temperature, and setting timer on and off. The following is an example of a wall-mounted boiler menu setting code:

```python#Define menu page menu_pages={'main':['TempSetting', 'TimerSetting', 'LockSetting', 'ResetSettings' ], 'temp_setting': ['CurrentTemp:{}℃', 'SetTemp:{}℃', 'Back'], 'timer_setting': ['SetTimer', 'Back'], 'lock_setting': ['Lock' ,'Unlock','Back'],}

#Define the temperature setting range temp_range=(10, 50)

#Define the timer setting maximum time max_timer=180< /p>

#Define the current status of the wall-mounted boiler current_temp=20set_temp=25timer_remaining=Nonetimer_is_on=Falselock_is_on=False

#Define the menu control function defshow_menu(page='main'):whileTrue: print('\ n', ''.join(menu_pages[page])) user_input=input('SelectOption:').strip() ifuser_input.isdigit()andint(user_input)temp_range[1]: new_temp=temp_range[1] set_temp=new_temp print('SetTemp:{}℃'.format(set_temp)) elifoption=='SetTimer': new_timer=int(input('SetTimer(mins):')) ifnew_timermax_timer: new_timer=max_timer timer_remaining=new_timer timer_is_on=True print( 'TimerSetfor{}mins'.format(timer_remaining)) elifoption=='Lock': lock_is_on=True print('Locked') elifoption=='Unlock': lock_is_on=False print('Unlocked') elifoption=='ResetSettings' : current_temp=20 set_temp=25 timer_remaining=None timer_is_on=False lock_is_on=False print('SettingsReset')```

This setting code defines the menu page, temperature setting range, and timer setting maximum time and the current status of the boiler. The menu control function selects the corresponding operation based on the user's input. Among them, when setting the temperature, you need to check whether the temperature range meets the requirements, and when setting the timer, you need to check whether the timing time is within the allowed range. Finally, a function to reset settings is defined to return all settings to their default state. This code implements the basic menu function of the wall-hung boiler and can be used as part of the wall-hung boiler controller.