mirror of
https://github.com/tsl0922/EPD-nRF5.git
synced 2025-12-06 15:42:48 +08:00
initial clock mode impl
This commit is contained in:
@@ -68,7 +68,8 @@
|
||||
<input type="number" id="interleavedcount" value="50" min="0" max="500">
|
||||
</div>
|
||||
<div>
|
||||
<button id="synctimebutton" type="button" class="primary" onclick="syncTime()">日历模式</button>
|
||||
<button id="calendarmodebutton" type="button" class="primary" onclick="syncTime(1)">日历模式</button>
|
||||
<button id="clockmodebutton" type="button" class="primary" onclick="syncTime(2)">时钟模式</button>
|
||||
</div>
|
||||
<div>
|
||||
<button id="clearscreenbutton" type="button" class="secondary" onclick="clearScreen()">清除屏幕</button>
|
||||
@@ -113,7 +114,14 @@
|
||||
<legend>提示</legend>
|
||||
<p>驱动板上 LED 灯(如果有的话)闪烁的时候表示墨水屏处于<b>忙碌</b>状态,此时上位机发送的指令<b>可能不会被执行</b>。</p>
|
||||
<ul>
|
||||
<li><b>日历模式: </b>点击“日历模式”按钮将自动从浏览器同步时间到墨水屏,并切换到日历显示</li>
|
||||
<li><b>日历模式: </b>点击“日历模式”按钮将自动从浏览器同步时间到墨水屏,并切换到日历显示,每天凌晨更新日历</li>
|
||||
<li>
|
||||
<b>时钟模式: </b>点击“时钟模式”按钮将自动从浏览器同步时间到墨水屏,并切换到时钟显示,每分钟刷新一次时间
|
||||
<ul>
|
||||
<li>此功能为预览版,不建议日常使用,目前使用全刷实现(以后可能会支持局刷)</li>
|
||||
<li>三色屏请不要开启时钟模式(刷新太慢,如误点开启可以传图或者清屏退出)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><b>引脚配置:</b>格式为十六进制,顺序:MOSI/SCLK/CS/DC/RST/BUSY/BS/EN,前面 7 个引脚配置为必须,EN 为可选(没有用到的引脚可配置为 <code>FF</code>)</li>
|
||||
<li><b>确认间隔: </b>这个间隔指的是数据包数量间隔,即发送此数量的不确认响应的数据包后才发送一次需确认响应的数据包。加大此值可优化传图速度,但是丢包风险也更大(你可能会发现图片有部分位置显示不正常,此时需调小这个值)
|
||||
<li><b>指令列表: </b>支持的指令可在项目 README 查询(此功能一般只会在开发测试时用到)
|
||||
|
||||
@@ -105,18 +105,18 @@ async function setDriver() {
|
||||
await write(EpdCmd.INIT, document.getElementById("epddriver").value);
|
||||
}
|
||||
|
||||
async function syncTime() {
|
||||
async function syncTime(mode) {
|
||||
const timestamp = new Date().getTime() / 1000;
|
||||
const data = new Uint8Array([
|
||||
(timestamp >> 24) & 0xFF,
|
||||
(timestamp >> 16) & 0xFF,
|
||||
(timestamp >> 8) & 0xFF,
|
||||
timestamp & 0xFF,
|
||||
-(new Date().getTimezoneOffset() / 60)
|
||||
-(new Date().getTimezoneOffset() / 60),
|
||||
mode
|
||||
]);
|
||||
if(await write(EpdCmd.SET_TIME, data)) {
|
||||
addLog("日历模式:时间已同步!");
|
||||
addLog("需要一定时间刷新,请耐心等待。");
|
||||
addLog("时间已同步!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,8 @@ function updateButtonStatus() {
|
||||
const status = connected ? null : 'disabled';
|
||||
document.getElementById("reconnectbutton").disabled = (gattServer == null || gattServer.connected) ? 'disabled' : null;
|
||||
document.getElementById("sendcmdbutton").disabled = status;
|
||||
document.getElementById("synctimebutton").disabled = status;
|
||||
document.getElementById("calendarmodebutton").disabled = status;
|
||||
document.getElementById("clockmodebutton").disabled = status;
|
||||
document.getElementById("clearscreenbutton").disabled = status;
|
||||
document.getElementById("sendimgbutton").disabled = status;
|
||||
document.getElementById("setDriverbutton").disabled = status;
|
||||
|
||||
Reference in New Issue
Block a user