add occupy/vacant color control of dark for ATAL

This commit is contained in:
Yunhorn 2025-06-18 12:39:01 +08:00
parent db4200b575
commit 1a436f6a2c
8 changed files with 48 additions and 12 deletions

View File

@ -247,7 +247,7 @@
#define MajorVer 25U
#define MinorVer 6U
#define SubMinorVer 17U
#define SubMinorVer 18U
#define FirmwareVersion 3U
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U

View File

@ -652,7 +652,7 @@ typedef struct sts_cfg_nvm {
uint8_t length; // length of following parameters except AC CODE(20bytes)
uint8_t p[STS_O7_CFG_PCFG_SIZE];
uint8_t reserve02;
uint8_t color_occupy_vacant; // occupy color and vacant color define, C_OCCUPY<<4|C_VACANT
uint8_t reserve03;
uint8_t sensor_install_height_in_10cm;
uint8_t alarm_parameter05;

View File

@ -56,6 +56,12 @@ extern volatile uint8_t sts_service_mask;
extern volatile uint8_t sts_work_mode;
volatile uint8_t sts_reed_hall_ext_int = 0;
volatile uint8_t sts_status_color = STS_GREEN;
#ifdef ATAL
volatile uint8_t sts_color_occupy_vacant = (STS_RED<<4)|(STS_DARK&0x0f);
#else
volatile uint8_t sts_color_occupy_vacant = (STS_RED<<4)|(STS_GREEN&0x0f);
#endif
volatile uint8_t sts_lamp_bar_color = STS_GREEN; //puColor
volatile uint8_t sts_lamp_bar_flashing_color = STS_RED_DARK; //0x23; RED_BLUE;
volatile uint8_t sts_cloud_netcolor = STS_GREEN; //netColor

View File

@ -81,7 +81,7 @@ extern volatile uint8_t sts_presence_fall_detection;
extern volatile uint8_t last_sts_fall_rising_detected_result;
extern volatile uint8_t sts_time_c_threshold;
extern volatile uint16_t sts_motionless_duration_threshold_in_min;
extern volatile uint8_t sts_status_color, sts_lamp_bar_color;//puColor
extern volatile uint8_t sts_status_color, sts_lamp_bar_color, sts_color_occupy_vacant;//puColor
extern volatile uint8_t sts_cloud_netcolor; //netColor
extern uint8_t luminance_level;
SysTime_t mems_event_time;
@ -137,6 +137,9 @@ char sts_presence_fall_detection_message[10][20]={
#endif
#define STS_COLOR_DEFAULT_VACANT (sts_color_occupy_vacant&0x0f)
#define STS_COLOR_DEFAULT_OCCUPY ((sts_color_occupy_vacant>>4)&0x0f)
/*
// UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
@ -395,11 +398,13 @@ void STS_YunhornSTSEventP3_Process(void)
#if (defined(STS_O6) ||defined(STS_O7))
if (STS_Reed_Hall_State == STS_Status_Door_Open)
{
sts_lamp_bar_color =STS_GREEN;
// sts_lamp_bar_color =STS_GREEN;
sts_lamp_bar_color = STS_COLOR_DEFAULT_VACANT;
}
else
{
sts_lamp_bar_color =STS_RED;
// sts_lamp_bar_color =STS_RED;
sts_lamp_bar_color = STS_COLOR_DEFAULT_OCCUPY;
}
STS_Lamp_Bar_Scoller(sts_lamp_bar_color, luminance_level);
#endif

View File

@ -25,7 +25,7 @@
#include "stm32_seq.h"
/* USER CODE BEGIN Includes */
#include "sts_lamp_bar.h"
/* USER CODE END Includes */
/* External variables ---------------------------------------------------------*/

View File

@ -57,7 +57,7 @@ extern volatile uint8_t sts_hall1_read, sts_hall2_read, sts_hall3_read, sts_hall
volatile uint8_t last_sts_hall1_read=STS_Status_Door_Open, last_sts_hall2_read=STS_Status_SOS_Release, last_sts_hall3_read=STS_Status_Door_Open, last_sts_hall4_read=STS_Status_Door_Open ;
volatile uint8_t sts_reed_hall_result =0, sts_emergency_button_pushed=0; // inital 0 = close
extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color;
extern volatile uint8_t sts_work_mode, sts_cloud_netcolor, sts_lamp_bar_color, sts_status_color, sts_color_occupy_vacant;
extern volatile uint8_t sts_lamp_bar_flashing_color;
volatile uint8_t last_sts_lamp_bar_color=STS_DARK;
extern volatile uint8_t sts_rss_result;
@ -128,7 +128,11 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
0x6E, //P[18] RSS_CFG_BG_MOTION_NOISE 2025-04-14
0x8C, //P[19] RSS SLIDING WINDOW CFG: 0x08 AS threshold, 0x0C as window size
}, // above 20 bytes
0x00, //reserve2
#ifdef ATAL
0x20, // 0x20 occupy(red:2) | color vacant (dark:0) for ATAL-HK 20241230
#else
0x21, // color occupy (red:2) | color vacant (green:1) or other 0x20 occupy(red:2) | color vacant (dark:0) for ATAL-HK 20241230
#endif
0x00, //reserve3
0x20, //sensor install height in 10 cm, default 32*10=320cm, 3.2meter
@ -1115,7 +1119,7 @@ static void SendTxData(void)
}
uint8_t ich= (sts_lamp_bar_color>>4 & 0x0f);
uint8_t icl= (sts_lamp_bar_color & 0x0f);
//uint8_t icl= (sts_lamp_bar_color & 0x0f);
char colorshow[30]="";
strcpy(colorshow, (ich==0)?"":sts_lamp_color_code[ich]);
@ -2572,7 +2576,26 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
STS_Combined_Status_Processing();
} else if (tlv_buf_size == 7 && tlv_buf[CFG_CMD4]=='F') // Change fall detection
} else if (tlv_buf_size == 6 && tlv_buf[CFG_CMD4]=='L') //switch LAMP BAR OCCUPY VACANT COLOR
{
invalid_flag = 0; // P 1 1 L O V
if (((tlv_buf[CFG_CMD5] >='0') && (tlv_buf[CFG_CMD5]<='9')) && ((tlv_buf[CFG_CMD6]<='9') && (tlv_buf[CFG_CMD6]>='0')))
{
sts_cfg_nvm.color_occupy_vacant = ((uint8_t)(tlv_buf[CFG_CMD5]-0x30)<<4)|((uint8_t)(tlv_buf[CFG_CMD6]-0x30));
sts_color_occupy_vacant = sts_cfg_nvm.color_occupy_vacant;
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Workmode=%d Color Occupy=%02X Vacant=%02X \r\n", sts_work_mode, STS_COLOR_DEFAULT_OCCUPY, STS_COLOR_DEFAULT_VACANT);
OnStoreSTSCFGContextRequest();
}
i=0; // Step 1: Prepare status update message
UTIL_MEM_set_8((void*)outbuf, 0x0, sizeof(outbuf));
UTIL_MEM_cpy_8((void*)outbuf,(void*)tlv_buf, tlv_buf_size);
i = tlv_buf_size;
}
else if (tlv_buf_size == 7 && tlv_buf[CFG_CMD4]=='F') // Change fall detection
{
invalid_flag = 0; // P 1 1 F A B C
if (((tlv_buf[CFG_CMD5] >='0') && (tlv_buf[CFG_CMD5]<='9')) && ((tlv_buf[CFG_CMD6]<='9') && (tlv_buf[CFG_CMD6]>='0'))
@ -3073,7 +3096,7 @@ void STS_REBOOT_CONFIG_Init(void)
for (uint8_t j=0; j< STS_O7_CFG_PCFG_SIZE; j++) { // P RSS CONFIG SIZE= 20U
sts_cfg_nvm.p[j] = (uint8_t)nvm_stored_value[NVM_CFG_START+j];
}
sts_cfg_nvm.reserve02 =(uint8_t)nvm_stored_value[NVM_RESERVE02];
sts_cfg_nvm.color_occupy_vacant =(uint8_t)nvm_stored_value[NVM_RESERVE02];
sts_cfg_nvm.reserve03 =(uint8_t)nvm_stored_value[NVM_RESERVE03];
sts_cfg_nvm.sensor_install_height_in_10cm =(uint8_t)nvm_stored_value[NVM_SENSOR_INSTALL_HEIGHT];
sts_cfg_nvm.alarm_parameter05 =(uint8_t)nvm_stored_value[NVM_ALARM_PARAMETER05];
@ -3162,6 +3185,7 @@ void OnRestoreSTSCFGContextProcess(void)
sts_lamp_bar_color = STS_GREEN;
sts_service_mask = sts_cfg_nvm.sts_service_mask;
sts_lamp_bar_flashing_color = sts_cfg_nvm.alarm_lamp_bar_flashing_color;
sts_color_occupy_vacant = sts_cfg_nvm.color_occupy_vacant;
if (sts_work_mode == STS_UNI_MODE){
sts_presence_fall_detection =TRUE;
} else {
@ -3209,7 +3233,7 @@ void STS_SENSOR_Distance_Test_Process(void)
void STS_SENSOR_Function_Test_Process(void)
{
uint8_t tstbuf[128] ={0x0}; uint8_t i=0, count = 0;
uint8_t tstbuf[128] ={0x0}; uint8_t i=0; //, count = 0;
uint8_t mems_Dev_ID[2] = {0x0};
tstbuf[i++] = (uint8_t) 'S';

View File

@ -154,6 +154,7 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.1119592399" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.2024044405" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="CORE_CM4"/>
<listOptionValue builtIn="false" value="ATAL"/>
<listOptionValue builtIn="false" value="CLOCK_SYNC"/>
<listOptionValue builtIn="false" value="RM2_1"/>
<listOptionValue builtIn="false" value="STS_O6"/>

Binary file not shown.