-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
381 lines (332 loc) · 15.1 KB
/
Copy pathindex.html
File metadata and controls
381 lines (332 loc) · 15.1 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>桌面快充站监控界面</title>
<link href="dependencies/font-awesome.min.css" rel="stylesheet" />
<link href="style.css" rel="stylesheet" />
<link href="../CGUI/typehint.css" rel="stylesheet" />
<script src="dependencies/tailwind-3.4.17.js"></script>
<script src="script.js"></script>
</head>
<body class="bg-dark text-light font-mono flex items-center justify-center min-h-screen">
<div class="flex flex-col p-1">
<div class="flex-1 text-center">开机初始化</div>
<div class="w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col" id="BootScreen">
</div>
</div>
<div class="flex flex-col p-1">
<div class="flex-1 text-center">主界面</div>
<div class="bg-dark w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col cg-screen" id="MainScreen">
<script type="text/c" class="cg-code">
SW3538_Status* ch = &status.channel[activeChannel >> 1];
uint16_t current = ((activeChannel&1) ? ch->usbA_cur : ch->usbC_cur);
uint16_t currentMax = ((activeChannel&1) ? ch->usbA_curMax : ch->usbC_curMax);
</script>
<div class="flex justify-between items-center">
<div class="flex items-center">
<i class="fa fa-bolt text-accent mr-1"></i>
<span class="text-xs font-bold">桌面快充站</span>
</div>
<div class="flex items-center">
<span class="text-xs cg-string" cg-alphabet="QC2.0QC3.0QC3+FCPSCPPDPPSPE1.1PE2.0VOOC1.0VOOC4.0SVOOCSFCPAFCTFCP" cg-bind="ch->protocolName" cg-padding="right">VOOC4.0</span>
<span class="status-indicator ml-1 bg-green-500 cg-image" cg-if-1="true|bg-red-500" cg-else="bg-green-500" cg-bind="CG_isEmptyString(ch->protocolName)" cg-dataType="bool"></span>
</div>
</div>
<div class="grid grid-cols-2 gap-1">
<div class="bg-gray-800 rounded p-1 text-center">
<div class="text-xs text-gray-400">电压</div>
<div class="text-primary text-base font-bold"><span class="cg-number" cg-padding="center" cg-bind="ch->vout" cg-dataType="uint16_t">20.000</span><span class="cg-hide">V</span></div>
</div>
<div class="bg-gray-800 rounded p-1 text-center">
<div class="text-xs text-gray-400">电流</div>
<div class="text-primary text-base font-bold"><span class="cg-number" cg-padding="center" cg-bind="current" cg-dataType="uint16_t">7.000</span><span class="cg-hide">A</span></div>
</div>
</div>
<div class="rounded" style="margin-top: -0.25rem">
<div class="flex justify-between items-center mb-1">
<span class="text-xs text-gray-400">功率</span>
<span class="text-primary font-bold"><span id="myPower" class="cg-number" cg-padding="right" cg-bind="status.power[activeChannel] / 100" cg-dataType="uint16_t">140.0</span><span class="cg-hide">W</span></span>
</div>
<!-- 注意,进度条结构是硬编码的两层嵌套 且只有一个子元素 -->
<div class="w-full bg-gray-700 rounded-full cg-bar" cg-bind="current * (uint32_t)148 / currentMax" cg-dir="right">
<div class="power-bar w-[46%]"></div>
</div>
<div class="flex justify-between text-xs mt-1">
<span>0W</span>
<span class="text-gray-400"><span class="cg-string" cg-alphabet="Ch12-AC" cg-bind="activeChannel" cg-dataType="uint8_t" cg-renderer="#ChannelRenderer">Ch1-A</span></span>
<span><span class="cg-number" cg-padding="right" cg-bind="ch->vset * currentMax / 1000000" cg-dataType="uint16_t">140</span><span class="cg-hide">W</span></span>
</div>
</div>
</div>
</div>
<script type="text/c" id="ChannelRenderer" cg-bufferSize="6">
buf[0] = 'C';
buf[1] = 'h';
buf[2] = (val >> 1) + '1';
buf[3] = '-';
buf[4] = (val & 1) ? 'A' : 'C';
buf[5] = 0; // 别忘了写零!
return buf;
</script>
<div class="flex flex-col p-1">
<div class="flex-1 text-center">扩展信息界面</div>
<div class="w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col relative cg-screen" id="ExtendInfoPage">
<script type="text/c" class="cg-code">
SW3538_Status* ch = &status.channel[activeChannel >> 1];
</script>
<div class="grid grid-cols-2 gap-1">
<div class="rounded p-1">
<div class="text-xs text-gray-400">输入电压</div>
<div class="text-secondary text-sm font-bold"><span class="cg-number" cg-padding="right" cg-bind="ch->vin / 10" cg-dataType="uint16_t">24.00</span><span class="cg-hide">V</span></div>
</div>
<div class="rounded p-1 flex flex-col" style="padding-bottom: 0">
<div class="text-xs text-gray-400">温度/风扇</div>
<!-- text-red-500 -->
<span class="text-secondary text-sm font-bold" ><span class="cg-number" cg-padding="right" cg-bind="ch->chipTemperature" cg-dataType="uint16_t">105.0</span><span class="cg-hide">°C</span></span>
<!-- text-red-500 -->
<span class="text-secondary text-sm font-bold cg-group" style="line-height: 1" cg-bind="status.fanSpeedSet > 0"><span class="cg-number" cg-padding="right" cg-bind="status.fanSpeed" cg-dataType="uint16_t">1500</span><span class="cg-hide">RPM</span></span>
</div>
<div class="rounded p-1" style="padding-top: 0">
<div class="text-xs text-gray-400">充电时间</div>
<div class="text-secondary text-sm font-bold"><span class="cg-string" cg-alphabet="0123456789:" cg-renderer="#RenderHMS" cg-bind="status.chargeTime[activeChannel] / COMM_FREQ" cg-dataType="uint32_t">00:01:23</span></div>
</div>
<div class="rounded p-1" style="padding-top: 0">
<div class="text-xs text-gray-400">已充容量</div>
<div class="text-secondary text-sm font-bold"><span class="cg-number" cg-padding="right" cg-bind="status.energy[activeChannel] / (3600 * 6 * COMM_FREQ)">100.00</span><span class="cg-hide">Wh</span></div>
</div>
</div>
<div class="flex justify-between items-center mb-1" style="position: absolute; bottom: -4px; width: 148px">
<div class="flex items-center">
<i class="text-sm fa fa-usb text-accent mr-1 cg-image" cg-if-1="!= 0|text-gray-700" cg-else="text-accent" cg-bind="ch->connection & 1" cg-dataType="int"></i>
<span class="text-sm font-bold">USB-A</span>
</div>
<div class="flex items-center">
<span class="status-indicator mr-1 bg-gray-700 cg-image" style="width: 18px; border-radius: 4px" cg-if-1="!= 0|bg-green-500" cg-else="bg-gray-700" cg-bind="ch->connection & 2" cg-dataType="int"></span>
<span class="text-sm font-bold">Type-C</span>
</div>
</div>
</div>
</div>
<script type="text/c" id="RenderHMS" cg-bufferSize="9">
// 99:99:99
buf[2] = ':';
buf[5] = ':';
buf[8] = '\0';
uint32_t i = val, p;
p = i/36000;
buf[0] = p+'0';
i -= p * 36000;
p = i/3600;
buf[1] = p+'0';
i -= p * 3600;
p = i/600;
buf[3] = p+'0';
i -= p * 600;
p = i/60;
buf[4] = p+'0';
i -= p*60;
p = i/10;
buf[6] = p+'0';
i -= p*10;
buf[7] = i+'0';
return buf;
</script>
<div class="flex flex-col p-1">
<div class="flex-1 text-center">功率变化趋势</div>
<div class="w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col" id="DiagramScreen">
<div class="h-full flex flex-col">
<div class="text-xs font-bold text-center mb-1">功率(W)</div>
<div class="flex-1 relative">
<canvas id="powerChart" width=150 height=80></canvas>
</div>
<div class="text-xs text-gray-400 flex justify-between mt-1">
<div>最高:140.0W</div>
<div>平均: 65.0W</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col p-1">
<div class="flex-1 text-center">系统设置</div>
<div class="w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col" id="ConfigScreen">
<div class="h-full overflow-y-auto scrollbar-thin pr-1">
<div class="text-xs font-bold text-center mb-2">系统配置</div>
<div class="space-y-2">
<!-- 配置项1 -->
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">自动关机时间</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">30分钟</span>
<i class="fa fa-chevron-right text-xs text-gray-500"></i>
</div>
</div>
<!-- 配置项2 -->
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">风扇配置</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">60°C</span>
<i class="fa fa-chevron-right text-xs text-gray-500"></i>
</div>
</div>
<!-- 配置项5 -->
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">屏幕亮度</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">中等</span>
<i class="fa fa-chevron-right text-xs text-gray-500"></i>
</div>
</div>
<!-- 配置项6 -->
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">语言设置</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">简体中文</span>
<i class="fa fa-chevron-right text-xs text-gray-500"></i>
</div>
</div>
<!-- 配置项7 -->
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">恢复出厂设置</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold text-red-500">重置</span>
<i class="fa fa-chevron-right text-xs text-gray-500"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col p-1">
<div class="flex-1 text-center">快充参数设置</div>
<div class="w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col" id="ChargeConfigScreen">
<div class="h-full overflow-y-auto scrollbar-thin pr-1">
<div class="text-xs font-bold text-center mb-2">通道1参数配置</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">协议开关</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">QC PD PPS</span>
<i class="fa fa-chevron-right text-xs text-gray-500"></i>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">功率限制</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">140W</span>
<i class="fa fa-undo text-xs text-gray-500"></i>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">PD 9V限流</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">5A</span>
<i class="fa fa-undo text-xs text-gray-500"></i>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">PD 12V限流</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">5A</span>
<i class="fa fa-undo text-xs text-gray-500"></i>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">PD 15V限流</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">5A</span>
<i class="fa fa-undo text-xs text-gray-500"></i>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">PD 20V限流</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">7A</span>
<i class="fa fa-undo text-xs text-gray-500"></i>
</div>
</div>
</div>
</div>
</div>
<div class="flex flex-col p-1">
<div class="flex-1 text-center">散热参数设置</div>
<div class="w-[160px] h-[128px] border-2 border-gray-700 rounded-lg p-1 flex flex-col" id="FanConfigScreen">
<div class="h-full overflow-y-auto scrollbar-thin pr-1">
<div class="text-xs font-bold text-center mb-2">热管理参数</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">启停温度</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">60°C</span>
<span class="text-sm font-bold">50°C</span>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">PWM步进/°C</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">20%</span>
<span class="text-sm font-bold">2%</span>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">跳闸温度</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">105°C</span>
<i class="fa fa-undo text-xs text-gray-500"></i>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">MOS工作频率</div>
<div class="flex justify-between items-center">
<span class="text-sm text-gray-500 font-bold">100k</span>
<span class="text-sm text-gray-500 font-bold">250k</span>
<span class="text-sm font-bold">500k</span>
</div>
</div>
<div class="bg-gray-800 rounded p-1">
<div class="text-xs text-gray-400">启用PFM调制</div>
<div class="flex justify-between items-center">
<span class="text-sm font-bold">Yes</span>
<span class="text-sm text-gray-500 font-bold">No</span>
</div>
</div>
</div>
</div>
</div>
<script src="../CGUI/daemon.js" async defer></script>
<!--script>
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 初始化图表
const ctx = document.getElementById('powerChart').getContext('2d');
const powerChart = new Chart(ctx, {
type: 'line',
data: {
labels: Array.from({length: 12}, (_, i) => i * 5),
datasets: [{
data: [0, 5.2, 10.8, 15.6, 18.9, 22.5, 25.8, 28.5, 26.2, 22.8, 18.5, 13.8],
borderColor: '#3b82f6',
borderWidth: 1,
pointRadius: 0,
tension: 0.4
}]
},
options: {
scales: {
x: {
ticks: {
display: false,
}
},
y: {
beginAtZero: true,
ticks: {
display: false,
}
}
}
}
});
});
</script-->
</body>
</html>