diff --git a/Makefile b/Makefile index 1f1fcdd..50a89d3 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/zone3.1/main.c b/zone3.1/main.c index e224e36..032c2e4 100644 --- a/zone3.1/main.c +++ b/zone3.1/main.c @@ -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"}); @@ -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]){ diff --git a/zone3/main.c b/zone3/main.c index 9d2a339..5d4926e 100644 --- a/zone3/main.c +++ b/zone3/main.c @@ -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); @@ -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); } - } + } - } + } - } + } } diff --git a/zone3/owi_sequence.c b/zone3/owi_sequence.c index 5d0bf80..642c572 100644 --- a/zone3/owi_sequence.c +++ b/zone3/owi_sequence.c @@ -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 }, };