Browse Source

cleaning reset.sh

Uros Stevanovic 9 years ago
parent
commit
930fcdfeac
1 changed files with 44 additions and 41 deletions
  1. 44 41
      reset.sh

+ 44 - 41
reset.sh

@@ -56,7 +56,7 @@ function reset_dma () {
 
 function reset_logic () {
     pci -w 0x9040 80000005
-    sleep .1
+    sleep .2
     pci -w 0x9040 80000201
     sleep .1
 }
@@ -363,46 +363,14 @@ if [ "$SET_4MP" ] && [ "$SET_ROWS" ]; then
     WRONG=YES
 fi
 
-if [ -z "$RESET_CMOSIS" ]; then
-    if [ -z "$RESET_ALL" ]; then
-        if [ "$MODE12b" ]; then
-            WRONG=YES
-        elif [ "$SET_4MP" ] && [ "$SET_ROWS" ]; then
-            WRONG=YES
-        elif [ "$SET_4MP" ]; then
-            set_number_lines $NUM_ROWS
-        elif [ "$SET_ROWS" ]; then
-            set_number_lines $NUM_ROWS
-        elif [ "$SET_SKIP" ]; then
-            set_skip $SKIP_ROWS
-        elif [ "$SET_EXP_TIME" ]; then
-            set_exp_time $EXP_TIME
-        fi
-    fi
-fi
-
-if [ "$WRONG" ]; then
-    echo -e ""
-    echo -e "\e[101m  !!!WRONG ARGUMENT!!!, check reset.sh --help \033[1;m"
-    echo -e ""
-    exit
-fi
-
-if [ "$RESET_DMA" ]; then
-    reset_dma
-fi
-
-if [ "$RESET_LOGIC" ]; then
-    reset_logic
-    set_skip 0
-    if [ -z "$WRONG" ]; then
-      check_status
-    fi
+if [ -z "$RESET_CMOSIS" ] && [ -z "$RESET_ALL" ] && [ "$MODE12b" ]; then
+    WRONG=YES
 fi
 
-if [ "$RESET_CMOSIS" ]; then
+if [ "$RESET_ALL" ] && [ -z "$WRONG" ]; then
     pci -w 9020 e
-    reset_cmosis
+    reset_all
+    reset_dma
     configure_cmosis
     set_number_lines $NUM_ROWS
     set_exp_time $EXP_TIME
@@ -414,12 +382,12 @@ if [ "$RESET_CMOSIS" ]; then
       pci -w 0x91a0 38 
     fi
     check_status
+    exit 0
 fi
 
-if [ "$RESET_ALL" ]; then
+if [ "$RESET_CMOSIS" ] && [ -z "$WRONG" ]; then
     pci -w 9020 e
-    reset_all
-    reset_dma
+    reset_cmosis
     configure_cmosis
     set_number_lines $NUM_ROWS
     set_exp_time $EXP_TIME
@@ -431,4 +399,39 @@ if [ "$RESET_ALL" ]; then
       pci -w 0x91a0 38 
     fi
     check_status
+    exit 0
+fi
+
+if [ "$RESET_DMA" ] && [ -z "$WRONG" ]; then
+    reset_dma
+fi
+
+if [ "$RESET_LOGIC" ] && [ -z "$WRONG" ]; then
+    reset_logic
+    check_status
+fi
+
+if [ -z "$WRONG" ]; then
+    if [ "$SET_4MP" ]; then
+        set_number_lines $NUM_ROWS
+    fi
+
+    if [ "$SET_ROWS" ]; then
+        set_number_lines $NUM_ROWS
+    fi
+
+    if [ "$SET_SKIP" ]; then
+        set_skip $SKIP_ROWS
+    fi
+
+    if [ "$SET_EXP_TIME" ]; then
+        set_exp_time $EXP_TIME
+    fi
+fi
+
+
+if [ "$WRONG" ]; then
+    echo -e ""
+    echo -e "\e[101m  !!!WRONG ARGUMENT!!!, check reset.sh --help \033[1;m"
+    echo -e ""
 fi