BTT belter
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
My collection of useful shell scripts.
|
My collection of useful shell scripts.
|
||||||
|
|
||||||
|
### belter_tension_calculator.sh
|
||||||
|
script to calculate the tension with the readings from [BigTreeTech belter tool](https://bttwiki.com/belter.html) in mm, formula from the xlsx on their [git](https://github.com/bigtreetech/Belter-belt-tension-Tool).
|
||||||
|
|
||||||
### randint.sh
|
### randint.sh
|
||||||
usage: randint \<positive integer\>
|
usage: randint \<positive integer\>
|
||||||
print in the terminal a random integer x with $` 0 \leq x \leq \$1`$
|
print in the terminal a random integer x with $` 0 \leq x \leq \$1`$
|
||||||
@@ -42,4 +45,4 @@ Automatically toggle DNS leak protection for wireguard connections with nftables
|
|||||||
Adds tcp/udp rules to block outgoing traffic to dns port (53) if the outgoing interface isn't the wireguard connection.
|
Adds tcp/udp rules to block outgoing traffic to dns port (53) if the outgoing interface isn't the wireguard connection.
|
||||||
It assumes wireguard connection names start with "wg-"
|
It assumes wireguard connection names start with "wg-"
|
||||||
|
|
||||||
You can check for DNS leaks with [this website](https://www.dnsleaktest.com/)
|
You can check for DNS leaks with [this website](https://www.dnsleaktest.com/)
|
||||||
|
|||||||
42
belter_tension_calculator.sh
Executable file
42
belter_tension_calculator.sh
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if ! [[ "$1" =~ ^-?[0-9](\.[0-9]+)?+$ ]]; then
|
||||||
|
echo "Usage: $0 <Belter display value (mm)>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Belter display value: $1mm"
|
||||||
|
|
||||||
|
tension=$(awk -v x="$1" 'BEGIN {
|
||||||
|
if (x < 0) x = -x
|
||||||
|
printf "%.3f", 7.673640167 * x - 33.7167364
|
||||||
|
}')
|
||||||
|
|
||||||
|
echo "Belt tension: $tension N"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
ESC=$'\033'
|
||||||
|
GREEN="${ESC}[32m"
|
||||||
|
RED="${ESC}[31m"
|
||||||
|
RESET="${ESC}[0m"
|
||||||
|
|
||||||
|
check_range() {
|
||||||
|
local label="$1"
|
||||||
|
local min="$2"
|
||||||
|
local max="$3"
|
||||||
|
|
||||||
|
awk -v t="$tension" -v min="$min" -v max="$max" \
|
||||||
|
-v label="$label" -v G="$GREEN" -v R="$RED" -v Z="$RESET" '
|
||||||
|
BEGIN {
|
||||||
|
if (t >= min && t <= max)
|
||||||
|
printf "%s 🟩 %s[%.1f, %.1f] N%s\n", label, G, min, max, Z
|
||||||
|
else
|
||||||
|
printf "%s 🟥 %s[%.1f, %.1f] N%s\n", label, R, min, max, Z
|
||||||
|
}'
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Reference tensions:"
|
||||||
|
check_range "Voron A/B belts :" 7.8 15
|
||||||
|
check_range "Voron 2.4 Z belts :" 20.4 25.8
|
||||||
|
check_range "V350/250 belts :" 12 20
|
||||||
|
check_range "GT2 belts :" 20 30
|
||||||
|
|
||||||
Reference in New Issue
Block a user