good reedswitch Pmode =3 with debug message

This commit is contained in:
Yunhorn 2024-08-06 11:17:04 +08:00
parent d06da3d56d
commit 61fbafe4cc
4 changed files with 30 additions and 11 deletions

View File

@ -197,6 +197,9 @@ void STS_Lamp_Bar_Set_STS_RGB_Color(uint8_t sts_lamp_color, uint8_t lum)
case STS_WHITE:
STS_Lamp_Bar_Set_RGB_Color(lum, lum, lum);
break;
case STS_COLOR_MAX: // RED/BLUE
sts_status_color = STS_RED_BLUE;
break;
}
}

View File

@ -223,9 +223,18 @@ void STS_YunhornSTSEventRFAC_Process(void)
void STS_YunhornSTSEventP1_Process(void)
{
sts_reed_hall_1_result = HALL1_STATE; //sts_hall1_read;
if (sts_reed_hall_1_result != last_sts_reed_hall_1_result)
{
sts_reed_hall_changed_flag = TRUE;
}
last_sts_reed_hall_1_result = sts_reed_hall_1_result;
sts_reed_hall_2_result = HALL2_STATE;// sts_hall2_read;
if (sts_reed_hall_2_result != last_sts_reed_hall_2_result)
{
sts_reed_hall_changed_flag = TRUE;
}
last_sts_reed_hall_2_result = sts_reed_hall_2_result;
STS_Combined_Status_Processing();
@ -463,7 +472,12 @@ void STS_Combined_Status_Processing(void)
break;
case STS_REEDSWITCH_MODE:
sts_status_color = (sts_reed_hall_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
sts_status_color = (sts_reed_hall_1_result == STS_Status_Door_Open )? STS_GREEN: STS_RED;
if (sts_reed_hall_2_result == STS_Status_SOS_Pushdown )
{
sts_status_color = STS_RED_BLUE;
}
break;
case STS_RSS_MODE:

View File

@ -905,7 +905,7 @@ static void SendTxData(void)
} else if (sts_work_mode == STS_UNI_MODE) {
AppData.Port = (uint8_t)YUNHORN_STS_O7_LORA_APP_DATA_PORT;
} else if (sts_work_mode == STS_RSS_MODE) {
} else if ((sts_work_mode == STS_RSS_MODE)||(sts_work_mode == STS_REEDSWITCH_MODE)) {
AppData.Port = (uint8_t)YUNHORN_STS_O2_LORA_APP_DATA_PORT;
}
@ -918,7 +918,7 @@ static void SendTxData(void)
AppData.Port = (uint8_t)YUNHORN_STS_O6_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
else if (sts_work_mode == STS_UNI_MODE)
AppData.Port = (uint8_t)YUNHORN_STS_O7_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
else if (sts_work_mode == STS_RSS_MODE)
else if ((sts_work_mode == STS_RSS_MODE)||(sts_work_mode == STS_REEDSWITCH_MODE))
AppData.Port = (uint8_t)YUNHORN_STS_O2_LORA_APP_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
//AppData.Port = (uint8_t)sts_sendhtbtport; //LORAWAN_USER_APP_PORT+1;
@ -936,7 +936,12 @@ static void SendTxData(void)
AppData.Buffer[i++] = (uint8_t)(sensorData.lamp_bar_color)&0xff; //01
AppData.Buffer[i++] = (uint8_t)(sensorData.workmode)&0xff; //02 WORK MODE
if (sts_work_mode == STS_RSS_MODE)
if (sts_work_mode == STS_REEDSWITCH_MODE)
{
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reed switch
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor2_on_off)&0xff; //04 Sensor head #2 status reed switch
}
else if ((sts_work_mode == STS_RSS_MODE))
{
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor1_on_off)&0xff; //03 Sensor head #1 status reed switch
AppData.Buffer[i++] = (uint8_t)(sensorData.state_sensor3_on_off)&0xff; //04 Sensor head #3 status RSS motion
@ -1149,18 +1154,12 @@ static void OnYunhornSTSLampBarColorTimerEvent(void *context)
} else {
if (r_b)
{
//__disable_irq();
STS_Lamp_Bar_Set_STS_RGB_Color(high4, DEFAULT_LUMINANCE_LEVEL);
//__enable_irq();
last_sts_lamp_bar_color = high4;
//STS_WS2812B_Refresh();
}
else {
//__disable_irq();
STS_Lamp_Bar_Set_STS_RGB_Color(low4, DEFAULT_LUMINANCE_LEVEL);
//__enable_irq();
last_sts_lamp_bar_color = low4;
//STS_WS2812B_Refresh();
}
r_b = !r_b;
@ -2583,6 +2582,9 @@ void OnStoreSTSCFGContextRequest(void)
nvm_store_value[i++] = sts_cfg_nvm.mtmcode2;
nvm_store_value[i++] = sts_cfg_nvm.version;
nvm_store_value[i++] = sts_cfg_nvm.hardware_ver;
APP_LOG(TS_OFF, VLEVEL_L, "\r\n\n\n\n\n STS_CFG_NVM periodicity=%02x unit=%02x \r\n",sts_cfg_nvm.periodicity,sts_cfg_nvm.unit);
nvm_store_value[i++] = sts_cfg_nvm.periodicity;
nvm_store_value[i++] = sts_cfg_nvm.unit;
nvm_store_value[i++] = sts_cfg_nvm.sampling;
@ -2881,7 +2883,7 @@ uint32_t STS_Get_Date_Time_Stamp(void)
UnixEpoch.Seconds -= 18; /*removing leap seconds*/
SysTimeLocalTime(UnixEpoch.Seconds, &localtime);
APP_LOG(TS_OFF, VLEVEL_M, "UTC TIME:%02dh%02dm%02ds on %02d/%02d/%04d\r\n",
APP_LOG(TS_OFF, VLEVEL_L, "UTC TIME:%02dh%02dm%02ds on %02d/%02d/%04d\r\n",
localtime.tm_hour, localtime.tm_min, localtime.tm_sec,
localtime.tm_mday, localtime.tm_mon + 1, localtime.tm_year + 1900);

Binary file not shown.