Skip to content

Instantly share code, notes, and snippets.

@themactep
Last active October 16, 2023 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themactep/bb013c5c4d49b88c9a66956d058ba9bf to your computer and use it in GitHub Desktop.
Save themactep/bb013c5c4d49b88c9a66956d058ba9bf to your computer and use it in GitHub Desktop.
Manua IR filter control for OpenIPC camera
#!/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