|
|
|
@ -18,7 +18,7 @@ def monitor():
|
|
|
|
|
if tc < 15: #15 seconds
|
|
|
|
|
time.sleep(6)
|
|
|
|
|
else:
|
|
|
|
|
writehtml(f"Radio Off or Log4OM Not Running", False)
|
|
|
|
|
writehtml(f"Radio Off or Log4OM Not Running", False) #writehtml() requires two arguements and you can't be on air if radio is off
|
|
|
|
|
time.sleep(30) # Slow checks when radio off/no UDP
|
|
|
|
|
|
|
|
|
|
def log4om():
|
|
|
|
@ -34,24 +34,28 @@ def log4om():
|
|
|
|
|
tf = tx_freq / 100
|
|
|
|
|
sv = tf - f # Determines split value
|
|
|
|
|
if sv > 0:
|
|
|
|
|
writehtml(f"Frequency: {f}kHz {mode}<br>Tx Split Up: {sv:.2f} kHz", onair)
|
|
|
|
|
writehtml(f"Frequency: {f}kHz {mode}<br>Tx Split · Up: {sv:.2f} kHz", onair)
|
|
|
|
|
elif sv < 0:
|
|
|
|
|
sv = sv * -1 # Invert negative numbers
|
|
|
|
|
writehtml(f"Frequency: {f}kHz {mode}<br>Tx Split Down: {sv:.2f} kHz", onair)
|
|
|
|
|
writehtml(f"Frequency: {f}kHz {mode}<br>Tx Split · Down: {sv:.2f} kHz", onair)
|
|
|
|
|
else:
|
|
|
|
|
writehtml(f"Frequency: {f}kHz {mode}", onair)
|
|
|
|
|
tot = time.time() #timestamp
|
|
|
|
|
time.sleep(.1)
|
|
|
|
|
|
|
|
|
|
def writehtml(rs, t = "true"):
|
|
|
|
|
header = "<html>\n<head>\n<title>FT-1000MP Status</title>\n<meta http-equiv=\"refresh\" content=\"5\">\n</head>\n<body>\n"
|
|
|
|
|
footer = "\n</body>\n</html>"
|
|
|
|
|
isonair = "ON THE AIR<br>\n"
|
|
|
|
|
header = "<html>\n<head>\n<title>FT-1000MP Status</title>\n<meta http-equiv=\"refresh\" content=\"5\">\n</head>\n" # Basic Header
|
|
|
|
|
#css = "<link rel=\"stylesheet\" href=\"poole.css\">\n<link rel=\"stylesheet\" href=\"hyde.css\">\n<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface\">" # This adds my CSS files.
|
|
|
|
|
#div = "<body><body class=\"theme-base-0d\"><div class=\"sidebar\"><div class=\"sidebar-about\">" # This is additional formatting
|
|
|
|
|
footer = "\n</div></div></body>\n</html>" # footer
|
|
|
|
|
isonair = "ON THE AIR<br>\n" # on-air html
|
|
|
|
|
with open("/var/www/log/radio.html", "w") as html: # Modifiy file location as needed.
|
|
|
|
|
if t == True: # Checks for on-air
|
|
|
|
|
html.write(header + isonair + rs + footer)
|
|
|
|
|
#html.write(header + css + div + isonair + rs + footer) # This will add additional variables (for css, etc.) to the HTML file.
|
|
|
|
|
html.write (header + isonair + rs + footer) # No formatting version
|
|
|
|
|
if t == False: # Checks for on-air
|
|
|
|
|
html.write(header + rs + footer)
|
|
|
|
|
#html.write(header + css + div + rs + footer) # Same as above without isonair, use if additional html is used
|
|
|
|
|
html.write(header + rs + footer) # No formatting version
|
|
|
|
|
|
|
|
|
|
T = Thread(target=monitor,daemon=True) # Daemon the monitor thread
|
|
|
|
|
L = Thread(target=log4om)
|
|
|
|
|