Add Windows compatibility (serialport v12), OSR control, and cycler log interval#1
Open
joeltroughton wants to merge 3 commits into
Open
Add Windows compatibility (serialport v12), OSR control, and cycler log interval#1joeltroughton wants to merge 3 commits into
joeltroughton wants to merge 3 commits into
Conversation
Introduce configurable logging interval and SMU OSR support, plus upgrade to serialport v12.
Details:
- Add a logging interval mechanism (cyclerState.logIntervalMs, lastLogTime) to throttle SQLite/CSV writes and a new POST /cycler/set_log_interval endpoint to adjust it.
- Add SMU OSR tracking and control: smuState.channels[].osr, set_osr() helper and POST /smu/set_osr route with validation.
- Add a small 200ms settle delay after enabling a channel before issuing set_current/set_potential to improve SMU stability.
- Improve CC voltage cutoff logging and add debug output to aid troubleshooting.
- Make serial port usage compatible with serialport v12: change import to { SerialPort }, adjust constructor to SerialPort({ path, baudRate }), and add a default baud fallback of 115200.
- package.json and package-lock.json updated to bump serialport to ^12.0.0 (lockfile updated accordingly).
These changes reduce excessive IO load during high-frequency streaming, add OSR control, improve SMU command timing, and update the serial driver dependency.
Add prerequisites and platform-specific examples (Linux/macOS and Windows) and clarify SERIAL_PORT usage. Document new API endpoints for measurement oversampling (POST /smu/set_osr) and cycler log throttling (POST /cycler/set_log_interval) with curl examples and explanation of log interval behavior. Include guidance on log interval throttling to reduce disk writes while preserving WebSocket/in-memory streaming. Update README dependency listing to reflect serialport ^12.0.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Upgrade serialport from v9 to v12 for Windows compatibility: v9 relied on nan for native bindings which was problematic on Windows, v12 uses node-addon-api with prebuilt binaries. Updated import syntax, constructor signature, and baud rate fallback to match the v12 API.
Add OSR (Oversampling Rate) control: New
set_osr(ch, osr)SCPI command function and POST /smu/set_osr REST endpointwith validation (0–15 range).
Add cycler data log interval throttling: Decouples disk write frequency from streaming sample rate to prevent enormous log files at high sample rates. New POST /cycler/set_log_interval endpoint (default 10s, minimum 100ms). WebSocket streaming and in-memory data are unaffected.
Fix SMU settling race condition — add 200ms delay between
enable_channel()and setpoint commands (set_current/set_potential) in CC/CV cycler modes to allow hardware to initialize before receiving setpointDetails on serialport v12 changes
const SerialPort = require('serialport')const { SerialPort } = require('serialport')new SerialPort(path, { baudRate })new SerialPort({ path, baudRate })