Skip to content

Commit

Permalink
clarify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolSpy3 committed Jan 12, 2025
1 parent afaec4d commit 41c62a6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tests/api/controllers/robot_window_html/robot_window_html.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
#define TIME_STEP 32

int main(int argc, char **argv) {
bool configured = false, received = false;
ts_setup(argv[0]);

while (!configured) { // receive message sent by the robot window.
const char *configure_message;
for (;;) { // receive message sent by the robot window.
wb_robot_step(TIME_STEP);
const char *configure_message;
while ((configure_message = wb_robot_wwi_receive_text())) {
if ((configure_message = wb_robot_wwi_receive_text())) {
if (strcmp(configure_message, "configure") == 0) {
configured = true;
wb_robot_wwi_send_text("test wwi functions from robot_window_html controller.");
break;
} else
Expand All @@ -25,14 +23,13 @@ int main(int argc, char **argv) {

printf("CONFIGURED!!!!\n");

while (!received) { // receive message sent by Webots.
const char *test_message;
for (;;) { // receive message sent by Webots.
wb_robot_step(TIME_STEP);
const char *test_message;
while ((test_message = wb_robot_wwi_receive_text())) {
if (strcmp(test_message, "Answer: test wwi functions from robot_window_html controller.") == 0) {
received = true;
if ((test_message = wb_robot_wwi_receive_text())) {
if (strcmp(test_message, "Answer: test wwi functions from robot_window_html controller.") == 0)
break;
} else
else
ts_send_error_and_exit("Wrong test message received from the HTML robot-window: %s", test_message);
}
}
Expand Down

0 comments on commit 41c62a6

Please sign in to comment.