Feature/beam energy#92
Conversation
|
@danielegelhoff13 what is the status of this PR and branch? |
|
@chott24 has made changes to the firmware that need to be updated in this branch. @BaiTian6641 is going to branch off this feature/beam-energy branch to try to incorporate Chase's changes and get this tested and working in parallel. Ideally please work together on this. If one branch is shown to work and be tested and ready for a PR we will use that one and either merge the other or discard. Chase said: FYI the modbus frames have been completely redone. I'll update the dev spec with a more thorough description once I've got the code done. For now, this README is up to date for the firmware changes (as of 2026-03-24) |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd636d2eaa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elif subsystem_name == 'Beam Energy': | ||
| subsystem.update_com_ports(new_com_ports) |
There was a problem hiding this comment.
Invoke Beam Energy COM-port updater
The new Beam Energy branch is currently unreachable because it sits under if hasattr(subsystem, 'update_com_port'), but BeamEnergySubsystem defines update_com_ports (plural) instead. In practice, changing the KnobBox port from the config UI will not reconfigure Beam Energy, so it keeps using the stale serial port until restart. Please either check for update_com_ports here or move the Beam Energy case outside this guard.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed with commit 36051ba.
Note: this issue needs further attention for other subsystems. See Asana task: https://app.asana.com/1/492353873344076/project/1208196184307227/task/1213974761625776?focus=true
| return self.ps_connected | ||
|
|
||
| def handle_disconnect(self, msg=''): | ||
| self.log(f"Disconnect: {msg}", err=True) |
There was a problem hiding this comment.
Pass a supported argument to log()
handle_disconnect calls self.log(..., err=True), but log only accepts (message, level). If a disconnect occurs, this raises TypeError before the disconnect cleanup runs, so the serial handle/state reset path is skipped exactly when it is needed most. Use a LogLevel value (for example LogLevel.ERROR) instead of the unsupported err kwarg.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This is an error in glassman.py, which should have been deleted before codex reviewed the PR. The most recent commit 1b27b5d deletes glassman.py and knob_box.py, which are both unused, old serial drivers.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b27b5d603
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e26d330f3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ae4e5d8ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91b8f72afd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Commit e703087 fixes another reconnection behavior bug (found by Codex): Problem: Backoff is checked in initialize_knob_box_modbus (_next_connect_time), but reconnect workers are still spawned frequently (every poll/update cycle), then immediately return when backoff hasn’t elapsed. That causes repeated thread creation and scheduling churn even during intentional backoff windows. Why it matters: This can still create unnecessary CPU/thread overhead and queue pressure during outages—the same failure mode this series intends to reduce. Fix: Check backoff time remaining before creating a reconnection worker thread. |
|
@bwalkerMIR could you ask codex to do another review when you get a chance? |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be3a4341ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@bwalkerMIR This PR is ready for review and merge. |
Co-authored-by: sbasu107 <[email protected]>
…ignal edges that do not consititue an error (e.g. Arm Beams signal).
… Knob box uses the modbus driver.
…now is cleared if after() schedling fails.
…on is called from both close() AND update_com_ports() paths.
…y conection attempt to avoid losing backoff data and spamming log with connection attempts.
… the 3kV enable switch will now be logged correctly.
…time to expire to spawn. Previously, they would spawn then immediately return very frequently, not respecting backoff.
…eduling a reconnection attempt. Deasserts controller's connected field when polling error.
… message when all these attempts fail in a row.
155c12e to
5002a77
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c68c66562e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ead. Co-authored-by: Copilot <[email protected]>
…M_dashboard into feature/beam-energy
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8d5608b32
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
bwalkerMIR
left a comment
There was a problem hiding this comment.
This is a much needed addition of the Knob Box / Beam Energy subsystem into the dashboard and the code looks good. Codex has reviewed many times and @danielegelhoff13 has patched anything worth patching so far, and we have been left with P2 or lower priority issues. The code has been well tested by @chott24 and @danielegelhoff13 in
With corresponding images from the test here:
Approved.
Description
This PR introduces the Beam Energy subsystem for the EBEAM Dashboard, including the new Beam Energy subpanel UI, Modbus communication with the Knob Box, and logging of errors in the Knob Box operation.
Beam Energy Subpanel
During Operation

Not Connected to Knob Box

Scope of Changes Made
UI: Beam Energy dashboard panel, beam_energy.py
Modbus Communication: knob_box_modbus.py
dashboard.py and main.py were modified to create the Beam Energy subsystem and Knob Box instrument control objects.
Tests Run
A full Knob Box BTest was run to test both the hardware and software functionality together and is documented here:
https://docs.google.com/document/d/1PGchj_ZEUTGBbvStswzUiM31VCPpr_ZamW7ts0TJBkY/edit?tab=t.0#heading=h.g681r5xzzqq7
With corresponding images from the test here:
https://docs.google.com/presentation/d/1L03H2zA92JuW7442mnP7uVDj44vJ63D-VFfa9U56O-w/edit?slide=id.g2b5328b7f44_0_0#slide=id.g2b5328b7f44_0_0