Esempio n. 1
0
def ProcessSystemKey(zone):

    # Scan through the system 'mode' keys to find which mode should be active.
    for systemKey in GD.KEY_GROUP_SYSTEM_MODE:
        systemBit = GD.KEY_TO_CONTROL_BIT_LOOKUP[systemKey]
        if system.systemControl[systemBit].CheckIfBitHigh() == True:
            # Exit now we have found the active mode.
            break

    # Move to required mode.
    GD.currentMode = GD.KEY_TO_MODE_LOOKUP[systemKey]

    # Display keyboard for this mode
    display.DisplayKeyboardImage(useMode=GD.currentMode)

    # Read the config bits and update the bands on the control keys.
    keyData.SetControlBandStatus(GD.SYSTEM_CONTROL_GROUP,
                                 GD.KEY_GROUP_SYSTEM_MODE)

    # Display all the control keys with their new band status.
    display.UpdateSelectKeyImages(GD.KEY_GROUP_SYSTEM_MODE, GD.UPDATE_ALL)

    # Display user prompt.
    display.DisplayMiddleLeftInfoPrompt(GD.SYSTEM_SELECT_PROMPT)

    return 1
def SwitchToRunMode():

    # Clear all the prompts.
    display.DisplayZoneMode()
    display.TopRightInfoPrompt(GD.BLANK_PROMPT)
    display.DisplayProgOnTime(GD.BLANK_PROMPT)
    display.DisplayProgOffTimeAndDays(GD.BLANK_PROMPT)
    display.DisplayEntries(GD.BLANK_PROMPT)
    display.DisplayBottomLeftInfoPrompt(GD.BLANK_PROMPT)
    display.DisplayBottomRightInfoPrompt(GD.BLANK_PROMPT)

    # Set system bits as required.
    system.SetModeOutputControlBitsFromConfigBits()

    # Switch to run mode.
    GD.currentMode = GD.MODE_RUN

    # Put display into waiting for a press mode.
    display.WriteToDisplay(GD.BACKLIGHT_OFF)
    display.DisplayForm(GD.BLANK_SCREEN_FORM)
    display.DisplayPressToStart()
    display.WriteToDisplay(GD.BACKLIGHT_LOW)

    # For android screen
    display.DisplayMiddleLeftInfoPrompt(GD.PRESS_ANY_KEY_PROMPT)

    # Clear any boost presses so they are not there when we restart later.
    GD.boostPresses = 0

    # Start a zones check to update any changes to zones.
    GD.checkZone = 0
def ProcessManualOptionsKey(keyValue):

    # Move to manual options select mode and display keyboard.
    GD.currentMode = GD.MODE_MANUAL_OPTIONS
    display.DisplayKeyboardImage(useMode=GD.currentMode)

    # We have displayed a select keyboard so we need to set the select keys text idle and clear any bands.
    keyData.UpdateSelectKeyGroupText(textIdle=GD.KEY_GROUP_MANUAL_MODE)
    keyData.UpdateSelectKeyGroupBand(bandNone=(GD.KEY_GROUP_MANUAL_MODE))

    # Clear any previous band on manual control key and select keys on the following menu.
    keyData.SetDefaultKeyImage(GD.KEYVALUE_MANUAL_OVERRIDE)
    keyData.UpdateSelectKeyGroupText(
        textIdle=GD.KEY_GROUP_MANUAL_CONTROL_SELECT)
    keyData.UpdateSelectKeyGroupBand(
        bandNone=(GD.KEY_GROUP_MANUAL_CONTROL_SELECT))

    # We will check if an override is active for any manual controls. If it is we will set the manual control key and the select key
    # on the following menu to flash (yellow band). We will move to manual options disabled mode so the user cannot select a
    # manual option except manual control.

    # Get each manual control group.
    for group in range(0, len(GD.ALL_MANUAL_OVERRIDE_GROUPS)):
        # Scan each group.
        for controlBit in GD.ALL_MANUAL_OVERRIDE_GROUPS[group]:
            # If the override bit is active set band flashing on manual control key and the select key on following menu.
            if system.systemControl[controlBit].CheckIfOverrideActive(
            ) == True:
                keyData.SetKeyBand1Flashing(GD.KEYVALUE_MANUAL_OVERRIDE)
                keyData.SetKeyBand1Flashing(
                    GD.KEY_GROUP_MANUAL_CONTROL_SELECT[group])
                # If this is a manual control for tank 1, tank 2 or the boiler then disable manual options
                if controlBit in (GD.DISABLED_MANUAL_OVERRIDE_GROUPS):
                    GD.currentMode = GD.MODE_MANUAL_OPTIONS_DISABLED

    # If we are NOT disabled read the config bits and update the bands on the control keys. There are 2 groups of keys: the heating
    # control keys and the boiloer control keys.
    if GD.currentMode == GD.MODE_MANUAL_OPTIONS:

        keyData.SetControlBandStatus(GD.HEATING_MANUAL_CONTROL_GROUP,
                                     GD.KEY_GROUP_HEATING_MODE)
        keyData.SetControlBandStatus(GD.BOILER_MANUAL_CONTROL_GROUP,
                                     GD.KEY_GROUP_BOILER_MODE)

        # Display all the control keys with their new band status.
        display.UpdateSelectKeyImages(GD.KEY_GROUP_MANUAL_MODE, GD.UPDATE_ALL)

        # Tell user they can select an option.
        userPrompt = GD.MANUAL_OPTIONS_PROMPT

    else:

        # Tell user options not available
        userPrompt = GD.OPTIONS_DISABLED_PROMPT

    # Display new prompt to user.
    display.DisplayMiddleLeftInfoPrompt(userPrompt)

    return 1
def ProcessDisplayStatusKey(keyValue):

    # Move to display status mode and display keyboard and prompt.
    GD.currentMode = GD.MODE_DISPLAY_STATUS
    display.DisplayKeyboardImage(useMode=GD.currentMode)
    display.DisplayMiddleLeftInfoPrompt(GD.DISPLAY_STATUS_PROMPT)

    return 1
def ProcessHolidayOptionsKey(keyValue):

    # Move to holiday options select mode and display keyboard and prompt.
    GD.currentMode = GD.MODE_HOLIDAY_OPTIONS
    display.DisplayKeyboardImage(useMode=GD.currentMode)
    display.DisplayMiddleLeftInfoPrompt(GD.HOLIDAY_OPTIONS_PROMPT)

    return 1
def ProcessAutoOptionsKey(keyValue):

    # Move to auto options select mode and display keyboard and prompt.
    GD.currentMode = GD.MODE_AUTO_OPTIONS
    display.DisplayKeyboardImage(useMode=GD.currentMode)
    display.DisplayMiddleLeftInfoPrompt(GD.AUTO_OPTIONS_PROMPT)

    return 1
def ProcessSystemOptionsKey(keyValue):

    # Move to system options select mode and display keyboard and prompt.
    GD.currentMode = GD.MODE_SYSTEM_OPTIONS
    display.DisplayKeyboardImage(useMode=GD.currentMode)
    display.DisplayMiddleLeftInfoPrompt(GD.SYSTEM_OPTIONS_PROMPT)

    return 1
def ProcessManualOverrideKey(keyValue):

    # Move to manual override select mode and display keyboard.
    GD.currentMode = GD.MODE_MANUAL_OVERRIDE_MAIN_MENU
    display.DisplayKeyboardImage(useMode=GD.currentMode)

    # Display new prompt to user.
    display.DisplayMiddleLeftInfoPrompt(GD.MANUAL_OVERRIDE_PROMPT)

    return 1
def ProcessImmersionTimesKey(keyValue):

    # Move to immersion times select mode and display keyboard.
    GD.currentMode = GD.MODE_IMMERSION_WAITING_SELECT
    display.DisplayKeyboardImage(useMode=GD.currentMode)

    # Clear any previously active select key and display any active bands.
    keyData.UpdateSelectKeyGroupText(textIdle=GD.KEY_GROUP_IMMERSIONS)
    display.UpdateSelectKeyImages(GD.KEY_GROUP_IMMERSIONS)

    # Display user prompt.
    display.DisplayMiddleLeftInfoPrompt(GD.SELECT_IMMERSION_PROMPT)

    return 1
def ProcessManualOverrideKeySubMenu(keyValue):

    # Keep a list of parameters for each manual control key.
    parameters = {
        GD.KEYVALUE_IMMERSION_CONTROL:
        (GD.MODE_IMMERSION_MANUAL_CONTROL, GD.IMMERSION_MANUAL_OVERRIDE_GROUP,
         GD.KEY_GROUP_ALL_IMM, GD.IMMERSION_SELECT_PROMPT),
        GD.KEYVALUE_WOODBURNER_CONTROL:
        (GD.MODE_WOODBURNER_MANUAL_CONTROL,
         GD.WOODBURNER_MANUAL_OVERRIDE_GROUP, GD.KEY_GROUP_ALL_WB,
         GD.WB_PUMP_SELECT_PROMPT),
        GD.KEYVALUE_TANK_1_CONTROL:
        (GD.MODE_TANK_1_MANUAL_CONTROL, GD.TANK_1_MANUAL_OVERRIDE_GROUP,
         GD.KEY_GROUP_ALL_T1, GD.TANK_1_CONTROL_PROMPT),
        GD.KEYVALUE_TANK_2_CONTROL:
        (GD.MODE_TANK_2_MANUAL_CONTROL, GD.TANK_2_MANUAL_OVERRIDE_GROUP,
         GD.KEY_GROUP_ALL_T2, GD.TANK_2_CONTROL_PROMPT),
        GD.KEYVALUE_BOILER_CONTROL:
        (GD.MODE_BOILER_MANUAL_CONTROL, GD.BOILER_MANUAL_OVERRIDE_GROUP,
         GD.KEY_GROUP_ALL_BOILER, GD.BOILER_CONTROL_PROMPT),
        GD.KEYVALUE_HEATING_CONTROL:
        (GD.MODE_HEATING_MANUAL_CONTROL, GD.HEATING_MANUAL_OVERRIDE_GROUP,
         GD.KEY_GROUP_ALL_HEATING, GD.HEATING_CONTROL_PROMPT)
    }

    if keyValue in parameters:

        # Get parameters for this manual control select key.
        mode, control, keyGroup, prompt = parameters[keyValue]

        # The onkeys are the 1st half and the offkeys are the 2nd half of the keygroup list.
        onKeys = keyGroup[0:len(keyGroup) / 2]
        offKeys = keyGroup[len(keyGroup) / 2:len(keyGroup)]

        # Move to the new mode and display keyboard.
        GD.currentMode = mode
        display.DisplayKeyboardImage(useMode=GD.currentMode)

        # Set the control key bands according to the system configuration data bits.
        keyData.SetControlBandStatus(control, onKeys)
        keyData.SetControlBandStatus(control, offKeys, checkIfHigh=False)

        # Display the updated key images.
        display.UpdateSelectKeyImages(keyGroup, GD.UPDATE_ALL)

        # Prompt user for action.
        display.DisplayMiddleLeftInfoPrompt(prompt)

    return 1
Esempio n. 11
0
def ProcessUfhSelectExitKey(keyValue):

    # Return to ufh waiting select mode and keyboard.
    GD.currentMode = GD.MODE_UFH_WAITING_ZONE_SELECT
    display.DisplayKeyboardImage(useMode=GD.currentMode)

    # Clear any previously active select key and display any active bands.
    keyData.UpdateSelectKeyGroupText(textIdle=GD.KEY_GROUP_UFH)
    display.UpdateSelectKeyImages(GD.KEY_GROUP_UFH)

    # Update prompts.
    display.DisplayMiddleLeftInfoPrompt(GD.UFH_SELECT_PROMPT)
    display.DisplayBottomLeftInfoPrompt(GD.INFO_1_BLANKED)
    display.DisplayZoneMode()

    return 1
Esempio n. 12
0
def ProcessRadKey(zone):

    # Move to rad waiting mode and display keyboard.
    GD.currentMode = GD.MODE_RAD_WAITING_ZONE_SELECT
    display.DisplayKeyboardImage(useMode=GD.currentMode)

    # Set rad key active.
    # keyData.UpdateSelectKeyGroupText (GD.KEYVALUE_RAD, GD.KEY_GROUP_WAITING_MODE)
    # display.UpdateSelectKeyImages (GD.KEY_GROUP_WAITING_MODE, GD.UPDATE_CHANGED)

    # Clear any previously active select key and display any active bands.
    keyData.UpdateSelectKeyGroupText(textIdle=GD.KEY_GROUP_RADS)
    display.UpdateSelectKeyImages(GD.KEY_GROUP_RADS)

    # Display user prompt.
    display.DisplayMiddleLeftInfoPrompt(GD.RAD_SELECT_PROMPT)

    return 1
Esempio n. 13
0
def ProcessProgramKey(zone):

    # Switch to the program keyboard (time entry).
    display.DisplayKeyboardImage(GD.TIME_SELECT_KEYBOARD_IMAGE)

    # Say we are in programming mode. We start in time entry mode.
    GD.currentMode = GD.MODE_PROG_TIME

    # Clear the zone select data ready for displaying programming data fields.
    display.DisplayMiddleLeftInfoPrompt(GD.BLANK_PROMPT)

    # Read the programmed times and display the 1st programming data entry. Force a display update.
    zones.ReadZoneTimes(zone)
    display.DisplayProgEntry(1, forceUpdate=True)
    display.DisplayBottomLeftInfoPrompt()
    display.DisplayBottomRightInfoPrompt()

    return 1
Esempio n. 14
0
def ProcessUfhKey(zone):

    # Only process if we are not already in ufh waiting mode.
    if GD.currentMode != GD.MODE_UFH_WAITING_ZONE_SELECT:

        # Move to ufh waiting mode and display keyboard.
        GD.currentMode = GD.MODE_UFH_WAITING_ZONE_SELECT
        display.DisplayKeyboardImage(useMode=GD.currentMode)

        # Set ufh key active.
        #keyData.UpdateSelectKeyGroupText (GD.KEYVALUE_UFH, GD.KEY_GROUP_WAITING_MODE)
        # display.UpdateSelectKeyImages (GD.KEY_GROUP_WAITING_MODE, GD.UPDATE_CHANGED)

        # Clear any previously active select key and display any active bands.
        keyData.UpdateSelectKeyGroupText(textIdle=GD.KEY_GROUP_UFH)
        display.UpdateSelectKeyImages(GD.KEY_GROUP_UFH)

        # Display user prompt.
        display.DisplayMiddleLeftInfoPrompt(GD.UFH_SELECT_PROMPT)

    return 1
def ProcessImmersionSelectKey(keyValue):

    # Check if we are in override. If we are; move back to waiting select and warn user no operation allowed.
    if system.systemControl[GD.KEY_TO_CONTROL_BIT_LOOKUP[
            keyValue]].CheckIfOverrideActive() == True:
        GD.currentMode = GD.MODE_IMMERSION_WAITING_SELECT
        display.DisplayKeyboardImage(useMode=GD.currentMode)
        display.DisplayMiddleLeftInfoPrompt(GD.OPTIONS_DISABLED_PROMPT)

    else:
        # We have a zone selected so move to immersion select mode, keyboard and refresh select keys if we are not already there.
        if GD.currentMode != GD.MODE_IMMERSION_SELECT:
            GD.currentMode = GD.MODE_IMMERSION_SELECT
            display.DisplayKeyboardImage(useMode=GD.currentMode)
            display.UpdateSelectKeyImages(GD.KEY_GROUP_IMMERSIONS)

    # Set the zone select key active.
    keyData.UpdateSelectKeyGroupText(keyValue, GD.KEY_GROUP_IMMERSIONS)
    display.UpdateSelectKeyImages(GD.KEY_GROUP_IMMERSIONS, GD.UPDATE_CHANGED)

    return 1