Skip to content

Send 'Sequence completed in N ms' message at trial end#1

Open
mbreiser wants to merge 1 commit into
floesche:mainfrom
mbreiser:fix/trial-end-completion-message
Open

Send 'Sequence completed in N ms' message at trial end#1
mbreiser wants to merge 1 commit into
floesche:mainfrom
mbreiser:fix/trial-end-completion-message

Conversation

@mbreiser
Copy link
Copy Markdown

Summary

  • The host wrapper PanelsController.trialParams() with waitForEnd=true waits for an end-of-trial response whose payload matches \"Sequence completed in N ms\". The previous empty-string response caused that path to time out and return false even when the trial ran successfully.
  • This change fills in the formatted message at both end-of-trial sites in serviceDisplay() (PLAYING_PATTERN and ANALOG_CLOSED_LOOP), using a 40-byte stack buffer and snprintf.
  • runtime_duration_ms_ is uint32_t (CommandProcessor.h:51); cast to unsigned long for %lu portability.

Why

On a fresh bring-up of a 2×12 arena from macOS using maDisplayTools examples/oldButFunctional/G41_Modes_Demo.m, both mode 2 and mode 3 trials played correctly on the panels but trialParams() returned false. Tracing showed the host's expectResponse inner call (PanelsController.m:631) waiting up to deciSec/10 + 1 seconds for the formatted completion string and never matching against the empty payload.

Compatibility

  • The YAML/CommandExecutor experiment-runner path uses trialParams(..., waitForEnd=false), which only consumes the immediate ACK and never reads the end-of-trial message (CommandExecutor.m:139,153,168). That path is unchanged by this PR — we still send a TRIAL_PARAMS_CMD response, just with non-empty payload.
  • No new include needed; snprintf is already used in NetworkManager.cpp:24,28.

Test plan

  • Verified on hardware: rebuilt with pio run -e teensy41-printf -t upload, uploaded to a Teensy 4.1 connected to a 2×12 arena, ran examples/oldButFunctional/G41_Modes_Demo.m mode 2 and mode 3 against IP 10.102.40.124.
  • Both trials play visibly and Result: true returns within the expected duration.
  • (Reviewer) Cross-check that no expectResponse consumer is sensitive to the longer payload size (29-byte string + 3-byte header = 32 bytes vs 3 bytes previously).

🤖 Generated with Claude Code

The maDisplayTools host wrapper PanelsController.trialParams() with
waitForEnd=true expects to match this exact message text after the
trial finishes. The previous empty-string response caused the host to
time out and return false even when the trial ran successfully.

Affects PLAYING_PATTERN and ANALOG_CLOSED_LOOP end-of-trial paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant