initial commit
[ETG_Helmet] / SOFTWARE / OMEGA2 / mode.sh
1 #/bin/bash
2
3 if [ "$TMPFS" == "" ]; then 
4         . "common.sh"
5 fi
6
7 echo $$ > $PID/$0
8
9 # ------------------------------------- get here after reboot --------------------
10
11 if [ ! -s "mode" ]; then 
12         echo 'f' > mode
13 fi  
14
15 buttonHold=$(( $(./fast-gpio mread $KBD_MASK) ))
16
17 case $buttonHold in
18
19                 "$KBD_MIC") # ----------------------- leader --------------------------
20
21                         playRoboMessage "Leader mode activating"
22                         leaderMode
23                         playRoboMessage "Leader mode activated"
24                 ;;
25
26 #               "$(( $KBD_MIC ^ $KBD_WIFI ))")
27                 "$KBD_WIFI") # ----------------------- service --------------------------
28
29                         playRoboMessage "Service mode activating"
30                         serviceMode
31                         sleep 5
32                         playRoboMessage "Service mode activated"
33                         playRoboMessage "Keep holding WiFi button to check for complete firmware upgrade avaliability."
34                 ;;
35
36                 *) # ----------------------- follower --------------------------
37
38                         MODE=$(cat mode)
39
40                         if [ "$MODE" != "l" ]; then 
41
42                                 myLog "Follower mode activating"
43                                 followingMode
44                                 myLog "Follower mode activated"
45                         else 
46                                 myLog "Leader mode remain"
47                                 led wifi perm
48                         fi 
49                 ;;
50
51 esac
52
53 echo 1 > "$wifiState"
54
55
56
57
Contact me: dev (at) shalnoff (dot) com
PGP fingerprint: A6B8 3B23 6013 F18A 0C71 198B 83D8 C64D 917A 5717