Last active
October 16, 2023 00:53
-
-
Save themactep/bb013c5c4d49b88c9a66956d058ba9bf to your computer and use it in GitHub Desktop.
Manua IR filter control for OpenIPC camera
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pin1=$(cli -g .nightMode.irCutPin1) | |
pin2=$(cli -g .nightMode.irCutPin2) | |
if [ -z "$pin1" ]; then | |
echo "IRCUT pin 1 is not set!" | |
echo "Please set it by running cli -s .nightMode.irCutPin1 XX, where XX is a GPIO pin number." | |
exit 1 | |
fi | |
if [ -z "$pin2" ]; then | |
echo "IRCUT pin 2 is not set!" | |
echo "Please set it by running cli -s .nightMode.irCutPin2 XX, where XX is a GPIO pin number." | |
exit 1 | |
fi | |
gpio clear $pin1 | |
gpio clear $pin2 | |
usleep 10000 | |
case "$1" in | |
0|off) | |
gpio set $pin1 | |
gpio clear $pin2 | |
;; | |
1|on) | |
gpio clear $pin1 | |
gpio set $pin2 | |
;; | |
*) | |
echo "Parameter is either 0/off, or 1/on." | |
exit 2 | |
esac | |
usleep 10000 | |
gpio clear $pin1 | |
gpio clear $pin2 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment