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