-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcreate_preset.sh
executable file
·60 lines (51 loc) · 1.34 KB
/
create_preset.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Exit on error
set -e
# Check if a preset name is provided
if [ -z "$1" ]; then
echo "Usage: $0 \"Preset Name\""
exit 1
fi
# Convert preset name to lowercase and replace spaces with underscores
PRESET_NAME="$1"
FOLDER_NAME=$(echo "$PRESET_NAME" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')
PRESET_DIR="./presets/$FOLDER_NAME"
# Create the preset directory
mkdir -p "$PRESET_DIR/sensor"
# Create the preset-config.yaml file
cat <<EOF > "$PRESET_DIR/preset-config.yaml"
name: "$PRESET_NAME"
author: "Your Name"
description: "Description of $PRESET_NAME."
category: "FPV"
sensor: "" # Set sensor file if needed
status: "Community"
tags: ["$PRESET_NAME"]
files:
wfb.conf:
txpower: "1"
channel: "161"
driver_txpower_override: "20"
stbc: "1"
ldpc: "1"
mcs_index: "1"
fec_k: "8"
fec_n: "12"
telemetry.conf:
serial: /dev/ttyS2
# 2 for msposd
router: 0
majestic.yaml:
fpv.enabled: "true"
fpv.noiseLevel: "0"
system.logLevel: "debug"
video0.codec: "h265"
video0.fps: "60"
video0.bitrate: "4096"
video0.size: "1920x1080"
EOF
# Create an empty sensor file as a placeholder
touch "$PRESET_DIR/sensor/.keep"
# Display success message
echo "✅ Preset '$PRESET_NAME' created successfully in '$PRESET_DIR'"
echo "Edit '$PRESET_DIR/preset-config.yaml' to configure the preset."