Skip to content

Commit

Permalink
Removed unnecessary cache queue for managing PLR feature (#2820)
Browse files Browse the repository at this point in the history
  • Loading branch information
digant73 committed Oct 31, 2023
1 parent a19a095 commit c59153a
Show file tree
Hide file tree
Showing 20 changed files with 314 additions and 331 deletions.
27 changes: 11 additions & 16 deletions TFT/src/User/API/Gcode/gcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

REQUEST_COMMAND_INFO requestCommandInfo = {0};

bool isWaitingResponse(void)
void waitForResponse(void)
{
return (!requestCommandInfo.done);
TASK_LOOP_WHILE(!requestCommandInfo.done);
}

bool requestCommandInfoIsRunning(void)
Expand Down Expand Up @@ -51,7 +51,7 @@ static void resetRequestCommandInfo(
if (string_error2)
requestCommandInfo.error_num = 3;

loopProcessToCondition(&isNotEmptyCmdQueue); // wait for the communication to be clean before requestCommand
TASK_LOOP_WHILE(isNotEmptyCmdQueue()); // wait for the communication to be clean

requestCommandInfo.stream_handler = NULL;
requestCommandInfo.inWaitResponse = true;
Expand Down Expand Up @@ -80,8 +80,7 @@ void detectAdvancedOk(void)
// send any gcode replied by the mainboard with a regular OK response ("ok\n") or an ADVANCED_OK response (e.g. "ok N10 P15 B3\n")
mustStoreCmd("M220\n");

// Wait for response
loopProcessToCondition(&isWaitingResponse);
waitForResponse(); // wait for response

while (requestCommandInfo.cmd_rev_buf[cmd_index] != '\0')
{
Expand Down Expand Up @@ -117,8 +116,7 @@ bool request_M21(void)

mustStoreCmd((infoMachineSettings.multiVolume == ENABLED) ? ((infoFile.onboardSource == BOARD_SD) ? "M21 S\n" : "M21 U\n") : "M21\n");

// Wait for response
loopProcessToCondition(&isWaitingResponse);
waitForResponse(); // wait for response

clearRequestCommandInfo();

Expand All @@ -139,8 +137,7 @@ char * request_M20(void)
else
mustStoreCmd("M20\n");

// Wait for response
loopProcessToCondition(&isWaitingResponse);
waitForResponse(); // wait for response

//clearRequestCommandInfo(); // shall be call after copying the buffer ...
return requestCommandInfo.cmd_rev_buf;
Expand All @@ -165,8 +162,7 @@ char * request_M33(const char * filename)
else
mustStoreCmd("M33 %s\n", filename);

// Wait for response
loopProcessToCondition(&isWaitingResponse);
waitForResponse(); // wait for response

//clearRequestCommandInfo(); // shall be call after copying the buffer
return requestCommandInfo.cmd_rev_buf;
Expand Down Expand Up @@ -217,8 +213,7 @@ long request_M23_M36(const char * filename)
sizeTag = "size\":"; // reprap firmware reports size JSON
}

// Wait for response
loopProcessToCondition(&isWaitingResponse);
waitForResponse(); // wait for response

if (requestCommandInfo.inError)
{
Expand Down Expand Up @@ -300,12 +295,12 @@ void request_M98(const char * filename)
mustStoreCmd(command);

// prevent a race condition when rrfStatusQuery returns !busy before executing the macro
TASK_LOOP_WHILE(isEnqueued(command))
TASK_LOOP_WHILE(isEnqueued(command));

rrfStatusQueryFast();

// Wait for macro to complete
loopProcessToCondition(&rrfStatusIsBusy);
TASK_LOOP_WHILE(rrfStatusIsBusy());

rrfStatusQueryNormal();
}
Expand All @@ -318,5 +313,5 @@ void request_M20_rrf(const char * nextdir, bool with_ts, FP_STREAM_HANDLER handl

mustStoreCmd("M20 S%d P\"/%s\"\n", with_ts ? 3 : 2, nextdir);

loopProcessToCondition(&isWaitingResponse);
waitForResponse(); // wait for response
}
1 change: 0 additions & 1 deletion TFT/src/User/API/Gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ typedef struct

extern REQUEST_COMMAND_INFO requestCommandInfo;

bool isWaitingResponse(void); // condition callback for loopProcessToCondition()
bool requestCommandInfoIsRunning(void);
void clearRequestCommandInfo(void);

Expand Down
Loading

0 comments on commit c59153a

Please sign in to comment.