def buttonHandler(): # Reads memB for which buttons are pressed, then sends # calls to telemachus as needed. global memB global memBOLD if memB[1] == '1' and memB[1] != memBOLD[1]: if (memB[7] == '1'): # Check the safety tele.stage() if memB[0] == '1' and memB[0] != memBOLD[0]: if memB[7] == '1': # Check the safety tele.abort() if int(memB[2]) == 1 and memB[2] != memBOLD[2]: # Toggle gear based on what we did last time if ps['Gear Status'] is True: # Telemachus does not yet read gear status tele.gear(0) ps['Gear Status'] = False elif ps['Gear Status'] is False: tele.gear(1) ps['Gear Status'] = True if int(memB[3]) == 1 and memB[3] != memBOLD[3]: # Toggle Light based on the Telemachus reading if fd['Light Status'] is True: tele.light(0) elif fd['Light Status'] is False: tele.light(1) if int(memB[4]) == 1 and memB[4] != memBOLD[4]: # Toggle brake based on what we did last time if ps['Brake Status'] is True: # Telemachus does not yet read brake status tele.brake(0) ps['Brake Status'] = False elif ps['Brake Status'] is False: tele.brake(1) ps['Brake Status'] = True if int(memB[5]) == 1 and memB[5] != memBOLD[5]: # Toggle RCS based on the Telemachus reading if fd['RCS Status'] is True: tele.rcs(0) elif fd['RCS Status'] is False: tele.rcs(1) if int(memB[6]) == 1 and memB[6] != memBOLD[6]: # Toggle SAS based on the Telemachus reading if fd['SAS Status'] is True: tele.sas(0) elif fd['SAS Status'] is False: tele.sas(1)
def buttonHandler(): global gearStatus global brakeStatus global memB global memBOLD if memB[1] == '1' and memB[1] != memBOLD[1]: if (memB[7] == '1'): # Check the safety tele.stage() if memB[0] == '1' and memB[0] != memBOLD[0]: if memB[7] == '1': # Check the safety tele.abort() if int(memB[2]) == 1 and memB[2] != memBOLD[2]: # Toggle gear based on what we did last time if gearStatus == 1: # Telemachus does not yet read gear status tele.gear(0) gearStatus = 0 elif gearStatus == 0: tele.gear(1) gearStatus = 1 if int(memB[3]) == 1 and memB[3] != memBOLD[3]: # Toggle Light based on the Telemachus reading if tele.light(2) == 1: tele.light(0) elif tele.light(2) == 0: tele.light(1) if int(memB[4]) == 1 and memB[4] != memBOLD[4]: # Toggle brake based on what we did last time if brakeStatus == 1: # Telemachus does not yet read brake status tele.brake(0) brakeStatus = 0 elif brakeStatus == 0: tele.brake(1) brakeStatus = 1 if int(memB[5]) == 1 and memB[5] != memBOLD[5]: # Toggle RCS based on the Telemachus reading if tele.rcs(2) == 1: tele.rcs(0) elif tele.rcs(2) == 0: tele.rcs(1) if int(memB[6]) == 1 and memB[6] != memBOLD[6]: # Toggle SAS based on the Telemachus reading if tele.sas(2) == 1: tele.sas(0) elif tele.sas(2) == 0: tele.sas(1)