Fix typo
This commit is contained in:
parent
054e61e7c8
commit
a1e53f0871
@ -140,6 +140,7 @@ int trial_check_input(trial *t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int trial_wait_for_input(trial *t) {
|
int trial_wait_for_input(trial *t) {
|
||||||
|
if (t->parse_ctx->buffer->len) return trial_check_input(t);
|
||||||
ssize_t len = read(t->socket, buffer, sizeof(buffer));
|
ssize_t len = read(t->socket, buffer, sizeof(buffer));
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
fprintf(stderr, "read error: %s\n", strerror(errno));
|
fprintf(stderr, "read error: %s\n", strerror(errno));
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
typedef enum { RUN_ERROR, RUN_DONE, RUN_GO_ON, RUN_FINISHED } run_t;
|
typedef enum { RUN_ERROR, RUN_DONE, RUN_GO_ON, RUN_FINISHED } run_t;
|
||||||
|
|
||||||
typedef enum { ACCEL, ROLL, BREAK } accel_t;
|
typedef enum { ACCEL, ROLL, BRAKE } accel_t;
|
||||||
typedef enum { TURN_HARD_LEFT, TURN_LEFT, TURN_STRAIGHT, TURN_RIGHT, TURN_HARD_RIGHT } turn_t;
|
typedef enum { TURN_HARD_LEFT, TURN_LEFT, TURN_STRAIGHT, TURN_RIGHT, TURN_HARD_RIGHT } turn_t;
|
||||||
|
|
||||||
typedef enum { BOLDER, CRATER, MARTIAN } object_t;
|
typedef enum { BOLDER, CRATER, MARTIAN } object_t;
|
||||||
@ -118,7 +118,7 @@ INLINE void vehicle_accel(trial *t) {
|
|||||||
switch (t->vehicle.accel) {
|
switch (t->vehicle.accel) {
|
||||||
case ACCEL: return;
|
case ACCEL: return;
|
||||||
case ROLL: SENDCMD(t, "a;"); break;
|
case ROLL: SENDCMD(t, "a;"); break;
|
||||||
case BREAK: SENDCMD(t, "a;a;"); break;
|
case BRAKE: SENDCMD(t, "a;a;"); break;
|
||||||
}
|
}
|
||||||
t->vehicle.accel = ACCEL;
|
t->vehicle.accel = ACCEL;
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ INLINE void vehicle_roll(trial *t) {
|
|||||||
switch (t->vehicle.accel) {
|
switch (t->vehicle.accel) {
|
||||||
case ACCEL: SENDCMD(t, "b;"); break;
|
case ACCEL: SENDCMD(t, "b;"); break;
|
||||||
case ROLL: return;
|
case ROLL: return;
|
||||||
case BREAK: SENDCMD(t, "a;"); break;
|
case BRAKE: SENDCMD(t, "a;"); break;
|
||||||
}
|
}
|
||||||
t->vehicle.accel = ROLL;
|
t->vehicle.accel = ROLL;
|
||||||
}
|
}
|
||||||
@ -134,9 +134,9 @@ INLINE void vehicle_break(trial *t) {
|
|||||||
switch (t->vehicle.accel) {
|
switch (t->vehicle.accel) {
|
||||||
case ACCEL: SENDCMD(t, "b;b;"); break;
|
case ACCEL: SENDCMD(t, "b;b;"); break;
|
||||||
case ROLL: SENDCMD(t, "b;"); break;
|
case ROLL: SENDCMD(t, "b;"); break;
|
||||||
case BREAK: return;
|
case BRAKE: return;
|
||||||
}
|
}
|
||||||
t->vehicle.accel = BREAK;
|
t->vehicle.accel = BRAKE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void vehicle_hard_left(trial *t) {
|
INLINE void vehicle_hard_left(trial *t) {
|
||||||
|
@ -477,7 +477,7 @@ _match:
|
|||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
#line 90 "control_parser.rl"
|
#line 90 "control_parser.rl"
|
||||||
{ ctx->tm->vehicle.accel = BREAK; }
|
{ ctx->tm->vehicle.accel = BRAKE; }
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
#line 92 "control_parser.rl"
|
#line 92 "control_parser.rl"
|
||||||
|
@ -87,7 +87,7 @@ static timestamp extract_ts(context *ctx, char *fpc) {
|
|||||||
ctl = (
|
ctl = (
|
||||||
"a" @ { ctx->tm->vehicle.accel = ACCEL; }
|
"a" @ { ctx->tm->vehicle.accel = ACCEL; }
|
||||||
| "-" @ { ctx->tm->vehicle.accel = ROLL; }
|
| "-" @ { ctx->tm->vehicle.accel = ROLL; }
|
||||||
| "b" @ { ctx->tm->vehicle.accel = BREAK; }
|
| "b" @ { ctx->tm->vehicle.accel = BRAKE; }
|
||||||
) (
|
) (
|
||||||
"L" @ { ctx->tm->vehicle.turn = TURN_HARD_LEFT; }
|
"L" @ { ctx->tm->vehicle.turn = TURN_HARD_LEFT; }
|
||||||
| "l" @ { ctx->tm->vehicle.turn = TURN_LEFT; }
|
| "l" @ { ctx->tm->vehicle.turn = TURN_LEFT; }
|
||||||
|
Loading…
Reference in New Issue
Block a user