From 6fa1d878885519ab8072c0b418b1f5ad5b4487e3 Mon Sep 17 00:00:00 2001 From: "carlos.meng" <7754760+meng_zhengwei@user.noreply.gitee.com> Date: Sat, 14 Jun 2025 21:28:11 +0800 Subject: [PATCH] =?UTF-8?q?docs=20(qrcode):=20=E6=9B=B4=E6=96=B0=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E5=8A=9F=E8=83=BD=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.新增二维码旋转功能参数 2.新增常量说明可设置二维码旋转角度 3.删除支持二维码功能的模组描述,性能资源足够的情况下,理论上全平台可支持二维码功能 4.新增获取二维码数据接口描述 固件版本: N/A 是否需要文案翻译: 否 --- en/medialib/qrcode.md | 42 +++++++++++++++++++++++++++++++++++++++--- zh/medialib/qrcode.md | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 77 insertions(+), 6 deletions(-) diff --git a/en/medialib/qrcode.md b/en/medialib/qrcode.md index f5d0ae4..6f036e5 100644 --- a/en/medialib/qrcode.md +++ b/en/medialib/qrcode.md @@ -7,7 +7,7 @@ Feature introduction: generate a corresponding QR code according to the input co ### `qrcode.show` ```python -qrcode.show(qrcode_str,magnification,start_x,start_y,Background_color,Foreground_color) +qrcode.show(qrcode_str,magnification,start_x,start_y,Background_color,Foreground_color,Rotate) ``` Displays QR codes to LCD. @@ -20,8 +20,9 @@ Displays QR codes to LCD. - `start_y` - Integer type. The start y coordinate of the displayed QR code. - `Background_color` - Integer type. Background color. Default value: 0xffff. - `Foreground_color` - Integer type. Foreground color. Default value: 0x0000. +- `Rotate` - Integer type. Rotation angle. Reference [Constant](#constant). Default value: 0. -**Return Value** +**Return Value:** `0` - Successful execution @@ -29,4 +30,39 @@ Displays QR codes to LCD. `-2` - Magnification failed -`-3` - Display failed \ No newline at end of file +`-3` - Display failed + +## Generation QR Code Data + +### `qrcode.getQRData` + +```python +qrcode.getQRData(qrcode_str,magnification,Background_color,Foreground_color) +``` + +Generation QR code and retrieve data. + +**Parameter:** + +- `qrcode_str` - String type. QR code content. +- `magnification` - Integer type. Magnification. Range: 1–6. +- `Background_color` - Integer type. Background color. Default value: 0xffff. +- `Foreground_color` - Integer type. Foreground color. Default value: 0x0000. + +**Return Value:** + +`-1` - QR code generation failed + +Return tuple upon success `(side_length, data)` + +- `side_length`: Side length of QR code. +- `data`: Data of QR code. + +## Constant + +| Constant | Value | Description | +| ------------------- | ----- | ------------------------------------------------------ | +| `qrcode.ROTATE_0` | 0 | QR code display without rotation | +| `qrcode.ROTATE_90` | 1 | Rotate the QR code clockwise by 90 degrees to display | +| `qrcode.ROTATE_180` | 2 | Rotate the QR code clockwise by 180 degrees to display | +| `qrcode.ROTATE_270` | 3 | Rotate the QR code clockwise by 270 degrees to display | \ No newline at end of file diff --git a/zh/medialib/qrcode.md b/zh/medialib/qrcode.md index bd505e5..efc791a 100644 --- a/zh/medialib/qrcode.md +++ b/zh/medialib/qrcode.md @@ -2,14 +2,12 @@ 根据输入的内容,生成对应的二维码。 -> 当前支持的型号:EC600N/EC800N系列。 - ## 二维码显示功能 ### `qrcode.show` ```python -qrcode.show(qrcode_str,magnification,start_x,start_y,Background_color,Foreground_color) +qrcode.show(qrcode_str,magnification,start_x,start_y,Background_color,Foreground_color,Rotate) ``` 显示二维码到LCD。 @@ -22,7 +20,44 @@ qrcode.show(qrcode_str,magnification,start_x,start_y,Background_color,Foreground - `start_y`-int类型,二维码显示起始y坐标; - `Background_color`-int类型,前景色(不设置即默认为0xffff); - `Foreground_color`-int类型,背景色(不设置即默认为0x0000)。 +- `Rotate`-int类型,旋转角度,[见常量](#常量)(不设置即默认为0)。 **返回值描述:** `0`表示成功,`-1`表示生成二维码失败,`-2`表示放大失败,`-3`表示显示失败。 + +## 生成二维码数据 + +### `qrcode.getQRData` + +```python +qrcode.getQRData(qrcode_str,magnification,Background_color,Foreground_color) +``` + +生成并获取二维码显示数据。 + +**参数描述:** + +- `qrcode_str`-string类型,二维码内容; +- `magnification`-int类型,放大倍数[1,6]; +- `Background_color`-int类型,前景色(不设置即默认为0xffff); +- `Foreground_color`-int类型,背景色(不设置即默认为0x0000)。 + +**返回值描述:** + +`-1`表示生成二维码失败。 + +成功返回元组`(side_length, data)` + +- `side_length`:二维码边长。 +- `data`:二维码显示数据。 + +## 常量 + +| 常量 | 值 | 说明 | +| ------------------- | ---- | ------------------------ | +| `qrcode.ROTATE_0` | 0 | 二维码不旋转显示 | +| `qrcode.ROTATE_90` | 1 | 二维码顺时针旋转90°显示 | +| `qrcode.ROTATE_180` | 2 | 二维码顺时针旋转180°显示 | +| `qrcode.ROTATE_270` | 3 | 二维码顺时针旋转270°显示 | + -- Gitee