def check_gom(): try: gom = Gomspace() hk = gom.get_health_data(level="eps") except Exception as e: log_error(e) logger.error( f"GOM init failed. Is it charged above 7.0V? Check SDA/SCL (with an oscilloscope if need be)" ) else: logger.info( f"GOM initialization successful. Battery voltage: {hk.vbatt}")
while True: choice = int( input("Choose an option:\n" "0: Display Housekeeping Data" "1: Receiving Amplifier (LNA)\n" "2: Glowplug 1\n" "3: Glowplug 2\n" "4: Burnwire\n" "5: Solenoid\n" "6: Electrolyzer\n" "7: Transmitting Amplifier (PA)\n" "999: Turn OFF all controllable outputs\n")) if choice == 999: gom.all_off() ps.displayHk2(gom.get_health_data(level="eps")) if choice == 0: ps.displayHk2(gom.get_health_data(level='eps')) if choice in [1, 4, 6, 7]: duration = int(input("Duration (integer seconds):\n")) assert 0 < duration < 15 if choice == 1: gom.lna(True) sleep(duration / 2) ps.displayHk2(gom.get_health_data(level='eps')) sleep(duration / 2) gom.lna(False) if choice == 4:
# Testing all untested and new Gom-related commands from drivers.gom import Gomspace, logger from drivers.power.power_structs import displayHK, displayHk2, displayStruct from time import sleep test = Gomspace() # testing all HK functions hkdata = test.get_health_data() displayStruct(hkdata) sleep(2) hkdata = test.get_health_data(level="eps") displayStruct(hkdata) sleep(2) hkdata = test.get_health_data(level="vi") displayStruct(hkdata) sleep(2) hkdata = test.get_health_data(level="out") displayStruct(hkdata) sleep(2) hkdata = test.get_health_data(level="wdt") displayStruct(hkdata) sleep(2) hkdata = test.get_health_data(level="basic") displayStruct(hkdata)