Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 33:836ab2089565, committed 2018-05-23
- Comitter:
- Helvis
- Date:
- Wed May 23 12:30:39 2018 +0000
- Parent:
- 32:e984b7959cb0
- Child:
- 34:0587c0943263
- Commit message:
- Challenge Day
Changed in this revision
| Motion.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Motion.cpp Wed May 23 01:34:36 2018 +0000
+++ b/Motion.cpp Wed May 23 12:30:39 2018 +0000
@@ -153,6 +153,10 @@
if (distanceC < 100.0f && lastMove == false) {
break;
+ }else if ( ((countsL - countsLOld) >= 824 || (countsR - countsROld) <= -824) && (distanceC >= 100.0f) && (distanceC < 120.0f) ) {
+ countsLOld += 100;
+ countsROld -= 100;
+
//Stop after certain distance if side wall missing
}else if ( (distanceL > 80.0f || distanceR > 80.0f) && lastMove == false && deceleration == true && distanceC < 190.0f) {
@@ -162,7 +166,7 @@
countsL = counterLeft.read();
countsR = counterRight.read();
- while ((countsL - countsLOld) < 300.0f || (countsR - countsROld) > -300.0f) {
+ while ((countsL - countsLOld) < 250.0f || (countsR - countsROld) > -250.0f) {
countsL = counterLeft.read();
countsR = counterRight.read();
accel(RUN_SPEED);
@@ -524,7 +528,7 @@
longMove = true;
deceleration = false;
- }else if (reverse == false && path[task+1] == path[task] && ( path[task-1] != path[task] || task == 0) ) { //same as above, also if start field
+ }else if (reverse == false && path[task+1] == path[task] && ( path[task-1] != path[task] || task == 0 || path[task-1] != 4) ) { //same as above, also if start field
acceleration = true;
longMove = true;
--- a/main.cpp Wed May 23 01:34:36 2018 +0000
+++ b/main.cpp Wed May 23 12:30:39 2018 +0000
@@ -159,6 +159,8 @@
motion.scanMove();
}else if (route[r] == RIGHT) {
+
+ int lastJunc = route[junction[j]];
// Kreuzung führt zu Sackgassen -> löschen
junction[j] = 0;
printf("Kreuzung %d Schritt %d geloscht\n", j, r);
@@ -206,7 +208,7 @@
looping = true;
- }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE) {
+ }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE && lastJunc == MOVE) {
route[r] = 0;
r--;
@@ -257,6 +259,8 @@
}else if (route[r] == MOVE) {
+ int lastJunc = route[junction[j]];
+
junction[j] = 0;
if (debuging == 1) printf("Kreuzung %d Schritt %d geloscht\n", j, r);
j -= 1;
@@ -302,7 +306,7 @@
looping = true;
- }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE) {
+ }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE && lastJunc == MOVE) {
route[r] = 0;
r--;
