修复断电轮换保存及蓝牙广播构建
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "light_transition.h"
|
||||
#include "pwm.h"
|
||||
#include "rf433_decoder.h"
|
||||
#include "timeslice.h"
|
||||
union rf433_flag rf_flag = {0};
|
||||
unsigned char high_level_time;
|
||||
unsigned char low_level_time;
|
||||
@@ -415,7 +416,6 @@ void _433_fun(){
|
||||
return;
|
||||
}
|
||||
|
||||
sss=1;//记忆标志位
|
||||
switch(res_data){
|
||||
//椭圆
|
||||
case ON://单击
|
||||
@@ -496,6 +496,7 @@ void _433_fun(){
|
||||
}
|
||||
break;
|
||||
}
|
||||
set_TaskComps_timer(2U, 1000U);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "PWM.h"
|
||||
#include "RF433.h"
|
||||
#include "xc60xx.h"
|
||||
#include "timeslice.h"
|
||||
|
||||
/*------------------------------------------------------------------------------------
|
||||
Macros
|
||||
@@ -77,6 +78,8 @@ unsigned char get_checksum(unsigned char *ptrdata, unsigned char length)
|
||||
#define FLASH_POWER_MODE_INDEX 28U
|
||||
#define FLASH_POWER_CYCLE_INDEX 29U
|
||||
#define FLASH_POWER_MODE_MARK 0xA7U
|
||||
#define USER_STATE_SAVE_DELAY_MS 1000U
|
||||
#define POWER_CYCLE_BOOT_SAVE_DELAY_MS 100U
|
||||
|
||||
uint8_t power_restore_policy = POWER_RESTORE_CYCLE_STATIC;
|
||||
static uint8_t power_cycle_next_color;
|
||||
@@ -240,10 +243,13 @@ void power_restore_policy_set(uint8_t policy)
|
||||
{
|
||||
if(policy > POWER_RESTORE_CYCLE_STATIC) return;
|
||||
|
||||
power_restore_policy = policy;
|
||||
if(policy == POWER_RESTORE_CYCLE_STATIC)
|
||||
/* Re-sending the active policy must not restart the color sequence. */
|
||||
if(policy == POWER_RESTORE_CYCLE_STATIC &&
|
||||
power_restore_policy != POWER_RESTORE_CYCLE_STATIC)
|
||||
power_cycle_next_color = 0U;
|
||||
sss = 1U;
|
||||
|
||||
power_restore_policy = policy;
|
||||
set_TaskComps_timer(2U, USER_STATE_SAVE_DELAY_MS);
|
||||
}
|
||||
|
||||
void power_restore_apply_on_boot(void)
|
||||
@@ -280,5 +286,9 @@ void power_restore_apply_on_boot(void)
|
||||
}
|
||||
|
||||
power_cycle_next_color = (uint8_t)((color + 1U) % 3U);
|
||||
sss = 1U;
|
||||
|
||||
/* Persist the next color after startup while input power is stable.
|
||||
* This sequence does not depend on a shutdown-time flash write.
|
||||
*/
|
||||
set_TaskComps_timer(2U, POWER_CYCLE_BOOT_SAVE_DELAY_MS);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ void uart_receive_cb(uint8_t *buff, uint16_t len)
|
||||
void scan_uar_data(uint8_t *frame){
|
||||
|
||||
}
|
||||
extern uint8_t sss;
|
||||
uint8_t rx_date;
|
||||
void scan_uart(uint8_t *arr)
|
||||
{
|
||||
@@ -106,8 +105,6 @@ void scan_uart(uint8_t *arr)
|
||||
checksum += user_rx_buf[i];
|
||||
}
|
||||
user_rx_buf[5] = checksum; // 校验位
|
||||
sss=1;
|
||||
// printf("sss=%d\r\n",sss);
|
||||
switch (user_rx_buf[4])
|
||||
{
|
||||
|
||||
@@ -178,7 +175,7 @@ void scan_uart(uint8_t *arr)
|
||||
|
||||
break;
|
||||
}
|
||||
//set_TaskComps_timer(2,1000);
|
||||
set_TaskComps_timer(2U, 1000U);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user