small changes and fixes

This commit is contained in:
Joel 2021-01-30 01:53:25 +01:00
parent 76a01e4cd9
commit 6c579bb5fb
No known key found for this signature in database
GPG key ID: BDDDBECD0808290E
6 changed files with 21 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import os
import cv2
import logging
import threading
import LogstashLogging
from compLib.LogstashLogging import Logging
from flask import Flask, Response
@ -51,7 +51,7 @@ class __Streaming:
# self.__camera_stream = cv2.VideoCapture(0)
self.__newest_frame = None
self.__lock = threading.Lock()
logging.info("Initialized vision")
Logging.get_logger().info("Initialized vision")
def get_frame(self):
"""
@ -104,7 +104,7 @@ Streaming = None
if BUILDING_DOCS == "false":
# instantiate private class __Streaming
Streaming = __Streaming()
logging.info("created instance of streaming class")
Logging.get_logger().info("created instance of streaming class")
@app.route("/live")
@ -134,7 +134,7 @@ def __start_flask():
:return:
"""
logging.info("starting flask server")
Logging.get_logger().info("starting flask server")
app.run(host="0.0.0.0", port=9898, debug=True, threaded=True, use_reloader=False)

View file

@ -7,8 +7,12 @@ import LogstashLogging
from LogstashLogging import logstash_logger
from threading import Thread
import logging
from Battery import Battery
from Buzzer import Buzzer
try:
from Battery import Battery
from Buzzer import Buzzer
except Exception as e:
logstash_logger.error("unable to import battery or buzzer in daemon")
__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\""""
@ -21,7 +25,7 @@ def check_battery():
battery = Battery.percent()
except Exception as e:
logstash_logger.error(f"could not check battery -> {str(e)}")
if battery <= 15:
if -100 <= battery <= 15:
logstash_logger.warning(f"LOW BATTERY DETECTED: '{battery}'")
Buzzer.set(True)
time.sleep(1)

View file

@ -1,4 +1,4 @@
__version__ = "0.0.4-6"
__version__ = "0.0.4-16"
import compLib.LogstashLogging
import logging