proper comments, less lines, everything works

This commit is contained in:
Shihaam Abdul Rahman 2024-09-17 14:17:58 +05:00
parent 53663d8304
commit bc7cdff069
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636

85
remote
View File

@ -32,14 +32,16 @@ select_device() {
case "$1" in case "$1" in
fan) fan)
open_menu open_menu
sleep 0.4 sleep 0.4 # wait for menu to settle
tap 60 200 tap 60 200 # Select Fan from the list
;; # Fan from the list sleep 0.4 # wait for menu to disappear
;;
ac) ac)
open_menu open_menu
sleep 0.4 sleep 0.4 # wait for menu to settle
tap 60 300 tap 60 300 # Select AC from the list
;; # AC from the list sleep 0.4 # Wait for menu to disappear
;;
esac esac
} }
@ -53,24 +55,18 @@ show_main_menu() {
read -n 1 -p "Enter your choice: " choice read -n 1 -p "Enter your choice: " choice
case $choice in case $choice in
1) 1) select_device fan # Select Fan
select_device fan # Select Fan fan_menu "Fan"
sleep 0.5 ;;
fan_menu "Fan" 2) select_device ac
;; ac_menu "AC"
2) ;;
select_device ac # Select AC (adjust coordinates as needed) x|X) exit 0
sleep 0.5 ;;
ac_menu "AC" *) echo ""
;; echo "Invalid choice. Try Again..."
x|X) sleep 0.5
exit 0 show_main_menu ;;
;;
*)
echo "Invalid choice. Press Enter to continue..."
read
show_main_menu
;;
esac esac
} }
fan_menu() { fan_menu() {
@ -85,16 +81,19 @@ fan_menu() {
read -n 1 -p "Enter your choice: " choice read -n 1 -p "Enter your choice: " choice
case $choice in case $choice in
1) tap 100 250 1) tap 100 250 # Fan On/Off button
fan_menu ;; fan_menu ;;
2) tap 950 260 2) tap 950 260 ## Occilation On/Off Button
fan_menu ;; fan_menu ;;
3) tap 540 1200 3) tap 540 1200 ## Fan Speed button
fan_menu ;; fan_menu ;;
4) tap 540 1400 4) tap 540 1400 ## Fan Mode button
fan_menu ;; fan_menu ;;
x|X) show_main_menu ;; x|X) show_main_menu ;;
*) echo "Invalid choice. Try Again..."; sleep 0.5; fan_menu ;; *) echo ""
echo "Invalid choice. Try Again..."
sleep 0.5
fan_menu ;;
esac esac
} }
@ -111,18 +110,20 @@ ac_menu() {
read -n 1 -p "Enter your choice: " choice read -n 1 -p "Enter your choice: " choice
case $choice in case $choice in
1) tap 170 400 ## AC ON/OFF button 1) tap 170 400 ## AC On/Off button
ac_menu ;; ac_menu ;;
2) tap 950 400 ## AC Mode Button 2) tap 950 400 ## AC Mode Button
ac_menu ;; ac_menu ;;
3) tap 170 1200 ## Fan Speed 3) tap 170 1200 ## AC Fan Speed
ac_menu ;; ac_menu ;;
-|_) tap 360 1053 ## temp - button -|_) tap 360 1053 ## temp - button
ac_menu ;; ac_menu ;;
+|=) tap 710 1053 ## temp + button +|=) tap 710 1053 ## temp + button
ac_menu ;; ac_menu ;;
x|X) show_main_menu ;; x|X) show_main_menu ;;
*) echo "Invalid choice. Try Again..."; sleep 0.5; ac_menu ;; *) echo ""
echo "Invalid choice. Try Again..."
sleep 0.5; ac_menu ;;
esac esac
} }