Skip to content

Commit

Permalink
Fixed relay overlay configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
connervieira committed Apr 29, 2024
1 parent 1dd73f8 commit 095c42b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions assets/support/configdefault.json
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@
}
},
"relay": {
"enabled": true,
"enabled": false,
"colors": {
"on": [
255,
0,
0
128,
128
],
"off": [
0,
Expand All @@ -274,7 +274,7 @@
},
"triggers": {
"horn": {
"enabled": true,
"enabled": false,
"pin": 0,
"invert": false,
"text": "HORN"
Expand Down
8 changes: 4 additions & 4 deletions dashcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def save_dashcam_segments(file1, file2=""):
relay_triggers = {}
for stamp in config["dashcam"]["stamps"]["relay"]["triggers"]:
if (config["dashcam"]["stamps"]["relay"]["triggers"][stamp]["enabled"] == True): # Check to see if this relay stamp is enabled.
relay_trigger[stamp] = Button(int(config["dashcam"]["stamps"]["relay"]["triggers"][stamp]["pin"]))
relay_triggers[stamp] = Button(int(config["dashcam"]["stamps"]["relay"]["triggers"][stamp]["pin"]))


def apply_dashcam_stamps(frame, device=""):
Expand Down Expand Up @@ -307,10 +307,10 @@ def apply_dashcam_stamps(frame, device=""):
stamp_number = 0
for stamp in config["dashcam"]["stamps"]["relay"]["triggers"]:
if (config["dashcam"]["stamps"]["relay"]["triggers"][stamp]["enabled"] == True): # Check to see if this relay stamp is enabled.
if (relay_trigger[stamp].is_pressed): # Check to see if the relay is triggered.
relay_stamp_color = config["dashcam"]["stamps"]["relay"]["color"]["on"]
if (relay_triggers[stamp].is_pressed): # Check to see if the relay is triggered.
relay_stamp_color = config["dashcam"]["stamps"]["relay"]["colors"]["on"]
else:
relay_stamp_color = config["dashcam"]["stamps"]["relay"]["color"]["off"]
relay_stamp_color = config["dashcam"]["stamps"]["relay"]["colors"]["off"]
relay_stamp = config["dashcam"]["stamps"]["relay"]["triggers"][stamp]["text"] # Set the relay stamp text to a blank placeholder. Elements will be added to this in the next steps.
(label_width, label_height), baseline = cv2.getTextSize(relay_stamp, 2, config["dashcam"]["stamps"]["size"], 1)
relay_stamp_position = [width - 10 - label_width, (30 * stamp_number) + round(30 * config["dashcam"]["stamps"]["size"])] # Determine where the diagnostic overlay stamp should be positioned in the video stream.
Expand Down
3 changes: 2 additions & 1 deletion docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This document contains detailed instructions on how to install Predator.

If you're already familiar with Predator, and you just want a quick set-up guide, you can use the following steps to set everything up. For more detailed instructions, skip to the 'Full Install Guide' later in the document.

1. Install Python packages: `pip3 install pytz validators requests gps gpsd-py3 opencv-python cvlib tensorflow keras silence-tensorflow psutil rns lxmf`
1. Install Python packages: `pip3 install pytz validators requests gps gpsd-py3 opencv-python cvlib tensorflow keras silence-tensorflow psutil rns lxmf gpiozero`
- If you see an "externally managed environment" error while installing Python packages, consider creating a virtual environment by running the following command in the Predator directory: `python3 -m venv .venv; source .venv/bin/activate`
- In the future, you will need to manually start the virtual environment by navigating to the Predator directory and running the following command: `source .venv/bin/activate`
- Note that depending on a virtual environment is likely to cause issues if you want to run Predator through Optic, Cortex, or another front-end interface, since these interfaces run outside of the virtual environment. In this case, you should try to install the required Python packages through your operating system's default package manager.
Expand Down Expand Up @@ -35,6 +35,7 @@ This is the installation process for Predator and all of its dependencies. This
- Optional:
- `psutil`: Required to process disk usage information in management mode and dash-cam mode.
- `lxmf`, `rns`: Required to send offline parking notifications over the Reticulum stack.
- `gpiozero`: Required to trigger events using GPIO inputs.
- System packages: `sudo apt-get install ffmpeg mpg321 gpsd gpsd-clients imagemagick fswebcam`
- Highly recommended:
- `ffmpeg`: Required for audio/video merging in dash-cam mode, and video processing in pre-recorded mode.
Expand Down

0 comments on commit 095c42b

Please sign in to comment.