Skip to content

Fetch the image and its RAW region under one buffer lock - #44

Merged
mikelangmayr merged 2 commits into
mainfrom
mike/raw-image-pair-fetch
Sep 30, 2026
Merged

mikelangmayr merged 2 commits into
mainfrom
mike/raw-image-pair-fetch

Conversation

@mikelangmayr

Copy link
Copy Markdown
Contributor
  • read_frame locked, fetched and unlocked in one call, so fetching the image and the RAW region meant two locks with a window between them where a new frame could land, leaving the two halves describing different exposures
  • Splits the fetch body out behind lock_newest_buffer and fetch_region, leaving read_frame behaving exactly as before
  • Adds raw pair, which holds one lock across both fetches and dispatches them with the same frame number
  • It reads whatever buffer is newest rather than triggering an exposure, so it also reads out a frame the controller already holds
  • Refuses when the mode has more than one detector, rather than dispatching part of a frame
  • Verified on the emulator, and against an Archon where it wrote a 8256x4120 image and its matched raw capture, both carrying frame 24

Comment thread camerad/archon_controller.cpp Outdated
char* raw_cursor = raw_buffer.get();
if (error == NO_ERROR) error = this->fetch_region(FRAME_RAW, raw_cursor);

const long unlock_error = this->unlock_buffer();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we first check if (error == NO_ERROR) before attempting to unlock the buffer?

@mikelangmayr mikelangmayr Sep 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, done. UNLOCK after a failed fetch would eat the unread block data as its reply, and the next LOCKn replaces the lock anyway.

@mikelangmayr
mikelangmayr merged commit ba3f792 into main Sep 30, 2026
2 of 6 checks passed
@mikelangmayr
mikelangmayr deleted the mike/raw-image-pair-fetch branch September 30, 2026 23:53
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.

2 participants