Skip to content

Commit 64ca6a5

Browse files
committed
step control, turn and speed test complete
1 parent 08b2043 commit 64ca6a5

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

manual_tests/motors_calibration_test/motors_calibration_test.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,18 @@ uint8_t key_pressed(const uint8_t* buf, uint8_t len) {
3636
uint8_t count = 0;
3737
switch (buf[0]) {
3838
case 'd':
39-
while (count < 1){
39+
while (count < 10){
4040
print("cycle %d, step %d\n",count+1, step+1);
41-
actuate_motors(period, times, false);
41+
actuate_motors(period, times, false);
4242
count += 1;
43+
step += 1;
4344
}
4445
break;
4546
case 'u':
46-
while (count < 5){
47+
while ((count < 5)&&(step > 0)){
4748
actuate_motors(period, times, true);
4849
count += 1;
49-
step -= 1; //step now underflow here
50+
step -= 1;
5051
}
5152
print("Moving up\n");
5253
break;
@@ -157,10 +158,10 @@ void sensor_reading(){
157158
This function runs the motor for a range of periods (from 50~200 with a increment of 10) but the same times. This is for calibration purposes.
158159
*/
159160
void speed_test(){
160-
uint8_t period = 50;
161-
print("testing with cycles_num %d", times);
162-
for(uint8_t i = 0; i < 15; i = i + 10){
163-
period = period + i;
161+
uint16_t period;
162+
print("testing with cycles_num %d\n", times);
163+
for(uint16_t i = 0; i < 160; i = i + 10){
164+
period = 50 + i;
164165
print("iter %d, period %d\n", (i/10), period);
165166
actuate_motors(period, times, true);
166167
_delay_ms(1000);
@@ -171,11 +172,11 @@ void speed_test(){
171172
This function runs the motor for a range of times (from 5~100 with a increment of 5) but the same period. This is for calibration purposes.
172173
*/
173174
void turn_test(){
174-
uint8_t cycles = 5;
175+
uint16_t cycles;
175176
print("testing with period %d\n", period);
176-
for(uint8_t i = 0; i < 19; i = i + 5){
177-
cycles = cycles + i;
178-
print("iter %d, period %d", (i/5), cycles);
177+
for(uint16_t i = 0; i < 100; i = i + 5){
178+
cycles = 5 + i;
179+
print("iter %d, period %d\n", (i/5), cycles);
179180
actuate_motors(period, cycles, true);
180181
_delay_ms(1000);
181182
}

0 commit comments

Comments
 (0)