fix: add recording_mode option in html

This commit is contained in:
2026-04-20 15:56:52 -04:00
parent 94767f5a9d
commit 702e06873e
+16
View File
@@ -803,6 +803,17 @@
<div class="cfg-section"> <div class="cfg-section">
<div class="cfg-section-title">Recording</div> <div class="cfg-section-title">Recording</div>
<div class="cfg-field">
<label>Recording Mode</label>
<select id="cfg-recording-mode">
<option value="">— unchanged —</option>
<option value="0">Single Shot</option>
<option value="1">Continuous</option>
<option value="3">Histogram</option>
<option value="4">Histogram + Continuous</option>
</select>
</div>
<div class="cfg-field"> <div class="cfg-field">
<label>Sample Rate</label> <label>Sample Rate</label>
<select id="cfg-sample-rate"> <select id="cfg-sample-rate">
@@ -1321,7 +1332,9 @@ function populateDeviceTab() {
// Compliance table // Compliance table
const cc = unitInfo.compliance_config || {}; const cc = unitInfo.compliance_config || {};
const RECORDING_MODE_LABELS = {0: 'Single Shot', 1: 'Continuous', 3: 'Histogram', 4: 'Histogram + Continuous'};
const complianceRows = [ const complianceRows = [
['Recording Mode', cc.recording_mode != null ? (RECORDING_MODE_LABELS[cc.recording_mode] || `0x${cc.recording_mode.toString(16).padStart(2,'0')}`) : '—'],
['Sample Rate', cc.sample_rate != null ? `${cc.sample_rate} sps` : '—'], ['Sample Rate', cc.sample_rate != null ? `${cc.sample_rate} sps` : '—'],
['Record Time', cc.record_time != null ? `${cc.record_time.toFixed(2)} s` : '—'], ['Record Time', cc.record_time != null ? `${cc.record_time.toFixed(2)} s` : '—'],
['Trigger Level (geo)', cc.trigger_level_geo != null ? `${cc.trigger_level_geo.toFixed(4)} in/s` : '—'], ['Trigger Level (geo)', cc.trigger_level_geo != null ? `${cc.trigger_level_geo.toFixed(4)} in/s` : '—'],
@@ -1357,6 +1370,7 @@ function renderTable(id, rows) {
function populateConfigFromDeviceInfo() { function populateConfigFromDeviceInfo() {
if (!unitInfo) return; if (!unitInfo) return;
const cc = unitInfo.compliance_config || {}; const cc = unitInfo.compliance_config || {};
if (cc.recording_mode != null) qs('cfg-recording-mode', String(cc.recording_mode));
if (cc.sample_rate) qs('cfg-sample-rate', String(cc.sample_rate)); if (cc.sample_rate) qs('cfg-sample-rate', String(cc.sample_rate));
if (cc.record_time != null) qs('cfg-record-time', cc.record_time.toFixed(1)); if (cc.record_time != null) qs('cfg-record-time', cc.record_time.toFixed(1));
if (cc.trigger_level_geo != null) qs('cfg-trigger', cc.trigger_level_geo.toFixed(4)); if (cc.trigger_level_geo != null) qs('cfg-trigger', cc.trigger_level_geo.toFixed(4));
@@ -1399,6 +1413,8 @@ async function writeConfig() {
// Build body — only include fields that have values // Build body — only include fields that have values
const body = {}; const body = {};
const rm = qs('cfg-recording-mode').value;
if (rm !== '') body.recording_mode = parseInt(rm, 10);
const sr = qs('cfg-sample-rate').value; const sr = qs('cfg-sample-rate').value;
if (sr) body.sample_rate = parseInt(sr, 10); if (sr) body.sample_rate = parseInt(sr, 10);
const rt = qs('cfg-record-time').value; const rt = qs('cfg-record-time').value;