Skip to content

Commit

Permalink
Pre-update 2.1.1 : Fix regression in zone3/main.c
Browse files Browse the repository at this point in the history
  • Loading branch information
cgarlati committed Sep 16, 2021
1 parent 572ce05 commit dceb40f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ all: clean
$(MAKE) -C zone1
$(MAKE) -C zone2
$(MAKE) -C zone3
$(MAKE) -C zone3.1
# $(MAKE) -C zone3.1
$(MAKE) -C zone4
$(MAKE) -C bsp/$(BOARD)/boot
java -jar multizone.jar \
Expand Down
10 changes: 5 additions & 5 deletions zone3.1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void msg_handler_task( void *pvParameters ){ // msg_handler_task
char msg[16]; memcpy(msg, (const char *)inbox, sizeof msg);
taskEXIT_CRITICAL();

if (strncmp("ping", msg, sizeof msg)==0){
if (strcmp("ping", msg)==0){

MZONE_SEND(zone1, (char [16]){"pong"});

Expand All @@ -137,19 +137,19 @@ void msg_handler_task( void *pvParameters ){ // msg_handler_task

else if (!owi_sequence_is_running()){

if (strncmp("start", msg, sizeof msg) == 0) {
if (strcmp("start", msg) == 0) {
owi_sequence_start(MAIN);
vTaskResume(robot_seq_task_handle);

} else if (strncmp("fold", msg, sizeof msg) == 0) {
} else if (strcmp("fold", msg) == 0) {
owi_sequence_start(FOLD);
vTaskResume(robot_seq_task_handle);

} else if (strncmp("unfold", msg, sizeof msg) == 0) {
} else if (strcmp("unfold", msg) == 0) {
owi_sequence_start(UNFOLD);
vTaskResume(robot_seq_task_handle);

} else {
} else if (strnlen(msg, sizeof msg)==1){

// Manual single-command adjustments
switch (msg[0]){
Expand Down
48 changes: 25 additions & 23 deletions zone3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,15 @@ __attribute__(( interrupt())) void trap_handler(void){

void msg_handler(const char *msg){

if (strcmp("ping", msg)==0){
MZONE_SEND(1, (char[16]){"pong"});
if (strcmp("ping", msg) == 0) {
MZONE_SEND(1, (char[16]){"pong"});

} else if (usb_state==0x12670000 && man_cmd==CMD_STOP){
} else if (usb_state == 0x12670000 && man_cmd == CMD_STOP) {

if (strcmp("stop", msg)==0) owi_sequence_stop_req();
if (strcmp("stop", msg) == 0)
owi_sequence_stop_req();

else if (!owi_sequence_is_running()){
else if (!owi_sequence_is_running()) {

if (strcmp("start", msg) == 0) {
owi_sequence_start(MAIN);
Expand All @@ -198,35 +199,36 @@ void msg_handler(const char *msg){

} else if (strcmp("unfold", msg) == 0) {
owi_sequence_start(UNFOLD);
timer_set(0, 0);}
timer_set(0, 0);

} else if (strnlen(msg, sizeof msg)==1){

} else {

// Manual single-command adjustments
switch (msg[0]){
case 'q' : man_cmd = 0x000001; break; // grip close
case 'a' : man_cmd = 0x000002; break; // grip open
case 'w' : man_cmd = 0x000004; break; // wrist up
case 's' : man_cmd = 0x000008; break; // wrist down
case 'e' : man_cmd = 0x000010; break; // elbow up
case 'd' : man_cmd = 0x000020; break; // elbow down
case 'r' : man_cmd = 0x000040; break; // shoulder up
case 'f' : man_cmd = 0x000080; break; // shoulder down
case 't' : man_cmd = 0x000100; break; // base clockwise
case 'g' : man_cmd = 0x000200; break; // base counterclockwise
case 'y' : man_cmd = 0x010000; break; // light on
switch (msg[0]) {
case 'q': man_cmd = 0x000001; break; // grip close
case 'a': man_cmd = 0x000002; break; // grip open
case 'w': man_cmd = 0x000004; break; // wrist up
case 's': man_cmd = 0x000008; break; // wrist down
case 'e': man_cmd = 0x000010; break; // elbow up
case 'd': man_cmd = 0x000020; break; // elbow down
case 'r': man_cmd = 0x000040; break; // shoulder up
case 'f': man_cmd = 0x000080; break; // shoulder down
case 't': man_cmd = 0x000100; break; // base clockwise
case 'g': man_cmd = 0x000200; break; // base counterclockwise
case 'y': man_cmd = 0x010000; break; // light on
}

if (man_cmd != CMD_STOP){
if (man_cmd != CMD_STOP) {
spi_rw(man_cmd);
timer_set(1, MZONE_RDTIME() + MAN_CMD_TIME);
}

}
}

}
}

}
}

}

Expand Down
2 changes: 1 addition & 1 deletion zone3/owi_sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static struct sequence_step main_sequence[] = {
{ .command = BASE_COUNTERCLK, .duration_ms = T_BASE },
{ .command = BASE_COUNTERCLK, .duration_ms = T_ARM * 80/100}, // 80%
{ .command = ARM_UP, .duration_ms = T_ARM * 105/100}, // 105%
{ .command = ELBOW_UP, .duration_ms = T_ARM * 10/100}, // 10%
{ .command = ELBOW_UP, .duration_ms = T_ARM * 5/100}, // 5%
{ .command = WRIST_DWN, .duration_ms = T_WRIST * 80/100}, // 80%
{ .command = GRIP_OPEN, .duration_ms = T_GRIP },
};
Expand Down

0 comments on commit dceb40f

Please sign in to comment.