From b8d74ff0f5febda21a9f0688b3ad535c143e594e Mon Sep 17 00:00:00 2001 From: Frost-ZX Date: Tue, 24 Feb 2026 13:22:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20`lcdSetDirection`?= =?UTF-8?q?=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/main.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/assets/main.js b/assets/main.js index 8dafd4c..d8169d0 100644 --- a/assets/main.js +++ b/assets/main.js @@ -566,6 +566,25 @@ window.addEventListener('DOMContentLoaded', () => { } + /** + * @description 设置显示方向 + * @param {0|1} direction 显示方向 + * - 0:正常,1:上下翻转 + */ + async function lcdSetDirection(direction = 0) { + + let hexUse = []; + + hexUse.push(2); // LCD 多次写入命令 + hexUse.push(3); // 设置指令 + hexUse.push(10); // 显示方向指令 + hexUse.push(direction); + hexUse.push(0, 0); + + await sendData(hexUse); + + } + /** 设置 LCD 显示起始坐标 */ function lcdSetDisplayXY(lcdD0 = 0, lcdD1 = 0) { let hexUse = []; @@ -1250,4 +1269,9 @@ window.addEventListener('DOMContentLoaded', () => { })(); + // 调试 + (function () { + window.lcdSetDirection = lcdSetDirection; + })(); + });