Skip to content

Commit dd127ac

Browse files
committed
change due to kernel 3.16.1
brightness since kernel 3.16.1 is honored and no longer a switch new attribute encoder_mode
1 parent 7c1806a commit dd127ac

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

setled

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Description : Set an EV3-led
55
# Version : v1.1
66
# Date : 2014-08-26
7-
# Usage : ./setled
7+
# Usage : setled
88
# Notes : 4 optional parameters:
99
# color [side [ON | OFF [valid MODE]]]
1010
# Copyright : 2014 Bert Lindeman
@@ -15,6 +15,9 @@
1515
# Changelog
1616
# Date By Description
1717
# 20140826 BL add script header
18+
# 20140910 BL Set ON to a higher value than 1
19+
# brightness since kernel 3.16.1 is honoured
20+
# and no longer a switch
1821
#
1922
#============================================================================
2023

@@ -99,10 +102,10 @@ verifyLEDtrigger () {
99102

100103
case $mode in
101104
on)
102-
command="echo"; oneORzero=1
105+
command="echo"; valueORzero=127
103106
;;
104107
off)
105-
command="echo"; oneORzero=0
108+
command="echo"; valueORzero=0
106109
;;
107110
"")
108111
command="cat" # default
@@ -165,7 +168,7 @@ verifyLEDtrigger () {
165168
fi
166169
# showLEDtrigger $ledtriggerpath
167170

168-
echo $oneORzero > $ledbrightness
171+
echo $valueORzero > $ledbrightness
169172
if [ $? -ne 0 ]; then
170173
echo -e "!!!!!!!!returncode of command: $?"
171174
fi

testmotor

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Script_name : testmotor
33
# Author : Bert Lindeman
44
# Description : Fiddle a bit with a connected motor
5-
# Version : v1.1
5+
# Version : v1.2
66
# Date : 2014-08-26
77
# Usage : testmotor
88
# Notes : One parameter (optional): the number of the tacho-motor
@@ -16,6 +16,8 @@
1616
# Date By Description
1717
# 20140826 BL o add script header
1818
# o check for missing or too many argument(s)
19+
# 20140914 BL o Add new attribute (3.16.1) encoder_mode
20+
# o small cleanup
1921
#
2022
#============================================================================
2123

@@ -33,33 +35,42 @@ fi
3335
showStateS () {
3436
for (( i=1; i<=5; i++ ))
3537
do
36-
printf "%16s: %6d " "$DUTY_SP_VAR" " `cat $MOTORPATH/$DUTY_SP_VAR`"
37-
printf "%10s: %10s " "state" "`cat $MOTORPATH/state`"
38-
printf "%10s: %6d " "position" " `cat $MOTORPATH/position`"
39-
printf "%17s: %6d\n" "pulses_per_second" " `cat $MOTORPATH/pulses_per_second`"
38+
printf "%14s: %5d " "duty_cycle_sp" "`cat $MOTORPATH/duty_cycle_sp`"
39+
printf "%8s: %10s " "state" "`cat $MOTORPATH/state`"
40+
printf "%12s: %9s " "encoder_mode" "`cat $MOTORPATH/encoder_mode`"
41+
printf "%18s: %6d " "position" "`cat $MOTORPATH/position`"
42+
printf "%16s: %6d\n" "pulses_per_second" "`cat $MOTORPATH/pulses_per_second`"
4043
sleep 0.2
4144
done
4245
}
4346

4447
echo "Working with motorpath: $MOTORPATH"
4548
if [ -e $MOTORPATH/ ]; then
46-
DUTY_SP_VAR=duty_cycle_sp
49+
echo 1 > $MOTORPATH/reset
50+
## DUTY_SP_VAR=duty_cycle_sp
4751
echo -e "\t\t==== regulation_mode OFF"
4852
echo off > $MOTORPATH/regulation_mode
49-
echo 0 > $MOTORPATH/$DUTY_SP_VAR
53+
echo 0 > $MOTORPATH/duty_cycle_sp
5054
echo 1 > $MOTORPATH/run
5155
showStateS
5256
sleep 0.1
53-
echo 25 > $MOTORPATH/$DUTY_SP_VAR
57+
echo 25 > $MOTORPATH/duty_cycle_sp
5458
showStateS
5559
sleep 0.7
56-
echo 50 > $MOTORPATH/$DUTY_SP_VAR
60+
echo -e "\t\t==== encoder_mode inverted "
61+
echo inverted > $MOTORPATH/encoder_mode
5762
showStateS
5863
sleep 0.7
59-
echo -50 > $MOTORPATH/$DUTY_SP_VAR
64+
echo 50 > $MOTORPATH/duty_cycle_sp
6065
showStateS
61-
echo -e "\t\t==== regulation_mode ON"
66+
sleep 0.7
67+
echo -e "\t\t==== duty_cycle_sp to negative "
68+
echo -50 > $MOTORPATH/duty_cycle_sp
69+
showStateS
70+
echo -e "\t\t==== regulation_mode ON || duty_cycle_sp to zero encoder_mode normal "
71+
echo normal > $MOTORPATH/encoder_mode
6272
echo on > $MOTORPATH/regulation_mode
73+
echo 0 > $MOTORPATH/duty_cycle_sp
6374
sleep 0.2
6475
showStateS
6576
echo 500 > $MOTORPATH/pulses_per_second_sp

0 commit comments

Comments
 (0)