Add HIOKI channel range controls and live range display

- GUI: voltage/current range selectors for Ch5 and Ch6 with AUTO option
- Worker: queries current V/I ranges each poll cycle, pushes to GUI
- Setting a fixed range automatically disables auto-range for that channel
- Live display shows current range values below each channel's readout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 15:30:10 +07:00
parent 956be4b77a
commit 05f23d6417
2 changed files with 89 additions and 0 deletions

View File

@@ -39,6 +39,10 @@ class Cmd(Enum):
SET_COUPLING = auto()
SET_RESPONSE_SPEED = auto()
SET_AVERAGING = auto()
SET_VOLTAGE_RANGE = auto()
SET_CURRENT_RANGE = auto()
SET_VOLTAGE_AUTO = auto()
SET_CURRENT_AUTO = auto()
# System
SET_INTERVAL = auto()
@@ -108,6 +112,16 @@ class InstrumentWorker(threading.Thread):
data["load_on"] = self.bench.load.get_load_state()
except Exception:
data["load_on"] = None
# Query meter channel ranges
for ch in (5, 6):
try:
data[f"v_range_{ch}"] = self.bench.meter.get_voltage_range(ch).strip()
except Exception:
data[f"v_range_{ch}"] = None
try:
data[f"i_range_{ch}"] = self.bench.meter.get_current_range(ch).strip()
except Exception:
data[f"i_range_{ch}"] = None
except Exception as e:
data = {"_error": str(e), "_timestamp": time.time()}
@@ -181,6 +195,16 @@ class InstrumentWorker(threading.Thread):
bench.meter.set_response_speed(args[0])
case Cmd.SET_AVERAGING:
bench.meter.set_averaging(args[0], args[1] if len(args) > 1 else None)
case Cmd.SET_VOLTAGE_RANGE:
bench.meter.set_voltage_auto(args[0], False)
bench.meter.set_voltage_range(args[0], args[1])
case Cmd.SET_CURRENT_RANGE:
bench.meter.set_current_auto(args[0], False)
bench.meter.set_current_range(args[0], args[1])
case Cmd.SET_VOLTAGE_AUTO:
bench.meter.set_voltage_auto(args[0], args[1])
case Cmd.SET_CURRENT_AUTO:
bench.meter.set_current_auto(args[0], args[1])
# System
case Cmd.SET_INTERVAL: