Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/chronotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def get_statistics(log, host="localhost"):

return stats

def get_ip():
ipinfo = exec_cmd(["hostname", "-I"])
if ipinfo:
ip_addresses = ipinfo[0].strip().split()
if ip_addresses:
return ip_addresses[0]
return "-.-.-.-"


def main_loop():
last_time = ""
Expand Down Expand Up @@ -153,6 +161,7 @@ def main_button():
log.error("Failed to open display, exiting...")
exit(-1)

ip_counter = 0
while True:
time_str = time.strftime("%Y-%m-%d %H:%M:%S")
if time_str != last_time:
Expand Down Expand Up @@ -231,6 +240,10 @@ def main_button():
else:
dev_str = f"{stats['adjusted_offset']:>7}"
last_str = f"SATS[{sats}] {dev_str}"
ip_counter += 1
if ip_counter % 8 < 4:
ip_str = get_ip()
source_str = f"IP: {ip_str}"
lcd.print_row(0, time_str)
lcd.print_row(1, offs)
lcd.print_row(2, source_str)
Expand Down