Fix equipment readings 404 errors and implement BK Precision protocol support #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes equipment readings returning 404 Not Found errors and implements proper protocol support for BK Precision 1900B series power supplies.
Problems Fixed
1. Equipment 404 Errors
404 Not Founderrors when trying to access equipment readings after reconnection2. Invalid VISA Session Errors
3. BK Precision Communication Failures
4. Serial Port Resource Leaks
NoneTypeerrors5. Response Buffer Contamination
\r, leavingOK\rin bufferChanges Made
Deterministic Equipment IDs
ASRL/dev/ttyUSB0::INSTR→ps_56fdd3df)Auto-Reconnection System
_is_instrument_valid()to detect invalid VISA sessions_ensure_connected()to auto-reconnect on invalid sessions_is_resource_manager_valid()to detect invalid resource managers_refresh_resource_manager()to create new resource manager when needed_write(),_query(), and_query_binary()operationsBK Precision Protocol Support
\r\nto\ronlyGMAX- Get max voltage/current (format: VVVCCC)GETS- Get voltage/current settings (format: VVVCCC)GETD- Get display readings (format: VVVVIIIIIM)GOUT- Get output state (0=OFF, 1=ON)VOLT{vvv}- Set voltage (voltage × 10)CURR{ccc}- Set current (current × 10)SOUT0/SOUT1- Set output (0=ON, 1=OFF)\rOK\rwhich is properly parsedProper Resource Cleanup
Response Buffer Handling
OK\rterminatorTesting
Tested with BK Precision 1902B power supply:
ps_56fdd3df)Commits
2140b60- Generate deterministic equipment IDs to prevent 404 errors27a6e9a- Add automatic VISA session recovery to prevent InvalidSession errorsea3b8a5- Refresh resource manager during auto-reconnectiond6a9191- Call _refresh_resource_manager() in BK power supply connect method09da3e5- Properly close old instrument before reconnection3bf6cf7- Update BK Precision driver to use proprietary protocol instead of SCPI408a45c- Read full BK Precision response including OK terminatorBreaking Changes
None - all changes are backward compatible improvements to existing functionality.