kopia lustrzana https://github.com/projecthorus/wenet
Fixes to docker-run wenet
rodzic
f302af6ba3
commit
15c4d6b42e
|
@ -46,7 +46,7 @@ RUN --mount=type=cache,target=/root/.cache/pip pip3 install \
|
|||
flask-socketio \
|
||||
requests
|
||||
|
||||
# Copy in radiosonde_auto_rx.
|
||||
# Copy in wenet.
|
||||
COPY . /root/wenet
|
||||
|
||||
# Build the binaries.
|
||||
|
@ -66,6 +66,7 @@ RUN apt-get update && \
|
|||
bc \
|
||||
libusb-1.0-0 \
|
||||
python3 \
|
||||
python3-numpy \
|
||||
tini && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import sys
|
|||
import datetime
|
||||
import argparse
|
||||
import socket
|
||||
import traceback
|
||||
from WenetPackets import *
|
||||
|
||||
|
||||
|
@ -162,6 +163,10 @@ while True:
|
|||
# to use the buffer interface under Python 3.
|
||||
data = sys.stdin.buffer.read(256)
|
||||
|
||||
# if data == '':
|
||||
# logging.critical("Caught EOF. Exiting.")
|
||||
# sys.exit(1)
|
||||
|
||||
try:
|
||||
packet_type = decode_packet_type(data)
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ if __name__ == "__main__":
|
|||
t.start()
|
||||
|
||||
# Run the Flask app, which will block until CTRL-C'd.
|
||||
socketio.run(app, host='0.0.0.0', port=args.listen_port)
|
||||
socketio.run(app, host='0.0.0.0', port=args.listen_port, allow_unsafe_werkzeug=True)
|
||||
|
||||
udp_listener_running = False
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ class PacketTX(object):
|
|||
image_packet = struct.pack(">BH7pBHIBffffffBBBBBBBBBbfffffff",
|
||||
0x54, # Packet ID for the GPS Telemetry Packet.
|
||||
self.image_telem_count,
|
||||
callsign,
|
||||
callsign.encode(),
|
||||
image_id,
|
||||
gps_data['week'],
|
||||
int(gps_data['iTOW']*1000), # Convert the GPS week value to milliseconds, and cast to an int.
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#
|
||||
# PiCamera API: https://picamera.readthedocs.io/en/release-1.12/api_camera.html
|
||||
|
||||
from picamera import PiCamera
|
||||
import picamera
|
||||
from picamera import mmal
|
||||
import ctypes as ct
|
||||
from time import sleep
|
||||
from threading import Thread
|
||||
import glob
|
||||
|
@ -16,6 +18,22 @@ import datetime
|
|||
import traceback
|
||||
|
||||
|
||||
class PiCamera2(picamera.PiCamera):
|
||||
AWB_MODES = {
|
||||
'off': mmal.MMAL_PARAM_AWBMODE_OFF,
|
||||
'auto': mmal.MMAL_PARAM_AWBMODE_AUTO,
|
||||
'sunlight': mmal.MMAL_PARAM_AWBMODE_SUNLIGHT,
|
||||
'cloudy': mmal.MMAL_PARAM_AWBMODE_CLOUDY,
|
||||
'shade': mmal.MMAL_PARAM_AWBMODE_SHADE,
|
||||
'tungsten': mmal.MMAL_PARAM_AWBMODE_TUNGSTEN,
|
||||
'fluorescent': mmal.MMAL_PARAM_AWBMODE_FLUORESCENT,
|
||||
'incandescent': mmal.MMAL_PARAM_AWBMODE_INCANDESCENT,
|
||||
'flash': mmal.MMAL_PARAM_AWBMODE_FLASH,
|
||||
'horizon': mmal.MMAL_PARAM_AWBMODE_HORIZON,
|
||||
'greyworld': ct.c_uint32(10)
|
||||
}
|
||||
|
||||
|
||||
class WenetPiCam(object):
|
||||
""" PiCam Wrapper Class
|
||||
|
||||
|
@ -34,6 +52,7 @@ class WenetPiCam(object):
|
|||
image_delay=0.5,
|
||||
vertical_flip = False,
|
||||
horizontal_flip = False,
|
||||
greyworld = False,
|
||||
temp_filename_prefix = 'picam_temp',
|
||||
debug_ptr = None
|
||||
):
|
||||
|
@ -73,13 +92,14 @@ class WenetPiCam(object):
|
|||
self.src_resolution = src_resolution
|
||||
self.horizontal_flip = horizontal_flip
|
||||
self.vertical_flip = vertical_flip
|
||||
self.greyworld = greyworld
|
||||
|
||||
self.init_camera()
|
||||
|
||||
|
||||
def init_camera(self):
|
||||
# Attempt to start picam.
|
||||
self.cam = PiCamera()
|
||||
self.cam = PiCamera2()
|
||||
|
||||
# Configure camera.
|
||||
try:
|
||||
|
@ -90,7 +110,10 @@ class WenetPiCam(object):
|
|||
self.cam.hflip = self.horizontal_flip
|
||||
self.cam.vflip = self.vertical_flip
|
||||
self.cam.exposure_mode = 'auto'
|
||||
self.cam.awb_mode = 'sunlight' # Fixed white balance compensation.
|
||||
if self.greyworld:
|
||||
self.cam.awb_mode = 'greyworld' # 'Greyworld' white balance, for NIR imagery.
|
||||
else:
|
||||
self.cam.awb_mode = 'sunlight' # Fixed white balance compensation.
|
||||
self.cam.meter_mode = 'matrix'
|
||||
|
||||
# Start the 'preview' mode, effectively opening the 'shutter'.
|
||||
|
|
Ładowanie…
Reference in New Issue