补充图片,说明,注释,显示

This commit is contained in:
james 2024-08-09 17:56:04 +08:00
parent 5a90df0da8
commit 207c11051f
9 changed files with 63 additions and 5 deletions

View File

@ -1,6 +1,8 @@
# My_project
# 红外遥控贪吃蛇/显示+上传温度等数据
### 红外遥控贪吃蛇
![alt text](b237ba08cf67df9f82eaf7ebc1e8855.jpg)
### 红外遥控器
| 编号key| 功能 |
| :----: | :----: |
@ -14,6 +16,7 @@
| 0x88 | 菜单 |
| 0x28 | 退出 |
### LCD 显示温湿度
![LCD温湿度](/my_picture/lcdtemp.jpg)
左上角是00 →x↓y
@ -21,6 +24,45 @@
### 简易贪吃蛇
![alt text](/my_picture/660c6c04fddc1bd3ccbe4255df5d449.jpg)
### 页面切换、冻结(贪吃蛇与数据显示)
``` c
// 菜单(切换页面)
if (repeat == 0 && (rt_strcmp(tmp, "88") == 0 || rt_strcmp(tmp, "11") == 0))
{
page_chosen = (page_chosen % PAGE_MAX) + 1;
page_first = 1;
rt_kprintf("page_chosen = %d\n", page_chosen);
}
// 确认(暂停、页面冻结)
if (repeat == 0 && (rt_strcmp(tmp, "73") == 0))
{
page_stop = (page_stop + 1) % 2;
if (page_stop == 1)
{
lcd_show_string(240 - 24 * 3, 240 - 24, 24, "Stop");
}
else
{
lcd_show_string(240 - 24 * 3, 240 - 24, 24, " ");
}
}
```
### MQTT上传到阿里云
#### 光照强度
![alt text](my_picture/光照强度.png)
#### 接近感应
![alt text](my_picture/接近感应.png)
#### 蛇长
![alt text](my_picture/蛇长.png)
#### 湿度
![alt text](my_picture/湿度.png)
#### 温度
![alt text](my_picture/温度.png)
### 显示时间
# STM32F407 星火一号开发板 BSP 说明
## 简介

BIN
my_picture/光照强度.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
my_picture/接近感应.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

BIN
my_picture/温度.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
my_picture/湿度.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
my_picture/蛇长.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -8,6 +8,7 @@
#define DBG_LVL DBG_LOG
#include <rtdbg.h>
#include <ulog.h>
#include <drv_lcd.h>
/* 配置 LED 灯引脚 */
#define PIN_LED_B GET_PIN(F, 11) // PF11 : LED_B --> LED
@ -26,29 +27,41 @@ void snake_compare(rt_uint8_t key, rt_uint8_t repeat)
{
rt_sprintf(tmp, "%02X", key);
rt_atomic_store(&snake_pressed, snake_max + 1);
// 上
if (rt_strcmp(tmp, "30") == 0 || rt_strcmp(tmp, "53") == 0)
if (rt_atomic_load(&now_direction) != 2)
rt_atomic_store(&now_direction, 0);
// 左
if (rt_strcmp(tmp, "E8") == 0 || rt_strcmp(tmp, "99") == 0)
if (rt_atomic_load(&now_direction) != 3)
rt_atomic_store(&now_direction, 1);
// 下
if (rt_strcmp(tmp, "B0") == 0 || rt_strcmp(tmp, "4B") == 0)
if (rt_atomic_load(&now_direction) != 0)
rt_atomic_store(&now_direction, 2);
// 右
if (rt_strcmp(tmp, "68") == 0 || rt_strcmp(tmp, "83") == 0)
if (rt_atomic_load(&now_direction) != 1)
rt_atomic_store(&now_direction, 3);
// 菜单(切换页面)
if (repeat == 0 && (rt_strcmp(tmp, "88") == 0 || rt_strcmp(tmp, "11") == 0))
{
page_chosen = (page_chosen % PAGE_MAX) + 1;
page_first = 1;
rt_kprintf("page_chosen = %d\n", page_chosen);
}
if (repeat == 0 && (rt_strcmp(tmp, "73") == 0 ))
// 确认(暂停、页面冻结)
if (repeat == 0 && (rt_strcmp(tmp, "73") == 0))
{
page_stop = (page_stop + 1) % 2;
if (page_stop == 1)
{
lcd_show_string(240 - 24 * 3, 240 - 24, 24, "Stop");
}
else
{
lcd_show_string(240 - 24 * 3, 240 - 24, 24, " ");
}
}
}

View File

@ -205,13 +205,14 @@ void tmp_payload(void)
{
if (page_first)
{
rt_kprintf("page:Data\n");
my_round(20);
page_first = 0;
}
show_lcd();
}
if (ps_data > 14)
if (ps_data > 1022)
{
page_chosen = (page_chosen % PAGE_MAX) + 1;
page_first = 1;

View File

@ -58,10 +58,12 @@ void snake_entry(void *parameter)
int new_direction = 0,snake_now=0;
while (1)
{
if (page_chosen == 1&&!page_stop)
{
if (page_first == 1)
{
rt_kprintf("page:snake\n");
page_first = 0;
lcd_fill(0, 0, 240, 240, WHITE);
snake_address(snake_food[0], snake_food[1], SNAKE_SIZE, GREEN);