67 lines
1.6 KiB
Markdown
67 lines
1.6 KiB
Markdown
# 远程显示通信工具
|
||
|
||
与 `HMI/RemoeDisp/RemoDispBus.c` 协议兼容的 Python 客户端,用于远程查看装置 LCD 显存并模拟按键。
|
||
|
||
## 协议说明
|
||
|
||
- **端口**: 7003
|
||
- **报文格式**:
|
||
- 工具 → 装置: `[0xAA][功能码][长度高][长度低][数据...][CRC]`
|
||
- 装置 → 工具: `[0xBB][功能码][长度高][长度低][数据...][CRC]`
|
||
- **CRC**: 数据区异或校验
|
||
- **功能码**: KEEPLIVE=0, INIT=1, KEY=2, LCDMEM=3
|
||
|
||
## 命令行工具 (remo_disp_client.py)
|
||
|
||
```bash
|
||
# 安装可选依赖(用于保存 PNG)
|
||
pip install -r requirements.txt
|
||
|
||
# 获取初始化信息
|
||
python remo_disp_client.py 192.168.1.100 --init
|
||
|
||
# 拉取显存并保存为 screen.png
|
||
python remo_disp_client.py 192.168.1.100 --screen
|
||
|
||
# 发送按键 (U/D/L/R/ENT/ESC/F1/F2)
|
||
python remo_disp_client.py 192.168.1.100 --key ENT
|
||
|
||
# 发送 KEEPLIVE
|
||
python remo_disp_client.py 192.168.1.100 --keepalive
|
||
```
|
||
|
||
## GUI 查看器 (remo_disp_viewer.py)
|
||
|
||
```bash
|
||
python remo_disp_viewer.py 192.168.1.100
|
||
```
|
||
|
||
- 连接装置并实时显示 LCD 画面
|
||
- 点击按键模拟远程按键
|
||
- 点击「刷新」重新拉取显存
|
||
|
||
## Web 界面 (remo_disp_server.py + remo_disp_ui.html)
|
||
|
||
```bash
|
||
pip install flask
|
||
python remo_disp_server.py
|
||
```
|
||
|
||
启动后访问 http://localhost:8080 ,界面包含:
|
||
- 顶部菜单:连接、设置、退出、关于
|
||
- 左侧显示区:装置 LCD 画面(约 500ms 刷新)
|
||
- 右侧控制:方向键 + 确认、复归、返回
|
||
|
||
## 按键映射
|
||
|
||
| 键名 | 值 |
|
||
|------|------|
|
||
| 上 | 0x02 |
|
||
| 下 | 0x40 |
|
||
| 左 | 0x10 |
|
||
| 右 | 0x08 |
|
||
| 确认 | 0x20 |
|
||
| 取消 | 0x01 |
|
||
| F1 | 0x04 |
|
||
| F2 | 0x80 |
|