Add single-shot measurement mode matching vendor protocol
Stop command triggers a one-shot reading instead of start+poll+stop. spectrometer.py now uses take_single_reading() for this flow. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
24
hpcs6500.py
24
hpcs6500.py
@@ -426,6 +426,30 @@ class HPCS6500:
|
||||
|
||||
return result
|
||||
|
||||
def take_single_reading(self):
|
||||
"""Trigger a single measurement (no PSU control).
|
||||
Sends stop to trigger a one-shot reading, waits for data, reads it,
|
||||
then resets. This matches the vendor software's single-test flow."""
|
||||
self.stop_measurement()
|
||||
|
||||
if not self.wait_for_data(timeout=30.0):
|
||||
print("Timeout waiting for measurement data")
|
||||
return None
|
||||
|
||||
meas = self.read_measurement_block()
|
||||
elec = self.read_electrical_block()
|
||||
|
||||
if meas is None:
|
||||
print("Failed to read measurement block")
|
||||
return None
|
||||
|
||||
result = self._parse_measurement(meas)
|
||||
if elec is not None:
|
||||
result.update(self._parse_electrical(elec))
|
||||
|
||||
self.reset()
|
||||
return result
|
||||
|
||||
def read_current(self):
|
||||
"""Read current data without starting/stopping measurement.
|
||||
Use this when the vendor software is controlling the instrument."""
|
||||
|
||||
@@ -17,7 +17,7 @@ def measure():
|
||||
try:
|
||||
dev.identify()
|
||||
dev.set_integration_time(0) # auto
|
||||
reading = dev.take_reading(psu=False)
|
||||
reading = dev.take_single_reading()
|
||||
finally:
|
||||
dev.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user