1717# 20140916 BL Do not use fixed number suffix on tacho-motor#
1818# 20141022 BL Add rxc-motor and rxc-led
1919# Adapt to "force motor driver"
20+ # 20141024 BL Temporary "fix" for issue 186 (duty-cycle only if "run")
2021# ============================================================================
2122
2223
@@ -28,7 +29,7 @@ showmotor () {
2829 if [ $motorpower -eq 0 ]; then motorcolor=$brgreen
2930 else motorcolor=$brred
3031 fi
31- printf " ${motorcolor} %3s$brwhite " " ` cat $MOTORPATH /$runfilename ` "
32+ printf " ${motorcolor} %3s$brwhite " " ` cat ${ MOTORPATH} /$runfilename ` "
3233}
3334
3435#
@@ -79,19 +80,22 @@ for m in /sys/class/tacho-motor/motor*
7980 MOTORPATH=" $m "
8081 if [ -e $MOTORPATH ]; then
8182 printf " %-40s %-6s " " ${MOTORPATH} duty_cycle" " status"
82-
8383 # report status before reset
8484 motorpower=` cat ${MOTORPATH} duty_cycle`
8585 printf " $brblue %-6s $brwhite %3s " " before" " ` showmotor duty_cycle` "
86-
87- # # echo to duty_cycle DOES not work????? so set command to coast
88- # echo "coast" > ${MOTORPATH}command
89-
86+ # echo "DEBUG Running in dir `pwd` MOTORPATH=${MOTORPATH}"
87+ #
88+ # echo duty_cycle only accepted if command=run: ISSUE 186
89+ #
90+ prevcommand=` cat ${MOTORPATH} command`
91+ echo " run" > ${MOTORPATH} command
9092 # set back to zero:
91- echo -100 > " ${MOTORPATH} duty_cycle"
92- echo 0 > " ${MOTORPATH} duty_cycle"
93+ echo 0 > " ${MOTORPATH} duty_cycle"
94+ # set command back:
95+ echo $prevcommand > ${MOTORPATH} command
9396
9497 # report status after reset
98+ # echo "DEBUG Running in dir `pwd` MOTORPATH=${MOTORPATH}"
9599 motorpower=` cat ${MOTORPATH} duty_cycle`
96100 printf " $brblue %-6s $brwhite %-3s\n" " after" " ` showmotor duty_cycle` "
97101 fi
0 commit comments