def basic(lcd: lcd2usb.LCD): """Output basic LCD information and datetime.""" bus, dev = lcd.info(False) version = lcd.version now = datetime.datetime.now() lcd.clear() lcd.fill('LCD Version: {0}.{1}'.format(*version), 0) lcd.fill('Bus: {0:x}, Dev: {1:x}'.format(bus, dev), 1) lcd.fill(str(now), 2) lcd.fill_center('win10py3lcd2usb', 3)
def getOrWait(lcd: lcd2usb.LCD, timeout: int) -> int: """Check if OpenHardwareMonitor is running and wait if necessary. Returns ------- (int) the process ID of OHM. """ while True: proc = get_process() if not proc: logger.warning("OpenHardwareMonitor not running") lcd.clear() lcd.fill_center("Waiting for OHM...") proc = wait_for_process(timeout) if not (proc and proc.ProcessId): continue logger.info("Found OpenHardwareMonitor") return proc.ProcessId