This commit is contained in:
stark1898y 2025-05-22 11:49:10 +08:00
parent 0a51ba710b
commit 4790bbcd08
4 changed files with 76 additions and 16 deletions

View File

@ -35,10 +35,13 @@ static uint8_t key_press_cnt = 0;
void app_task_handler(TeAppEvtType app_evt_type)
{
// FEED_IWDG();
gValveData.bat = BSP_ReadVbat();
BSP_RequestBoost();
BSP_BlockSleep();
BSP_RequestBoost();
logDebug("BSP_RequestBoost");
DelayMs(5);
#if 1
switch (app_evt_type)
@ -47,9 +50,9 @@ void app_task_handler(TeAppEvtType app_evt_type)
{
logDebug("button short press");
DelayMs(30);
LDect_Init();
logDebug("LDect_Init");
// DelayMs(30);
// LDect_Init();
// logDebug("LDect_Init");
key_press_cnt++;
logDebug("key_press_cnt = %d", key_press_cnt);
@ -61,8 +64,32 @@ void app_task_handler(TeAppEvtType app_evt_type)
// tmos_set_event(led_task_id, LED_SHOW_START_EVT);
BSP_BlockSleep();
// BSP_RequestBoost();
DelayMs(3);
ShowLed();
DelayMs(5);
// ShowLed();
// 电压过低就关阀
if (gValveData.bat <= LOW_VABAT_ALARM_VALUE)
{
LED_ALL_OFF_DEINIT;
LED_Y_ON;
// BEEP_ON;
logDebug("LED_Y_ON");
}
else if (gValveData.switch_status == kUnknown || gValveData.switch_status == kClosed)
{
LED_ALL_OFF_DEINIT;
LED_R_ON;
logDebug("LED_R_ON");
}
else if (gValveData.switch_status == kOpened)
{
LED_ALL_OFF_DEINIT;
LED_G_ON;
logDebug("LED_G_ON");
}
// tmos_stop_task(led_task_id, LED_SHOW_ONCE_EVT);
// tmos_start_task(led_task_id, LED_SHOW_ONCE_EVT, 1000);
}
@ -75,8 +102,23 @@ void app_task_handler(TeAppEvtType app_evt_type)
gValveData.switch_status = kOpened;
BSP_BlockSleep();
// BSP_RequestBoost();
DelayMs(3);
ShowLed();
DelayMs(5);
// ShowLed();
if (gValveData.switch_status == kUnknown || gValveData.switch_status == kClosed)
{
LED_ALL_OFF_DEINIT;
LED_R_ON;
logDebug("LED_R_ON");
}
else if (gValveData.switch_status == kOpened)
{
LED_ALL_OFF_DEINIT;
LED_G_ON;
logDebug("LED_G_ON");
}
// tmos_stop_task(led_task_id, LED_SHOW_ONCE_EVT);
// tmos_start_task(led_task_id, LED_SHOW_ONCE_EVT, 1000);
}
@ -89,8 +131,23 @@ void app_task_handler(TeAppEvtType app_evt_type)
// tmos_set_event(led_task_id, LED_SHOW_START_EVT);
BSP_BlockSleep();
// BSP_RequestBoost();
DelayMs(3);
ShowLed();
DelayMs(5);
// ShowLed();
if (gValveData.switch_status == kUnknown || gValveData.switch_status == kClosed)
{
LED_ALL_OFF_DEINIT;
LED_R_ON;
logDebug("LED_R_ON");
}
else if (gValveData.switch_status == kOpened)
{
LED_ALL_OFF_DEINIT;
LED_G_ON;
logDebug("LED_G_ON");
}
// tmos_stop_task(led_task_id, LED_SHOW_ONCE_EVT);
// tmos_start_task(led_task_id, LED_SHOW_ONCE_EVT, 1000);
}
@ -112,7 +169,7 @@ void app_task_handler(TeAppEvtType app_evt_type)
LED_ALL_OFF_DEINIT;
BEEP_OFF_DEINIT;
LDect_Deinit();
// LDect_Deinit();
BSP_NoNeedBoost();
BSP_RequestSleep();

View File

@ -23,8 +23,8 @@ tmosTaskID led_task_id = INVALID_TASK_ID;
void ShowLed()
{
gValveData.bat = BSP_ReadVbat();
BSP_RequestBoost();
// gValveData.bat = BSP_ReadVbat();
// BSP_RequestBoost();
// 电压过低就关阀
if (gValveData.bat <= LOW_VABAT_ALARM_VALUE)

View File

@ -2,7 +2,7 @@
* @Author : stark1898y 1658608470@qq.com
* @Date : 2024-12-15 15:01:15
* @LastEditors : stark1898y 1658608470@qq.com
* @LastEditTime : 2025-05-21 17:23:23
* @LastEditTime : 2025-05-22 11:08:37
* @FilePath : \BLE_TYQ_CH584M\BSP\src\bsp_valve.c
* @Description :
*
@ -650,7 +650,10 @@ void BSP_VAVLE_Init(void)
tmos_start_task(vavle_task_id, VAVLE_LOOP_DECT_EVT, MS1_TO_SYSTEM_TIME(VALVE_DECT_PERIOD_MS));
LDect_Init();
// GPIOA_ResetBits(GPIO_Pin_2);
// GPIOA_ModeCfg(GPIO_Pin_2, GPIO_ModeIN_PU);
// LDect_Init();
#if 0
// PA2
/* 定时器3CAP捕捉 */

View File

@ -55,7 +55,7 @@ __HIGH_CODE
void BSP_NoNeedBoost(void)
{
block_boost_flag = true;
LDect_Deinit();
// LDect_Deinit();
BOOST_OFF_DEINIT;
}
@ -93,7 +93,7 @@ uint32_t CH58x_LowPower(uint32_t time)
// logDebug("block_sleep");
return 0;
}
LDect_Deinit();
// LDect_Deinit();
#if (defined(HAL_SLEEP)) && (HAL_SLEEP == TRUE)
volatile uint32_t i;
uint32_t time_tign, time_sleep, time_curr;