apptest 删除, 功能合入 disptest (APP V1.00.41)
- disptest 合并两段: 快速位检查(0-9/多位数/999.9/36.5F-C) + 全量程扫测(0.1-999.0 C+F) - 删除 apptest 命令与 CmdAppTest - 说明书 §8 同步(删除 apptest, 更新 disptest), 补 §4.1 三态驱动防鬼影说明 - 仅 APP 改动, Boot 不动 (仍 V1.00.07) - docs/开发日志.md: 新增 §70
This commit is contained in:
parent
44172e861a
commit
f34efe9070
11
docs/开发日志.md
11
docs/开发日志.md
@ -1663,3 +1663,14 @@ APP2 链接的镜像发向 APP1 区。设备端 END 校验(向量表 Reset PC
|
|||||||
涵盖硬件脚号映射、修正后的位序(DIG1百/DIG2十/DIG3个/DIG4单位F-C/DIG5小数/
|
涵盖硬件脚号映射、修正后的位序(DIG1百/DIG2十/DIG3个/DIG4单位F-C/DIG5小数/
|
||||||
DIG6-A°F/DIG6-B小数点)、Charlieplexing 段→脚公式、字符段码表、温度解码、
|
DIG6-A°F/DIG6-B小数点)、Charlieplexing 段→脚公式、字符段码表、温度解码、
|
||||||
软件接口、CLI 命令、踩坑记录与显示示例。无代码改动。
|
软件接口、CLI 命令、踩坑记录与显示示例。无代码改动。
|
||||||
|
|
||||||
|
## 70. `apptest` 删除,功能合入 `disptest`(2026-09-06,APP V1.00.41,仅 APP)
|
||||||
|
|
||||||
|
- 需求:去掉 `apptest` 命令,把它的温度量程扫测功能并入 `disptest`。
|
||||||
|
- 修改(`cli_core.c`):
|
||||||
|
- `CmdDispTest` 合并为两段——① 快速位/字符检查(0.0~9.0 → 12.3/456.7/999.9
|
||||||
|
→ 36.5F/36.5C);② 全量程扫测(0.1~9.9 步 0.1 → 10~99 步 1 → 100~990
|
||||||
|
步 10 → 999.0,摄氏+华氏各一轮);
|
||||||
|
- 删除 `CmdAppTest` 与 `apptest` 命令表条目;`disptest` help 更新。
|
||||||
|
- 版本:APP `V1.00.40` → `V1.00.41`(`APP_FW_VERSION_NUM` 0x00010028 →
|
||||||
|
0x00010029)。Boot 不动(仍 V1.00.07)。
|
||||||
|
|||||||
@ -65,6 +65,41 @@
|
|||||||
|
|
||||||
**扫描要点**:逐段点亮(每段 250µs)→ 点完立即把两脚切回高阻(输入)→ 点下一段;同一数字的多段不能同时点(脚共用,否则鬼影)。一个完整扫描帧约 20ms。
|
**扫描要点**:逐段点亮(每段 250µs)→ 点完立即把两脚切回高阻(输入)→ 点下一段;同一数字的多段不能同时点(脚共用,否则鬼影)。一个完整扫描帧约 20ms。
|
||||||
|
|
||||||
|
### 4.1 三态驱动与防鬼影(核心)
|
||||||
|
|
||||||
|
点亮某一段时,7 个脚里**只有 2 个是输出(一高一低),其余 5 个脚必须全部「高阻」(输入浮空,`GPIO_MODE_INPUT` + `GPIO_NO_PULL`)**——既不是置高、也不是置低。
|
||||||
|
|
||||||
|
**为什么其它脚不能置高/置低(鬼影机理)**:以「脚6 高、脚1 低」点亮段 `6→1` 为例:
|
||||||
|
|
||||||
|
| 其它脚状态 | 后果 |
|
||||||
|
|---|---|
|
||||||
|
| 脚3 也**置低** | 6 高 + 3 低 → 段 `6→3` 也被点亮(多余段)|
|
||||||
|
| 脚2 也**置高** | 2 高 + 1 低 → 段 `2→1` 也被点亮(多余段)|
|
||||||
|
| 脚7 置高、脚5 置低 | 段 `7→5` 亮,甚至形成 `6→5`、`7→1` 等一串串扰 |
|
||||||
|
|
||||||
|
即:任一其它脚为高就会变成「电流源」,为低就会变成「电流汇」,都会和当前高低脚对构成寄生回路点亮别的段。**唯一安全状态是浮空高阻**(既不供流也不吸流)。
|
||||||
|
|
||||||
|
**代码实现(`app_display.c`)**:
|
||||||
|
|
||||||
|
```c
|
||||||
|
pin_input(idx) → GPIO_MODE_INPUT + GPIO_NO_PULL /* 高阻(浮空输入)*/
|
||||||
|
pin_high(idx) → GPIO_MODE_OUTPUT_PP + GPIO_SetBits /* 推挽输出高 */
|
||||||
|
pin_low(idx) → GPIO_MODE_OUTPUT_PP + GPIO_ResetBits/* 推挽输出低 */
|
||||||
|
|
||||||
|
static void seg_pair_on(uint8_t h, uint8_t l)
|
||||||
|
{
|
||||||
|
pin_high(h); /* 1. 只把高脚切输出高 */
|
||||||
|
pin_low(l); /* 2. 只把低脚切输出低 —— 其余 5 脚保持高阻不动 */
|
||||||
|
delay_n_10us(25); /* 3. 点亮 250µs */
|
||||||
|
pin_input(h); /* 4. 点完立刻把两脚放回高阻 */
|
||||||
|
pin_input(l);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
支撑前提:`display_task` 每帧先 `all_pins_input()` 把 7 脚全部清成高阻,再逐段 `seg_pair_on`——因此任意时刻**最多 2 个脚是输出,其余恒为高阻**,杜绝串段。
|
||||||
|
|
||||||
|
**为什么必须逐段点(时间复用)**:7 脚复用,同一数字的多段脚对互相牵连、**不能同时点亮**。数字 8(7 段)就是 7×250µs 依次点亮,20ms 一帧内扫完,靠人眼视觉暂留看起来是"整字同时亮"。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. 字符段码表(bit0=A … bit6=G)
|
## 5. 字符段码表(bit0=A … bit6=G)
|
||||||
@ -119,8 +154,7 @@
|
|||||||
| `disp <value> [f]` | 设温度显示;`f` = 华氏(DIG4 显 F + DIG6-A 亮),默认摄氏 |
|
| `disp <value> [f]` | 设温度显示;`f` = 华氏(DIG4 显 F + DIG6-A 亮),默认摄氏 |
|
||||||
| `dispauto [on|off]` | 自动扫描开关(查询/设置)|
|
| `dispauto [on|off]` | 自动扫描开关(查询/设置)|
|
||||||
| `dispset <pin1-7\|all> [0\|1\|z]` | 手动驱动数码管脚:`0` 低 / `1` 高 / `z` 高阻;`all` 一键全脚 |
|
| `dispset <pin1-7\|all> [0\|1\|z]` | 手动驱动数码管脚:`0` 低 / `1` 高 / `z` 高阻;`all` 一键全脚 |
|
||||||
| `disptest` | 显示自检:0.0~9.0 → 12.3/456.7/999.9 → 36.5F/36.5C |
|
| `disptest` | 显示自检:① 0.0~9.0 → 12.3/456.7/999.9 → 36.5F/36.5C;② 全量程扫测 0.1~9.9(步0.1)→10~99(步1)→100~990(步10)→999.0,摄氏+华氏各一轮 |
|
||||||
| `apptest` | 温度量程扫测:0.1~9.9(步0.1) → 10~99(步1) → 100~990(步10) → 999.0,摄氏+华氏各一轮 |
|
|
||||||
| `pinset <pxN> [0\|1]` | 通用 GPIO 读写(非数码管专用)|
|
| `pinset <pxN> [0\|1]` | 通用 GPIO 读写(非数码管专用)|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -9,12 +9,12 @@
|
|||||||
#define __APP_VERSION_H__
|
#define __APP_VERSION_H__
|
||||||
|
|
||||||
#ifndef APP_FW_VERSION
|
#ifndef APP_FW_VERSION
|
||||||
#define APP_FW_VERSION "V1.00.40"
|
#define APP_FW_VERSION "V1.00.41"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Numeric form used by the BLE info query / OTA records: 0x00MMmmpp */
|
/* Numeric form used by the BLE info query / OTA records: 0x00MMmmpp */
|
||||||
#ifndef APP_FW_VERSION_NUM
|
#ifndef APP_FW_VERSION_NUM
|
||||||
#define APP_FW_VERSION_NUM 0x00010028u
|
#define APP_FW_VERSION_NUM 0x00010029u
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __APP_VERSION_H__ */
|
#endif /* __APP_VERSION_H__ */
|
||||||
|
|||||||
@ -795,17 +795,18 @@ static void CmdDispSet(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief "disptest": automated display self-test. Cycles the display through
|
* @brief "disptest": automated display self-test. First a quick digit/position
|
||||||
* ones digits 0..9, multi-digit values, max 999.9 and a degF value so
|
* check (0..9, multi-digit, max 999.9, degF toggle), then a full sweep
|
||||||
* every digit position (hundreds/tens/ones/F/tenths) and the DIG6-A
|
* of the temperature range 0.1..999.0 in both Celsius and Fahrenheit.
|
||||||
* indicator can be verified visually. Restores auto-scan when done.
|
* Restores auto-scan + 0.0 when done.
|
||||||
*/
|
*/
|
||||||
static void CmdDispTest(int argc, char* argv[])
|
static void CmdDispTest(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
static const float s_digits[10] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f,
|
static const float s_digits[10] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f,
|
||||||
5.0f, 6.0f, 7.0f, 8.0f, 9.0f };
|
5.0f, 6.0f, 7.0f, 8.0f, 9.0f };
|
||||||
uint8_t prev_auto = display_auto_get();
|
uint8_t prev_auto = display_auto_get();
|
||||||
uint32_t i;
|
uint16_t i;
|
||||||
|
uint8_t unit;
|
||||||
|
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
@ -813,12 +814,13 @@ static void CmdDispTest(int argc, char* argv[])
|
|||||||
/* the test drives values through display_set(), so auto must be on */
|
/* the test drives values through display_set(), so auto must be on */
|
||||||
display_auto_set(1u);
|
display_auto_set(1u);
|
||||||
|
|
||||||
cli_write("display self-test: 0.0..9.0 -> 12.3/456.7/999.9 -> 36.5F\r\n");
|
/* --- 1. quick digit / position check --- */
|
||||||
|
cli_write("disptest: 0.0..9.0 -> 12.3/456.7/999.9 -> 36.5F/C\r\n");
|
||||||
|
|
||||||
for (i = 0; i < 10u; i++)
|
for (i = 0u; i < 10u; i++)
|
||||||
{
|
{
|
||||||
display_set(s_digits[i], DISP_TYPE_CELSIUS, DISP_BASE_DECIMAL);
|
display_set(s_digits[i], DISP_TYPE_CELSIUS, DISP_BASE_DECIMAL);
|
||||||
cli_printf(" %lu.0\r\n", (unsigned long)i);
|
cli_printf(" %u.0\r\n", (unsigned)i);
|
||||||
vTaskDelay(pdMS_TO_TICKS(500));
|
vTaskDelay(pdMS_TO_TICKS(500));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -842,33 +844,12 @@ static void CmdDispTest(int argc, char* argv[])
|
|||||||
cli_write(" 36.5 C (degF indicator off)\r\n");
|
cli_write(" 36.5 C (degF indicator off)\r\n");
|
||||||
vTaskDelay(pdMS_TO_TICKS(1200));
|
vTaskDelay(pdMS_TO_TICKS(1200));
|
||||||
|
|
||||||
display_set(0.0f, DISP_TYPE_CELSIUS, DISP_BASE_DECIMAL);
|
/* --- 2. full temperature sweep, Celsius then Fahrenheit --- */
|
||||||
display_auto_set(prev_auto);
|
|
||||||
cli_write("display self-test done\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief "apptest": sweep the temperature display over 0.1..999.0 in both
|
|
||||||
* Celsius and Fahrenheit so every digit position (hundreds/tens/ones/
|
|
||||||
* tenths), the F/C unit letter and the DIG6-A indicator are exercised.
|
|
||||||
* Restores auto-scan + 0.0 when done.
|
|
||||||
*/
|
|
||||||
static void CmdAppTest(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
uint8_t prev_auto = display_auto_get();
|
|
||||||
uint16_t i;
|
|
||||||
uint8_t unit;
|
|
||||||
|
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
|
|
||||||
display_auto_set(1u);
|
|
||||||
|
|
||||||
for (unit = 0u; unit < 2u; unit++)
|
for (unit = 0u; unit < 2u; unit++)
|
||||||
{
|
{
|
||||||
uint8_t type = (unit == 0u) ? DISP_TYPE_CELSIUS : DISP_TYPE_FAHRENHEIT;
|
uint8_t type = (unit == 0u) ? DISP_TYPE_CELSIUS : DISP_TYPE_FAHRENHEIT;
|
||||||
|
|
||||||
cli_printf("apptest sweep %s: 0.1..9.9 -> 10..99 -> 100..999\r\n",
|
cli_printf("disptest sweep %s: 0.1..9.9 -> 10..99 -> 100..999\r\n",
|
||||||
(unit == 0u) ? "C" : "F");
|
(unit == 0u) ? "C" : "F");
|
||||||
|
|
||||||
for (i = 1u; i <= 99u; i++) /* 0.1 .. 9.9 step 0.1 */
|
for (i = 1u; i <= 99u; i++) /* 0.1 .. 9.9 step 0.1 */
|
||||||
@ -892,7 +873,7 @@ static void CmdAppTest(int argc, char* argv[])
|
|||||||
|
|
||||||
display_set(0.0f, DISP_TYPE_CELSIUS, DISP_BASE_DECIMAL);
|
display_set(0.0f, DISP_TYPE_CELSIUS, DISP_BASE_DECIMAL);
|
||||||
display_auto_set(prev_auto);
|
display_auto_set(prev_auto);
|
||||||
cli_write("apptest done\r\n");
|
cli_write("disptest done\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Command table; add new commands here */
|
/* Command table; add new commands here */
|
||||||
@ -914,8 +895,7 @@ static const CliCmd_t s_cmds[] = {
|
|||||||
{"disp", "disp <value> [f]: set temperature display (0-999.9, 1 dec)", CmdDisp},
|
{"disp", "disp <value> [f]: set temperature display (0-999.9, 1 dec)", CmdDisp},
|
||||||
{"dispauto", "dispauto [on|off]: enable/disable auto display scan", CmdDispAuto},
|
{"dispauto", "dispauto [on|off]: enable/disable auto display scan", CmdDispAuto},
|
||||||
{"dispset", "dispset <pin1-7|all> [0|1|z]: drive display pin(s)", CmdDispSet},
|
{"dispset", "dispset <pin1-7|all> [0|1|z]: drive display pin(s)", CmdDispSet},
|
||||||
{"disptest", "disptest: run display self-test (digits/multi/max/degF)", CmdDispTest},
|
{"disptest", "disptest: display self-test + full 0.1-999.0 sweep (C/F)", CmdDispTest},
|
||||||
{"apptest", "apptest: sweep display 0.1-999.0 in C and F", CmdAppTest},
|
|
||||||
{"factory", "factory: restore params to defaults and reboot", CmdFactory},
|
{"factory", "factory: restore params to defaults and reboot", CmdFactory},
|
||||||
{"uartrst", "uartrst: re-init USART1 (460800 8N1), flush rx queue", CmdUartRst},
|
{"uartrst", "uartrst: re-init USART1 (460800 8N1), flush rx queue", CmdUartRst},
|
||||||
{"uartinfo", "uartinfo: show USART1 pins/baud/format", CmdUartInfo},
|
{"uartinfo", "uartinfo: show USART1 pins/baud/format", CmdUartInfo},
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"file": "mothercup_ble_prod_ota.bin",
|
"file": "mothercup_ble_prod_ota.bin",
|
||||||
"target_bank": 1,
|
"target_bank": 1,
|
||||||
"size": 60052,
|
"size": 59928,
|
||||||
"crc32": "0xCB612B01",
|
"crc32": "0xBC3F632D",
|
||||||
"version": 65576
|
"version": 65577
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"file": "mothercup_ble_prod_ota_app2.bin",
|
"file": "mothercup_ble_prod_ota_app2.bin",
|
||||||
"target_bank": 2,
|
"target_bank": 2,
|
||||||
"size": 60352,
|
"size": 60228,
|
||||||
"crc32": "0x01AB370F",
|
"crc32": "0x3BE600E0",
|
||||||
"version": 65576
|
"version": 65577
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user