Fix VisionDaemon
This commit is contained in:
parent
8218e8228e
commit
b4eae06eb6
1 changed files with 9 additions and 7 deletions
|
@ -38,7 +38,7 @@ print(f"After display and Spi import")
|
|||
__run = """raspivid -t 0 -b 5000000 -w 1280 -h 720 -fps 30 -n -o - | gst-launch-1.0 fdsrc ! video/x-h264,width=1280,height=720,framerate=30/1,noise-reduction=1,profile=high,stream-format=byte-stream ! h264parse ! queue ! flvmux streamable=true ! rtmpsink location=\"rtmp://localhost/live/stream\""""
|
||||
|
||||
STREAM_RASPI = False if os.getenv("STREAM_RASPI", "false") == "false" else True
|
||||
IP_OUTPUT = False if os.getenv("IP_OUTPUT", "false") == "false" else True
|
||||
IP_OUTPUT = False if os.getenv("IP_OUTPUT", "true") != "true" else True
|
||||
|
||||
|
||||
def get_ip():
|
||||
|
@ -54,11 +54,12 @@ def get_ip():
|
|||
|
||||
|
||||
def write_ip_to_screen():
|
||||
while not os.getenv("IP_OUTPUT", "false") == "false":
|
||||
while os.getenv("IP_OUTPUT", "true") == "true":
|
||||
ip = str(get_ip())
|
||||
print(f"writing {ip} to display")
|
||||
Logging.get_logger().info(f"writing {ip} to display")
|
||||
Display.write(1, ip)
|
||||
Display.write(1, "Current IP:")
|
||||
Display.write(2, ip)
|
||||
time.sleep(60)
|
||||
|
||||
|
||||
|
@ -69,10 +70,11 @@ if __name__ == '__main__':
|
|||
Logging.get_logger().warning("Warning, old systemd version detected")
|
||||
systemd.daemon.notify('READY=1')
|
||||
|
||||
print("starting ip output")
|
||||
Logging.get_logger().info("starting ip output")
|
||||
|
||||
ip_output = None
|
||||
if RUN_IP_CHECK and IP_OUTPUT:
|
||||
print("starting ip output")
|
||||
Logging.get_logger().info("starting ip output")
|
||||
try:
|
||||
Spi.disable_health_check()
|
||||
ip_output = threading.Thread(target=write_ip_to_screen)
|
||||
|
@ -90,8 +92,8 @@ if __name__ == '__main__':
|
|||
print("gstreamer stopped...")
|
||||
Logging.get_logger().error("gstreamer stopped...")
|
||||
else:
|
||||
print("not starting gstreamer background process and only checking for battery")
|
||||
Logging.get_logger().info("not starting gstreamer background process and only checking for battery")
|
||||
print("not starting gstreamer background process")
|
||||
Logging.get_logger().info("not starting gstreamer background process")
|
||||
if ip_output is not None:
|
||||
ip_output.join()
|
||||
else:
|
||||
|
|
Reference in a new issue