Skip to content

Commit

Permalink
Merge pull request #539 from kareltucek/common_trunk_upstream
Browse files Browse the repository at this point in the history
Fork merge
  • Loading branch information
mondalaci authored Nov 1, 2022
2 parents f5fffa8 + c8c923c commit 55f4531
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc-dev/reference-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ This file contains (semi)formal documentation of all features of the extended en

Whenever a garbled command is encountered, `ERR` will light up on the display, and details are appended to the error buffer. You can retrieve it by running a `printStatus` macro command over a focused text editor.

Logs are prefixed with macro name, action index and command address.

## Macro events

Macro events allow hooking special behaviour, such as applying specific configuration, to events. This is done via a special naming scheme. Currently, following names are supported:
Expand Down
8 changes: 8 additions & 0 deletions right/src/macros.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ static macro_result_t processDelay(uint32_t time)
if (s->as.actionActive) {
if (Timer_GetElapsedTime(&s->as.delayData.start) >= time) {
s->as.actionActive = false;
s->as.delayData.start = 0;
return MacroResult_Finished;
}
sleepTillTime(s->as.delayData.start + time);
Expand Down Expand Up @@ -1648,6 +1649,11 @@ static macro_result_t processPlayMacroCommand(const char* arg, const char *argEn

static macro_result_t processWriteCommand(const char* arg, const char *argEnd)
{
// todo: clean this up when refactoring write tokenization
while (argEnd > arg && (argEnd[-1] == '\n' || argEnd[-1] == '\r')) {
argEnd--;
}

return dispatchText(arg, argEnd - arg);
}

Expand Down Expand Up @@ -3008,6 +3014,8 @@ static bool loadNextCommand()
return false;
}

memset(&s->as, 0, sizeof s->as);

const char* actionEnd = s->ms.currentMacroAction.cmd.text + s->ms.currentMacroAction.cmd.textLen;
const char* nextCommand = s->ms.currentMacroAction.cmd.text + s->ms.commandEnd;

Expand Down

0 comments on commit 55f4531

Please sign in to comment.