Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
903 lines (871 loc) · 55.5 KB
/
Copy pathindex.html
File metadata and controls
903 lines (871 loc) · 55.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SerialCanvas</title>
<script src="bootstrap.js"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="vendor/xterm/xterm.css">
</head>
<body spellcheck="false">
<script>
window.__applySerialCanvasInitialBodyClasses?.();
</script>
<div class="app-shell">
<header id="app-topbar" class="topbar">
<section class="brand-block">
<div class="status-pill">
<span id="serial-status-dot" class="status-dot warn"></span>
<div class="status-pill-copy">
<span class="status-pill-title">SerialCanvas</span>
<span id="serial-status-text" class="status-pill-subtitle" data-hover="展开/折叠连接管理">串口离线</span>
</div>
<div id="logo-mode-switch" class="logo-mode-switch" aria-label="模式切换">
<button id="serial-mode-btn" class="logo-mode-btn is-active" type="button" title="串口监视">
<span class="logo-mode-icon" aria-hidden="true">
<svg viewBox="0 0 16 16">
<path d="M2.5 3.5h11"></path>
<path d="M2.5 8h7"></path>
<path d="M2.5 12.5h11"></path>
<path d="M11.5 6.2l2 1.8-2 1.8"></path>
</svg>
</span>
<span class="logo-mode-text">监视</span>
</button>
<button id="parser-mode-btn" class="logo-mode-btn" type="button" title="图形解析">
<span class="logo-mode-icon" aria-hidden="true">
<svg viewBox="0 0 16 16">
<path d="M2.5 13.5h11"></path>
<path d="M3.5 11l2.2-2.8 2.4 1.9 4-5.1"></path>
<path d="M11.7 5h1.8v1.8"></path>
</svg>
</span>
<span class="logo-mode-text">解析</span>
</button>
</div>
</div>
</section>
<section class="timeline-block">
<div class="timeline-controls-wrap">
<div id="timeline-ribbon-shell" class="timeline-ribbon-shell">
<button id="stop-record-btn" class="record-toggle-btn" title="开始录制">REC</button>
<div class="timeline-bar-wrap">
<div class="timeline-track-box">
<div id="timeline-live-indicator" class="timeline-live-indicator">
<div id="timeline-live-bar" class="timeline-live-bar"></div>
</div>
<div id="timeline-freeze-hub" class="timeline-freeze-hub" aria-hidden="true">
<button id="timeline-freeze-btn" class="timeline-freeze-btn" type="button" title="冻结实时视图" aria-label="冻结实时视图" aria-pressed="false">
<svg id="timeline-freeze-icon" viewBox="0 0 16 16" aria-hidden="true">
<path d="M6 3.5v9"></path>
<path d="M10 3.5v9"></path>
</svg>
</button>
</div>
<div id="timeline-history-strip" class="timeline-history-strip hidden">
<div id="timeline-progress" class="timeline-progress"></div>
<input id="timeline-slider" type="range" min="0" max="1000" step="any" value="1000">
</div>
</div>
<div class="timeline-inline-meta">
<span id="timeline-label" class="sr-only">实时模式</span>
<span id="timeline-stamp">等待串口数据</span>
</div>
</div>
<button id="timeline-picker-btn" class="timeline-picker-btn" title="展开时间线列表">▾</button>
<label for="timeline-select" class="sr-only">Timeline</label>
<select id="timeline-select" class="hidden"></select>
<div id="timeline-picker-panel" class="timeline-picker-panel"></div>
</div>
</div>
</section>
<section class="corner-block">
<div class="corner-actions">
<div class="menu-anchor">
<button id="system-menu-btn" class="icon-btn" title="系统菜单">☰</button>
<div id="system-menu" class="floating-menu">
<button id="version-info-btn" class="menu-static-line version-info-btn" type="button">
<span id="runtime-mode-label" class="runtime-mode-label">关于</span>
<span id="online-mode-chip" class="online-mode-chip">当前在线最新</span>
</button>
<div class="menu-theme-line">
<span class="menu-theme-label">主题:</span>
<div id="menu-theme-group" class="menu-theme-group">
<button class="menu-theme-opt is-active" data-theme="system">跟随系统</button>
<button class="menu-theme-opt" data-theme="light">浅色模式</button>
<button class="menu-theme-opt" data-theme="dark">深色模式</button>
</div>
</div>
<div class="menu-theme-line">
<span class="menu-theme-label">语言:</span>
<div id="menu-language-group" class="menu-theme-group">
<button class="menu-lang-opt is-active" data-locale="zh">中文</button>
<button class="menu-lang-opt" data-locale="en">English</button>
<button class="menu-lang-opt" data-locale="system">跟随系统</button>
</div>
</div>
<div class="menu-theme-line">
<span class="menu-theme-label">圆角:</span>
<div id="menu-corner-group" class="menu-theme-group">
<button class="menu-corner-opt is-active" data-corner="square">直角</button>
<button class="menu-corner-opt" data-corner="soft">微圆</button>
<button class="menu-corner-opt" data-corner="round">圆润</button>
</div>
</div>
<div id="config-menu-row" class="menu-config-line">
<span class="menu-config-label">配置:</span>
<button id="copy-user-config-btn" type="button">复制配置</button>
<button id="paste-user-config-btn" type="button">粘贴导入</button>
<button id="reset-user-config-btn" type="button">清空配置</button>
</div>
<div id="config-menu-confirm-row" class="menu-config-line hidden">
<span class="menu-config-warning">此操作会丢失当前设置</span>
<button id="confirm-user-config-btn" class="danger-btn" type="button">确认</button>
<button id="cancel-user-config-btn" type="button">取消</button>
</div>
<div class="menu-link-row">
<a href="https://github.com/ra9fael/SerialCanvas/issues" target="_blank" rel="noreferrer">问题反馈</a>
<a href="https://github.com/ra9fael/SerialCanvas/blob/main/docs/README.md" target="_blank" rel="noreferrer">工具手册</a>
</div>
<a id="download-local-link" href="index.html" download="SerialCanvas串口调试.html">下载离线版到本地</a>
</div>
</div>
</div>
</section>
</header>
<div id="mobile-config-backdrop" class="mobile-config-backdrop" aria-hidden="true"></div>
<main class="workspace">
<section class="left-column">
<div class="expanded-left-top">
<section class="panel config-panel"> <div class="panel-head">
<div class="config-head-group">
<div class="panel-title">设备连接管理</div>
</div>
<div class="connect-control-box">
<div class="button-row">
<div class="connect-primary-stack">
<button id="connect-btn" class="primary-btn">连接设备 | 当前未连接</button>
<label class="reconnect-chip" for="auto-reconnect" title="自动重连">
<input id="auto-reconnect" type="checkbox">
<span class="reconnect-dot" aria-hidden="true"></span>
<span class="reconnect-label-text">自动重连</span>
</label>
</div>
</div>
</div>
</div>
<!-- Device metadata belongs with the connection state, not the panel
title. It used to float top-right, baseline-misaligned with the
two-line heading. -->
<div class="device-meta-strip">
<span class="device-meta-item"><strong>VID</strong><span id="device-vid">-</span></span>
<span class="device-meta-item"><strong>PID</strong><span id="device-pid">-</span></span>
</div>
<div class="config-grid">
<div class="field">
<label for="baud-rate">波特率</label>
<div id="baud-rate-anchor" class="baud-rate-anchor">
<div class="baud-rate-combo">
<input id="baud-rate" type="number" min="1" step="1" inputmode="numeric" value="115200">
<button id="baud-rate-preset-btn" type="button" title="选择常用波特率" aria-label="选择常用波特率">▾</button>
</div>
<div id="baud-rate-preset-menu" class="floating-menu baud-rate-preset-menu">
<button type="button" data-baud-value="1200">1200</button>
<button type="button" data-baud-value="2400">2400</button>
<button type="button" data-baud-value="4800">4800</button>
<button type="button" data-baud-value="9600">9600</button>
<button type="button" data-baud-value="19200">19200</button>
<button type="button" data-baud-value="38400">38400</button>
<button type="button" data-baud-value="57600">57600</button>
<button type="button" data-baud-value="115200">115200</button>
<button type="button" data-baud-value="230400">230400</button>
<button type="button" data-baud-value="460800">460800</button>
<button type="button" data-baud-value="921600">921600</button>
</div>
</div>
</div>
<div class="field">
<label for="data-bits">数据位</label>
<select id="data-bits">
<option value="8">8</option>
<option value="7">7</option>
</select>
</div>
<div class="field">
<label for="stop-bits">停止位</label>
<select id="stop-bits">
<option value="1">1</option>
<option value="2">2</option>
</select>
</div>
<div class="field">
<label for="parity">校验位</label>
<select id="parity">
<option value="none">无</option>
<option value="even">偶校验</option>
<option value="odd">奇校验</option>
</select>
</div>
<div class="field span-4 signal-config-field">
<label>自动控制与硬件流控</label>
<div class="signal-config-grid">
<div class="signal-config-row signal-output-row primary">
<label id="release-on-blur-chip" class="toggle-row signal-chip" for="release-on-blur">
<div>
<div class="mini-label">失焦自动断连</div>
</div>
<input id="release-on-blur" type="checkbox">
</label>
<label id="flow-control-chip" class="toggle-row signal-chip" for="flow-control">
<div>
<div class="mini-label">RTS/CTS 流控</div>
</div>
<input id="flow-control" type="checkbox">
</label>
</div>
<div class="signal-config-row signal-output-row secondary">
<label id="signal-dtr-chip" class="toggle-row signal-chip" for="signal-dtr">
<div>
<div class="mini-label">DTR</div>
</div>
<input id="signal-dtr" type="checkbox">
</label>
<label id="signal-rts-chip" class="toggle-row signal-chip" for="signal-rts">
<div>
<div class="mini-label">RTS</div>
</div>
<input id="signal-rts" type="checkbox">
</label>
<label id="signal-break-chip" class="toggle-row signal-chip" for="signal-break">
<div>
<div class="mini-label">BREAK</div>
</div>
<input id="signal-break" type="checkbox">
</label>
</div>
<div class="signal-config-row">
<div id="signal-cts-readout" class="signal-readout">
<strong>CTS</strong>
<span id="signal-cts-value">-</span>
</div>
<div id="signal-dsr-readout" class="signal-readout">
<strong>DSR</strong>
<span id="signal-dsr-value">-</span>
</div>
<div id="signal-dcd-readout" class="signal-readout">
<strong>DCD</strong>
<span id="signal-dcd-value">-</span>
</div>
<div id="signal-ri-readout" class="signal-readout">
<strong>RI</strong>
<span id="signal-ri-value">-</span>
</div>
</div>
</div>
</div>
</div>
<div class="layout-toggle-strip">
<button id="layout-toggle-btn" class="layout-toggle-btn" title="图形解析模式">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
<path d="M6 9l6 6 6-6"></path>
</svg>
<span id="layout-toggle-label">图形解析模式</span>
</button>
</div>
</section>
<!-- Part 1 of 3 in the parse view: where the bytes come FROM.
It is a data SOURCE for the parser, so it belongs with the thing it
feeds — but as a part of its own, not as a section inside the
settings. Three parts then read top to bottom as the pipeline:
this one supplies something to decode, the parser says how to
decode and shows what came out, the charts plot it. It was in the
rail beside the connection for one commit, which split "generate
bytes" and "decode bytes" across two screens. -->
<section class="panel simulator-panel">
<div class="panel-head">
<div class="simulator-head">
<div class="panel-title">模拟数据源
<span class="help-icon" data-tip-docs="docs/parser.md#simulation-source" data-tip="不开串口也能验证解析与图表:模拟数据走同一条 RX 通道, 解析、录制、绘图全链路与真实串口完全一致。 用法: 1. 勾选「启用」 2. 选脚本:文本 / JSON / 二进制帧 3. 要自定义格式就改模板——框里已经填着该脚本的默认模板 4. 看「下一帧预览」,那就是即将发出的内容 说明:{tick} 与 {n} 同值;二进制的 {sum} 只覆盖 占位符产生的字节,与结构表校验和行的范围一致。 已连接串口时模拟自动让位。">?</span>
</div>
<label class="term-field term-toggle" title="本地生成协议数据走同一 RX 通道,无需连接设备即可验证解析与图表">
<input id="simulation-enabled" type="checkbox">
<span>启用</span>
</label>
<!-- Frame count and the yield state, both readable at a glance.
A transient toast is not enough: the question "is this a
device or the simulator" has to be answerable while
watching the log, not only when it was switched. -->
<span id="simulation-status" class="simulation-status" role="status"></span>
</div>
<button id="simulator-panel-toggle" class="parser-panel-toggle" type="button" aria-expanded="true" aria-controls="simulator-panel-body">
<span class="parser-panel-toggle-text">收起</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M6 9l6 6 6-6"></path>
</svg>
</button>
</div>
<div id="simulator-panel-body" class="simulator-body">
<label class="term-field" title="选择模拟的协议脚本">
<span>脚本</span>
<select id="simulation-script"></select>
</label>
<!-- Pacing and payload. The interval and burst shape what the
stream looks like on the wire; the templates are what makes
the simulator useful for testing a real rule rather than the
built-in one.
Each script seeds its own default into the template box, so a
newcomer sees a working example instead of a placeholder, and
only the template that applies to the chosen script is shown —
the other one used to sit there disabled, which is a dead end
that explains nothing. -->
<div class="simulation-config is-open">
<div class="term-field" title="两次发送之间的间隔(10–60000 毫秒,可直接输入)">
<span>间隔</span>
<div id="simulation-interval-anchor" class="combo-anchor">
<div class="combo">
<input id="simulation-interval" type="number" min="10" max="60000" step="1" inputmode="numeric" spellcheck="false" autocomplete="off">
<button id="simulation-interval-toggle" type="button" aria-label="选择常用间隔">▾</button>
</div>
<div id="simulation-interval-menu" class="floating-menu combo-menu"></div>
</div>
</div>
<div class="term-field" title="每个间隔发送的帧数(1–100,可直接输入),用于模拟一次应答多帧的设备">
<span>每次帧数</span>
<div id="simulation-burst-anchor" class="combo-anchor">
<div class="combo">
<input id="simulation-burst" type="number" min="1" max="100" step="1" inputmode="numeric" spellcheck="false" autocomplete="off">
<button id="simulation-burst-toggle" type="button" aria-label="选择常用帧数">▾</button>
</div>
<div id="simulation-burst-menu" class="floating-menu combo-menu"></div>
</div>
</div>
<div class="simulation-template-field" data-sim-template="text">
<div class="simulation-field-head">
<label for="simulation-template">载荷模板</label>
<button id="simulation-template-reset" class="simulation-reset-btn" type="button" title="恢复该脚本的默认模板">恢复默认</button>
</div>
<input id="simulation-template" type="text" maxlength="200" spellcheck="false" autocomplete="off">
<!-- One text node per label, so each word is its own
translatable string. A sentence of mixed markup collapses
into fragments like "温度 ·" that no dictionary holds. -->
<div class="simulation-legend">
<span class="simulation-legend-lead">占位符</span>
<span class="simulation-legend-item"><code>{temp}</code> 温度</span>
<span class="simulation-legend-item"><code>{hum}</code> 湿度</span>
<span class="simulation-legend-item"><code>{n}</code> 帧号</span>
<span class="simulation-legend-item"><code>{ts}</code> 总帧数</span>
</div>
</div>
<div class="simulation-template-field" data-sim-template="binary">
<div class="simulation-field-head">
<label for="simulation-frame-template">帧模板</label>
<button id="simulation-frame-template-reset" class="simulation-reset-btn" type="button" title="恢复该脚本的默认模板">恢复默认</button>
</div>
<input id="simulation-frame-template" type="text" maxlength="160" spellcheck="false" autocomplete="off">
<div class="simulation-legend">
<span class="simulation-legend-lead">十六进制字节与占位符混写</span>
<span class="simulation-legend-item"><code>{t}</code> 温度×10</span>
<span class="simulation-legend-item"><code>{h}</code> 湿度</span>
<span class="simulation-legend-item"><code>{n}</code> 帧号</span>
<span class="simulation-legend-item"><code>{sum}</code> 占位符字节的校验和</span>
</div>
</div>
<div id="simulation-preview" class="simulation-frame-preview" aria-live="off"></div>
</div>
</div>
</section>
<section class="panel parser-panel">
<div class="panel-head">
<div>
<div class="panel-title">解析协议设置</div>
<!-- Collapsed by default: the panel matters while setting a
protocol and is dead weight afterwards, and it was taking a
third of the rail. The live results and the simulator stay
outside this body so they remain reachable. -->
<button id="parser-panel-toggle" class="parser-panel-toggle" type="button" aria-expanded="false" aria-controls="parser-panel-body">
<span class="parser-panel-toggle-text">展开</span>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M6 9l6 6 6-6"></path>
</svg>
</button>
</div>
<div class="mode-tabs mode-switch-group parser-mode-switch">
<button class="mode-tab active" data-parser-mode="text">文本解析</button>
<button class="mode-tab" data-parser-mode="binary">十六进制解析</button>
</div>
</div>
<div id="parser-panel-body" class="parser-panel-body">
<section id="text-parser-pane" class="parser-config-card">
<div class="parser-card-head">
<div class="panel-title">文本解析配置
<span class="help-icon" data-tip-docs="docs/parser.md#text-rules" data-tip="如何编写解析规则: 三种标记(必须 / 开头 + 数字序号): /nameN → 匹配文本,用作键名 /intN → 匹配整数 /floatN → 匹配小数 标记之间可放任意分隔符 分隔符按原样匹配输入数据 例 1:/name0=/int0 /name1=/float1 可解析:温度=42 湿度=3.14 结果→ 温度:42, 湿度:3.14 例 2:/name0:/int0,/name1=/float1 可解析:温度:42,湿度=3.14 例 3(动态键名):/name0=/int0 同一规则可解析不同输入: 传感器A=25 → 传感器A:25 传感器B=30 → 传感器B:30 name 会自动将捕获的文本 作为该条数据的键名">?</span>
</div>
<button id="apply-recommended-rule-btn" class="auto-detect-btn" type="button">自动识别:不可用</button>
</div>
<div class="field">
<label for="text-parse-rule">配置文本</label>
<div class="text-rule-field-row">
<div id="text-rule-editor" class="text-rule-editor">
<div id="text-rule-overlay" class="text-rule-overlay" aria-hidden="true"></div>
<textarea id="text-parse-rule" placeholder="/name0=/float0,/name1=/int0;" spellcheck="false" autocapitalize="off" autocomplete="off" autocorrect="off"></textarea>
</div>
</div>
</div>
</section>
<section id="binary-parser-pane" class="parser-config-card hidden">
<div class="parser-card-head">
<div>
<div class="panel-title">十六进制结构表
<span class="help-icon" data-tip-docs="docs/parser.md#hex-binary-frames" data-tip="行类型(按表格下拉顺序): • 帧头 — 帧起始标识,16进制 留空则跳过 • 帧尾 — 帧结束标识,16进制 留空则不检查帧尾 • 数据 — 数值数据,需选择 数据类型 + 填写标签名 • 校验和 — 自动计算 SUM8 仅覆盖 data 行的字节 • 间隔符 — 留空占位 1 字节 填入则匹配指定16进制 数值大小端说明: LE = Little Endian(低位在前) BE = Big Endian(高位在前) 可用数据类型: UInt8 / Int8 UInt16 LE/BE / Int16 LE/BE UInt32 LE/BE / Int32 LE/BE Float32 LE/BE / Bool(8bit)">?</span>
</div>
</div>
<button id="add-binary-row-btn" class="secondary-btn">新增一行</button>
</div>
<div class="binary-schema-table">
<div class="binary-schema-head">
<span>段类型</span>
<span>数值 / 数据类型</span>
<span>标签</span>
<span></span>
</div>
<div id="binary-schema-list" class="binary-schema-list"></div>
</div>
</section>
</div>
<section class="parser-results-card">
<div class="parser-results-head">
<div class="panel-title parser-results-title">实时解析结果 <span class="panel-title-note">可录制时间线导出解析结果</span></div>
<button id="toggle-parser-results-btn" class="secondary-btn parser-results-toggle" type="button" aria-expanded="false">展开</button>
</div>
<div id="parser-preview" class="parser-result-grid"></div>
</section>
</section>
</div>
<section class="charts-panel">
<div class="chart-add-strip">
<div class="chart-add-copy">
<div class="panel-title">添加图框</div>
</div>
<div class="button-row">
<button id="add-time-chart-btn" class="secondary-btn">时域图</button>
<button id="add-fft-chart-btn" class="secondary-btn">频域图</button>
<button id="add-bar-chart-btn" class="secondary-btn">柱状图</button>
<button id="clear-charts-btn" class="secondary-btn danger-btn" type="button">清空缓存</button>
</div>
</div>
<div id="chart-list" class="chart-list"></div>
</section>
</section>
<section class="right-column">
<section class="panel monitor-panel">
<div class="monitor-toolbar">
<!-- Fixed two rows, same decision as the terminal key bar. One
nowrap row of ten controls truncated labels ("按键 HB: NaN")
and still ran out of room; adaptive fixes (a 1280px wrap, a
1440px term-toolbar break, a 1560px label hide) each patched
one width and fought each other. Row 1 is identity and
actions, row 2 is every parameter field, at every width. -->
<div class="monitor-toolbar-row monitor-toolbar-main">
<div class="monitor-toolbar-copy">
<div class="panel-title">串口监视器</div>
<!-- Read-only, and only in the monitor view's manual sub-view.
The simulator itself lives in the parse view, but the bytes
it produces arrive here — so "is this data real or
generated" has to be answerable while watching the log, not
only after a tab switch. The terminal sub-view stays clean: a
status line inside a terminal emulator reads as program
output. It sits with the Mode/TX/RX meta rather than among
the controls: it is state, not something to operate, and it
carries no frame count — the RX counter already says how
much arrived, and the chip answers one question. -->
<span id="simulation-monitor-chip" class="simulation-monitor-chip" role="status" hidden></span>
<div id="monitor-live-meta" class="device-meta-stack monitor-live-meta">
<div class="device-meta-line" data-meta="mode">
<strong>模式</strong>
<span id="monitor-meta-mode">-</span>
</div>
<div class="device-meta-line" data-meta="tx">
<strong>TX</strong>
<span id="monitor-meta-tx">-</span>
</div>
<div class="device-meta-line" data-meta="rx">
<strong>RX</strong>
<span id="monitor-meta-rx">-</span>
</div>
</div>
</div>
<div id="monitor-view-switch" class="mode-tabs mode-switch-group monitor-view-switch" role="tablist" aria-label="监视视图切换">
<button class="mode-tab active" data-monitor-view="manual" type="button">手动收发</button>
<button class="mode-tab" data-monitor-view="terminal" type="button">终端</button>
</div>
<div class="button-row monitor-log-actions">
<button id="export-log-btn" class="secondary-btn" title="把当前日志导出为文本文件">导出日志</button>
<button id="clear-live-log-btn" class="secondary-btn">清空缓存</button>
</div>
</div>
<div class="monitor-toolbar-row monitor-toolbar-params">
<div id="manual-toolbar-controls" class="term-toolbar-controls">
<label class="term-field" title="收发使用的字符编码">
<span>编码</span>
<select id="text-encoding">
<option value="utf-8">UTF-8</option>
<option value="ascii">ASCII</option>
<option value="latin1">Latin-1</option>
<option value="utf-16le">UTF-16LE</option>
</select>
</label>
<label class="term-field" title="手动发送时追加的行结束符(与终端的换行设置相互独立)">
<span>换行</span>
<select id="newline-mode">
<option value="r">\r</option>
<option value="n">\n</option>
<option value="rn" selected>\r\n</option>
</select>
</label>
<label class="term-field term-toggle" title="以十六进制显示收到的数据">
<input id="rx-display-mode" type="checkbox">
<span>HEX 接收</span>
</label>
<label class="term-field term-toggle" title="以十六进制发送输入内容">
<input id="send-mode" type="checkbox">
<span>HEX 发送</span>
</label>
<label class="term-field term-toggle" title="在每行日志前显示时间戳">
<input id="append-timestamp" type="checkbox" checked>
<span>时间戳</span>
</label>
<label class="term-field term-toggle" title="发送内容末尾自动补换行符">
<input id="append-newline" type="checkbox" checked>
<span>补换行</span>
</label>
</div>
<div id="mono-size-control" class="term-toolbar-controls">
<div class="term-field" title="等宽字号:同时作用于终端、收发日志与解析预览(8-48,可直接输入,终端内可 Ctrl + 滚轮缩放)">
<span>字号</span>
<div id="mono-size-anchor" class="combo-anchor">
<div class="combo">
<input id="mono-size-input" type="number" min="8" max="48" step="1" inputmode="numeric" value="12" spellcheck="false" autocomplete="off">
<button id="mono-size-toggle" type="button" aria-label="选择常用字号">▾</button>
</div>
<div id="mono-size-menu" class="floating-menu combo-menu">
<button type="button" data-combo-value="10">10</button>
<button type="button" data-combo-value="11">11</button>
<button type="button" data-combo-value="12">12</button>
<button type="button" data-combo-value="14">14</button>
<button type="button" data-combo-value="16">16</button>
<button type="button" data-combo-value="18">18</button>
<button type="button" data-combo-value="20">20</button>
</div>
</div>
</div>
</div>
<div id="buffer-toolbar-controls" class="term-toolbar-controls">
<div class="term-field" title="xterm 回滚缓冲保留的行数(100–1000000,可直接输入)">
<span>回滚行数</span>
<div id="term-scrollback-anchor" class="combo-anchor">
<div class="combo">
<input id="term-scrollback" type="number" min="100" max="1000000" step="1" inputmode="numeric" value="20000" spellcheck="false" autocomplete="off">
<button id="term-scrollback-toggle" type="button" aria-label="选择常用回滚行数">▾</button>
</div>
<div id="term-scrollback-menu" class="floating-menu combo-menu">
<button type="button" data-combo-value="5000">5000</button>
<button type="button" data-combo-value="20000">20000</button>
<button type="button" data-combo-value="100000">100000</button>
</div>
</div>
</div>
<div class="term-field" title="收发日志保留的字符总量(65536–33554432,可直接输入)。追加渲染后上限由内存决定,而非每帧重建的耗时">
<span>日志字符</span>
<div id="live-buffer-size-anchor" class="combo-anchor">
<div class="combo">
<input id="live-buffer-size" type="number" min="65536" max="33554432" step="1" inputmode="numeric" value="1048576" spellcheck="false" autocomplete="off">
<button id="live-buffer-size-toggle" type="button" aria-label="选择常用日志上限">▾</button>
</div>
<div id="live-buffer-size-menu" class="floating-menu combo-menu">
<button type="button" data-combo-value="262144">262144</button>
<button type="button" data-combo-value="1048576">1048576</button>
<button type="button" data-combo-value="4194304">4194304</button>
</div>
</div>
</div>
</div>
<div id="term-toolbar-controls" class="term-toolbar-controls">
<label class="term-field" title="发送时追加的行结束符">
<span>换行</span>
<select id="term-newline">
<option value="n" selected>\n</option>
<option value="rn">\r\n</option>
<option value="r">\r</option>
<option value="none">无</option>
</select>
</label>
<label class="term-field" title="终端字体(可选 Nerd Font 等已安装字体)">
<span>字体</span>
<select id="term-font">
<option value="">默认</option>
<option value=""Cascadia Code", monospace">Cascadia Code</option>
<option value=""Cascadia Mono", monospace">Cascadia Mono</option>
<option value=""JetBrainsMono Nerd Font", "JetBrains Mono", monospace">JetBrains Mono</option>
<option value=""FiraCode Nerd Font", "Fira Code", monospace">FiraCode</option>
<option value=""Hack Nerd Font", Hack, monospace">Hack</option>
<option value=""MesloLGS NF", monospace">MesloLGS NF</option>
<option value=""Sarasa Mono SC", monospace">更纱黑体</option>
<option value=""Noto Sans Mono CJK SC", monospace">Noto Mono CJK</option>
<option value="Consolas, monospace">Consolas</option>
<option value=""Courier New", monospace">Courier New</option>
</select>
</label>
<label class="term-field" title="终端配色主题">
<span>主题</span>
<select id="term-skin">
<option value="">跟随应用</option>
<option value="green">黑底绿字</option>
<option value="black-white">黑底白字</option>
<option value="dracula">Dracula</option>
<option value="solarized-dark">Solarized Dark</option>
<option value="solarized-light">Solarized Light</option>
<option value="one-dark">One Dark</option>
</select>
</label>
<label class="term-field term-echo" title="本地回显键入内容(仅适用于不回显的设备;shell 等设备会自行回显,保持关闭)">
<input id="term-local-echo" type="checkbox">
<span>回显</span>
</label>
</div>
</div>
</div>
<div class="monitor-body">
<div class="terminal-wrap">
<div id="terminal" class="terminal" data-i18n-off></div>
<button id="terminal-jump-btn" class="terminal-jump-btn" type="button" title="到底部" aria-label="滚动到底部">
<svg viewBox="0 0 24 24" fill="none" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M12 5v12"></path>
<path d="M7 12l5 5 5-5"></path>
</svg>
</button>
</div>
<section id="send-panel" class="send-panel">
<div id="send-resize-handle" class="send-resize-handle" role="separator" aria-orientation="horizontal" aria-label="调整串口监视器与发送功能区域高度"></div>
<div id="send-extension-shell" class="send-extension-shell">
<div id="extension-panel" class="send-mode-stack">
<section id="auto-send-module" class="module-card hidden">
<div class="module-head">
<button id="auto-send-switch" class="module-switch" type="button" aria-label="启用定时发送" aria-pressed="false"></button>
<div class="module-copy">
<div class="panel-title">定时发送</div>
<div class="panel-subtitle">循环列表按周期自动发送</div>
</div>
<div class="module-head-inline">
<div class="field-inline">
<label for="auto-send-interval">间隔时间</label>
<input id="auto-send-interval" class="compact-input" type="number" min="100" step="100" value="1000">
</div>
<button id="add-auto-item-btn" class="secondary-btn module-head-action">新增轮询项</button>
</div>
</div>
<div class="module-body">
<div id="auto-send-queue" class="queue-table"></div>
</div>
</section>
<section id="condition-send-module" class="module-card hidden">
<div class="module-head">
<button id="condition-send-switch" class="module-switch" type="button" aria-label="启用触发发送" aria-pressed="false"></button>
<div class="module-copy">
<div class="panel-title">触发发送</div>
<div class="panel-subtitle">命中规则后自动应答</div>
</div>
<button id="add-condition-rule-btn" class="secondary-btn module-head-action">新增触发规则</button>
</div>
<div class="module-body">
<div id="condition-rule-list" class="rule-table"></div>
</div>
</section>
<section id="preset-send-module" class="module-card hidden">
<div class="module-head">
<button id="preset-send-switch" class="module-switch" type="button" aria-label="展开预设发送" aria-pressed="false"></button>
<div class="module-copy">
<div class="panel-title">预设发送</div>
<div class="panel-subtitle">发送内容并等待期望接收,开关控制全局快捷键</div>
</div>
<button id="add-preset-item-btn" class="secondary-btn module-head-action">新增预设项</button>
</div>
<div class="module-body">
<div id="preset-send-list" class="queue-table"></div>
</div>
</section>
</div>
</div>
<div id="send-manual-panel" class="send-manual-panel">
<div class="send-main">
<textarea id="send-input" placeholder="输入发送内容;HEX 模式示例:AA 55 01 02"></textarea>
<button id="send-now-btn" class="wide-send-btn">立即发送</button>
</div>
</div>
<div class="send-modebar">
<div id="auto-send-tile" class="send-mode-tile">
<button id="toggle-auto-send-enable-btn" class="mode-enable-dot" type="button" aria-label="启用定时发送" aria-pressed="false"></button>
<button id="toggle-auto-send-btn" class="send-mode-switch" type="button" aria-expanded="false"><span data-short="定时">定时发送</span></button>
</div>
<div id="condition-send-tile" class="send-mode-tile">
<button id="toggle-condition-send-enable-btn" class="mode-enable-dot" type="button" aria-label="启用触发发送" aria-pressed="false"></button>
<button id="toggle-condition-send-btn" class="send-mode-switch" type="button" aria-expanded="false"><span data-short="触发">触发发送</span></button>
</div>
<div id="preset-send-tile" class="send-mode-tile">
<button id="toggle-preset-send-enable-btn" class="mode-enable-dot" type="button" aria-label="展开预设发送" aria-pressed="false"></button>
<button id="toggle-preset-send-btn" class="send-mode-switch" type="button" aria-expanded="false"><span data-short="预设">预设发送</span></button>
</div>
</div>
</section>
<section id="term-interaction" class="term-interaction" aria-label="终端交互模式">
<div id="term-output" class="term-output" aria-label="串口终端,直接键入内容,回车发送" data-i18n-off></div>
<!-- Built from TERM_KEY_GROUPS in app.terminal.js, so the bar and
the byte table cannot drift. Static markup for 44 buttons
would be unreadable and would duplicate every binding.
Buttons call sendTerminalKey() directly rather than
synthesising keystrokes, so they work without focus.
The bar is split across two rows by TERM_KEY_ROWS: at 44 keys
a single row wrapped unpredictably and pushed the terminal
around as the window narrowed. The disclosure collapses the
whole bar; it is open by default because the keys are the
point of the terminal view. -->
<div id="term-key-bar" class="term-key-bar" role="group" aria-label="快捷发送按键">
<div class="term-key-bar-head">
<span class="term-key-bar-label">按键</span>
<button id="term-key-bar-toggle" class="term-key-bar-toggle" type="button" aria-expanded="true" aria-controls="term-key-bar-body" title="折叠/展开按键区">
<span class="term-key-bar-toggle-text">收起</span>
</button>
</div>
<div id="term-key-bar-body" class="term-key-bar-body">
<div class="term-key-bar-row" data-term-row="0"></div>
<div class="term-key-bar-row" data-term-row="1"></div>
<div class="term-key-bar-row" data-term-row="2"></div>
</div>
</div>
</section>
</div>
</section>
</section>
</main>
</div>
<input id="timeline-file-input" type="file" class="hidden" accept=".csv,.txt,.bin,.timeline">
<div id="version-modal-backdrop" class="version-modal-backdrop" aria-hidden="true">
<section class="version-modal" role="dialog" aria-modal="true" aria-labelledby="version-modal-title">
<div class="version-modal-head">
<div>
<div id="version-modal-title" class="version-modal-title">SerialCanvas</div>
<div class="version-modal-subtitle">串口监视与图形解析工具</div>
</div>
<button id="version-modal-close" class="version-modal-close" type="button" aria-label="关闭版本信息">
<svg class="version-modal-close-icon" viewBox="0 0 32 32" aria-hidden="true" focusable="false">
<circle class="version-modal-close-ring" cx="16" cy="16" r="15.5"></circle>
<path class="version-modal-close-mark" d="M11.5 11.5L20.5 20.5M20.5 11.5L11.5 20.5"></path>
</svg>
</button>
</div>
<div class="version-modal-body">
<div class="version-info-grid">
<strong>当前版本</strong>
<span id="version-current-label">—</span>
<strong>工具手册</strong>
<span><a href="https://github.com/ra9fael/SerialCanvas/blob/main/docs/README.md" target="_blank" rel="noreferrer">查看工具手册</a></span>
<strong>问题反馈</strong>
<span><a href="https://github.com/ra9fael/SerialCanvas/issues" target="_blank" rel="noreferrer">提交问题反馈</a></span>
<strong>源码仓库</strong>
<span><a href="https://github.com/ra9fael/SerialCanvas" target="_blank" rel="noreferrer">查看 github 项目</a></span>
<strong>许可证</strong>
<span><a href="https://github.com/ra9fael/SerialCanvas/blob/main/LICENSE" target="_blank" rel="noreferrer">查看 AGPL-3.0 许可证</a></span>
</div>
<div id="version-online-box" class="version-online-box">
<strong>最新在线版本</strong>
<span>GitHub Pages</span>
<a href="https://ra9fael.github.io/SerialCanvas/" target="_blank" rel="noreferrer">https://ra9fael.github.io/SerialCanvas/</a>
</div>
<div class="version-upstream-box">
<strong>来源与致谢</strong>
<p>SerialCanvas 的前身是电导实验室(Conductance-lab)的 SerialWeb(上游 v1.6,提交 e3f9200814,2026/9/6),界面设计另借鉴了 PICOTTY(morpheuslord)。本项目已独立发展,按 AGPL-3.0 授权,原始代码版权归原作者。</p>
<span>原始项目</span>
<a href="https://github.com/Conductance-lab/SerialWeb" target="_blank" rel="noreferrer">github.com/Conductance-lab/SerialWeb</a>
</div>
<div class="version-changelog">
<div class="version-changelog-title">更新日志</div>
<div class="version-release">
<strong>v0.4.2 版本 · 26/10/8</strong>
<ul>
<li>终端快捷键补齐 F1–F12:新增 F5–F12(标准 xterm 序列,与物理键盘行为一致),F1–F4 从 page 组移入独立的 fkeys 组。共 60 键 8 组三行——行输入与导航 / 文本与屏幕 / 流控、中断、 功能键——并以 1440/1100px 下「行不换行」断言守住条高恒定。</li>
<li>组合框输入框不再截断数字:一条老的 .term-field input[type="number"] { width: 46px } 规则 优先级更高,把所有输入框钉在 46px,导致 1000000、33554432 在任何窗口宽度下都被截断。 现在每个组合框按自身 max 值的渲染宽度给文本列设底线,▾ 列收窄到 28px,参数行放不下时 工具栏里的原生下拉先收缩。verify-combo 新增几何断言:组合框必须装得下自己的最大值。</li>
</ul>
</div>
<div class="version-release">
<strong>v0.4.1 版本 · 26/10/8</strong>
<ul>
<li>终端快捷键新增 8 个:^S / ^Q(XOFF/XON 流控,单独成组、不用琥珀色)、^\\(SIGQUIT, 中断组补齐)、^H(BS 0x08——字节映射早就有,按钮一直缺)、^M / ^J(裸 CR/LF, 不受换行模式影响)以及 Alt-D / Alt-Backspace(向后/向前删一个词)。共 52 键 7 组, 两行宽度实测偏差 4.6%。</li>
<li>五个纯下拉控件——字号、回滚行数、日志字符、模拟间隔、每次帧数——改为波特率式组合框: 既能手动输入又能选预设。原先的处理器是成员白名单,输入值不在名单就被静默丢弃;现改为 按范围钳制(字号 8–48、回滚 100–100 万行、日志 64K–32M 字符、间隔 10–60000 毫秒、 帧数 1–100),保存过的自定义值刷新后仍在。字号「自定义」的两步交互一并删除。</li>
</ul>
</div>
<div class="version-release">
<strong>v0.4.0 版本 · 26/10/8</strong>
<ul>
<li>项目更名为 SerialCanvas:本项目从 SerialWeb v1.6 出发、此后独立发展,因此不再使用 fork 的表述。 docs/fork.md 更名为来源与致谢,关于弹窗只保留原始项目链接,UI 借鉴说明同时 写入 PICOTTY。构建产物(dist/SerialCanvas.html)、 离线包文件名与 Pages 工作流一并随新名;AGPL-3.0 与原始版权不变。</li>
<li>☰ 菜单的三组分段按钮(主题 / 语言 / 圆角)现在共享同一套样式:此前两处 CSS :not() 列表漏掉了 .menu-corner-opt,圆角按钮被当成列表按钮排版(36px 高、带通用 hover 底色)而非分段按钮。</li>
<li>监视工具栏的模拟状态芯片只在手动收发子视图显示,并去掉帧数——它只回答「这批数据是不是模拟的」, 收到多少 RX 计数本来就在说。</li>
<li>监视工具栏改为固定两行(标题与操作 / 全部参数字段),取代 1280px 换行、1440px 终端控件独占一行、 1560px 藏标签这三套补丁;常见窗口宽度下标签不再被截断。</li>
</ul>
</div>
<div class="version-release">
<strong>v0.3.0 版本 · 26/10/1</strong>
<ul>
<li>界面现在明确标注分叉身份:关于弹窗写清上游项目、分叉提交(e3f9200814,上游 v1.6,2026/9/6)以及各处构建的托管位置;☰ 菜单与弹窗里的链接改为指向本仓库,不再指向原作者的主机。</li>
<li>关于弹窗新增许可证一行,仓库补上 LICENSE:SerialCanvas 采用上游声明的 AGPL-3.0 许可证。</li>
<li>线上构建不再发送上游的页面访问统计——该请求只在原作者的主机上发出,因此 GitHub Pages 或 localhost 部署不会产生统计请求。</li>
<li>新增 GitHub Actions 工作流:构建 dist/SerialCanvas.html 并作为 index.html 发布到 GitHub Pages。</li>
<li>文档:新增中英双语的分叉来源,并用 tools/docs-check.py 校验文档链接、标题锚点与中英镜像。</li>
</ul>
</div>
<div class="version-release">
<strong>v0.2.0 版本 · 26/10/1</strong>
<ul>
<li>新增语言切换:系统菜单 ☰ 中提供 中文 / English / 跟随系统。切换即时生效、无需刷新并会被保存;只有界面会被翻译,已捕获的日志行与终端历史保持写入时的语言。</li>
<li>终端字体选择器现在诚实了:未检测到安装的字体族会被置灰并给出提示,而不是像以前那样静默地渲染成与默认等宽字体完全相同的样子。</li>
<li>字体与主题改动在终端隐藏时(手动视图或监视器收起)也能可靠生效——改动会被挂起,待终端重新可见时应用。</li>
<li>新增终端字号输入框(8–48 px,默认 12),并支持终端内 Ctrl + 鼠标滚轮缩放。两者都会被持久化。</li>
<li>清空配置现在同时重置语言与终端字体/字号,并立即重新应用。</li>
</ul>
</div>
</div>
</div>
</section>
</div>
<!-- Shortcut sheet. Rows carry data-scope so the reader can tell an app-level
binding from a terminal-only one; the list is generated in app.core.js
from SHORTCUT_GROUPS so the two can never disagree. -->
<div id="shortcut-modal-backdrop" class="version-modal-backdrop" aria-hidden="true">
<section class="version-modal shortcut-modal" role="dialog" aria-modal="true" aria-labelledby="shortcut-modal-title">
<div class="version-modal-head">
<div>
<div id="shortcut-modal-title" class="version-modal-title">快捷键列表</div>
<div class="version-modal-subtitle">在输入框与终端内不触发应用级快捷键</div>
</div>
<button id="shortcut-modal-close" class="version-modal-close" type="button" aria-label="关闭快捷键列表">
<svg class="version-modal-close-icon" viewBox="0 0 32 32" aria-hidden="true" focusable="false">
<circle class="version-modal-close-ring" cx="16" cy="16" r="15.5"></circle>
<path class="version-modal-close-mark" d="M11.5 11.5L20.5 20.5M20.5 11.5L11.5 20.5"></path>
</svg>
</button>
</div>
<div class="version-modal-body">
<div id="shortcut-groups" class="shortcut-groups"></div>
<div class="shortcut-note">
预设发送占用裸字母键(可在预设项里设置)。带 Ctrl 或 Alt 的组合键不会被预设占用。
</div>
</div>
</section>
</div>
<div id="toast-layer" class="toast-layer"></div>
<script src="vendor/xterm/xterm.js"></script>
<script src="vendor/xterm/xterm-addon-fit.js"></script>
<!-- Locale dictionaries: must be inlined above the app chunks. -->
<script src="app.lang.js"></script>
<script src="app.loader.js"></script>
</body>
</html>