V1.5: OLED新增复位脚PB14,初始化前10ms低脉冲硬复位屏幕

This commit is contained in:
helei 2026-08-22 23:00:49 +08:00
parent c8e88b7271
commit 70772f021e
3 changed files with 24 additions and 7 deletions

View File

@ -17,6 +17,8 @@
#define OLED_FSO_PIN GPIO_PIN_6
#define OLED_CS2_PORT GPIOB
#define OLED_CS2_PIN GPIO_PIN_15
#define OLED_RST_PORT GPIOB
#define OLED_RST_PIN GPIO_PIN_14 /* 复位脚,低电平复位(板内上拉,默认拉高即可) */
#define lcd_cs1(a) HAL_GPIO_WritePin(OLED_CS1_PORT, OLED_CS1_PIN, (GPIO_PinState)(a))
#define lcd_dc(a) HAL_GPIO_WritePin(OLED_DC_PORT, OLED_DC_PIN, (GPIO_PinState)(a))
@ -73,6 +75,14 @@ static void oled_gpio_init(void)
g.Pin = OLED_CS1_PIN; HAL_GPIO_Init(OLED_CS1_PORT, &g);
g.Pin = OLED_CS2_PIN; HAL_GPIO_Init(OLED_CS2_PORT, &g);
/* RST(PB14):推挽输出,默认高(板内上拉,这里也主动拉高) */
HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_SET);
g.Pin = OLED_RST_PIN;
g.Mode = GPIO_MODE_OUTPUT_PP;
g.Pull = GPIO_NOPULL;
g.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(OLED_RST_PORT, &g);
fso_output();
}
@ -124,6 +134,12 @@ void oled_init(void)
{
HAL_Delay(400); /* µÈÆÁÄ»/×Ö¿âÉϵçÎȶ¨ */
oled_gpio_init();
/* 硬件复位一次屏幕RST 低 10ms保证从确定状态开始初始化 */
HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_RESET);
HAL_Delay(10);
HAL_GPIO_WritePin(OLED_RST_PORT, OLED_RST_PIN, GPIO_PIN_SET);
HAL_Delay(120);
lcd_cs1(0);
rom_cs2(1);
oled_write(0, 0xAE); /* display off */

View File

@ -31,7 +31,7 @@ extern UART_HandleTypeDef huart3;
*
*/
/*===== 固件版本号(开机横幅打印用,改版本只动这里) =====*/
#define FIRMWARE_VERSION_STR "1.5.8"
#define FIRMWARE_VERSION_STR "1.5.9"
#define PRODUCT_WITH_FEED_SCALE 1 /* 默认带秤EEPROM 172 可改,蓝牙 SCALE0/1 切换) */
@ -54,14 +54,14 @@ extern UART_HandleTypeDef huart3;
//#define MQTT_PASSWORD "b612c2839c135934"
////RTOS版-投料机-无蠕变磅秤-01
//#define MQTT_CLIENT_ID "46c080c385c3652e"
//#define MQTT_USERNAME "766990788193702677"
//#define MQTT_PASSWORD "6ae9622b7034326b"
#define MQTT_CLIENT_ID "46c080c385c3652e"
#define MQTT_USERNAME "766990788193702677"
#define MQTT_PASSWORD "6ae9622b7034326b"
//RTOS版-投料机-无蠕变磅秤-03
#define MQTT_CLIENT_ID "5791a8579d459290"
#define MQTT_USERNAME "766990788193702677"
#define MQTT_PASSWORD "5f6cd7748ec9db35"
//#define MQTT_CLIENT_ID "5791a8579d459290"
//#define MQTT_USERNAME "766990788193702677"
//#define MQTT_PASSWORD "5f6cd7748ec9db35"
#define MQTT_SERVER_IP "58.17.14.95"
#define MQTT_SERVER_PORT 1880

View File

@ -207,3 +207,4 @@
- 断电时序微调:确认断电后先关 OLED 屏再发掉电消息(黑屏更快+给模组留更多发送电量)
- 断电时序改为:先发掉电消息(等OK) → 屏幕显示"发生掉电事件!"亮 3 秒 → 熄屏复位
- 蓝牙设置流程开头先硬复位模块BT_RST/PA7 拉高 100ms防模块状态异常时 PC5 进不了 AT 模式
- OLED 新增复位脚 PB14初始化前给 10ms 低脉冲硬件复位屏幕,防止上电时序异常花屏