Compare commits

...

33 Commits

Author SHA1 Message Date
Yunhorn 57b52e5a81 rtm old rm2 pixel o6 2025-04-24 20:25:38 +08:00
Yunhorn 30b9421bc4 add old rm2 bin 2025-04-24 20:22:02 +08:00
Yunhorn a19ca44bf0 old pixel rm2 2025-04-24 20:21:27 +08:00
Yunhorn a18a4ed4b7 pixel_network_rtm_20250425 2025-04-24 17:37:57 +08:00
Yunhorn 1e181d819a heart-beat duration changed from reboot cfg 2025-04-23 16:31:26 +08:00
Yunhorn 755dc74b5c remove not used code and warning message 2025-04-23 11:44:32 +08:00
Yunhorn e8088ba50d add sliding window size and threshold parse cmd YWABB 2025-04-22 20:46:35 +08:00
Yunhorn 1786bb502e good stable 20250421 for pixel_network 2025-04-21 22:57:17 +08:00
Yunhorn 157949c433 wip with debug message printed 2025-04-21 20:14:48 +08:00
Yunhorn bba7df30ef before test_20250421_16:30 2025-04-21 16:30:08 +08:00
Yunhorn 04258d18e3 add threshold and window size for sliding window 2025-04-17 16:50:09 +08:00
Yunhorn 031899caed good progress workable 20250417 2025-04-17 15:50:10 +08:00
Yunhorn 3e08589d31 wip .... so far so good 2025-04-16 22:45:15 +08:00
Yunhorn a5ce3af359 return debug mode 2025-04-15 12:46:06 +08:00
Yunhorn 8a1baba7d0 revised decoder js 2025-04-15 12:40:09 +08:00
Yunhorn f47e6c6215 disable debug message, rtm 20250415 2025-04-15 00:20:35 +08:00
Yunhorn 2423175e60 add good bin files 2025-04-15 00:16:08 +08:00
Yunhorn b168cbe8b5 good wip pre-prd 2025 04 15 2025-04-15 00:14:18 +08:00
Yunhorn fbc9138720 wip good so far 2025 04 14 2025-04-14 23:53:37 +08:00
Yunhorn cebc42f735 wip 02 2025-04-14 12:50:15 +08:00
Yunhorn a3d9717e9a wip 2025-04-11 2025-04-11 19:21:24 +08:00
Yunhorn 044c307ba7 good restore to factory default--- keep this 2025-04-10 21:20:22 +08:00
Yunhorn 7ba0f9954d no good on restore FACTORY DEFAULT Nvm 2025-04-09 18:25:55 +08:00
Yunhorn 66033b8db6 add warm up counter control for self boot up 2025-04-09 16:17:08 +08:00
Yunhorn d80a543d23 add good bin 2025-04-09 15:57:32 +08:00
Yunhorn 74209c1cc3 good startup without manual trigger door contact ,etc. 2025-04-09 15:55:08 +08:00
Yunhorn 9693082c84 add good bin with MFG nvm process 2025-04-08 22:14:27 +08:00
Yunhorn 619122e7fe good with flash to MFG default and normal NVM 2025-04-08 22:10:42 +08:00
Yunhorn 4640c625a5 better p cmd config 2025-04-08 20:16:38 +08:00
Yunhorn 5d71dbc6a8 add .project 2025-03-28 15:28:58 +08:00
Yunhorn 937d21cdae add workable STS_O2O6O7_20250328 BIN 2025-03-28 15:28:02 +08:00
Yunhorn 8aec93c167 workable STS_O6 20250328 2025-03-28 15:26:34 +08:00
Yunhorn 4bdaa0fbf8 fix bugs 2025-03-25 2025-03-25 20:23:56 +08:00
36 changed files with 2532 additions and 311 deletions

1145
AS923_HK_CLASS_A_C.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,472 @@
// Decode decodes an array of bytes into an object.
// - fPort contains the LoRaWAN fPort number
// - bytes is an array of bytes, e.g. [225, 230, 255, 0]
// - variables contains the device variables e.g. {"calibration": "3.5"} (both the key / value are of type string)
// The function must return an object, e.g. {"temperature": 22.5}
// for Yunhorn SmarToilets STS-O7 Occupancy/Fall Detection/Over stay sensor
function Decode(fPort, data, variables) {
var data = {};
data.length = bytes.length;
if ((fPort === 10)) { // STS_O2_O6 V3 version 2023,pixel-network version
switch (bytes[0]) {
case 0x00:
data.LEDcolor = "Dark";
break;
case 0x01:
data.LEDcolor = "Green";
data.cubicleOccupyStatus = "Vacant";
break;
case 0x02:
data.LEDcolor = "Red";
data.cubicleOccupyStatus = "Occupied";
break;
case 0x03:
data.LEDcolor = "Blue";
data.cubicleOccupyStatus = "Maintenance";
break;
case 0x04:
data.LEDcolor = "Yellow";
data.cubicleOccupyStatus = "TBD";
break;
case 0x05:
data.LEDcolor = "Pink";
data.cubicleOccupyStatus = "TBD";
break;
case 0x06:
data.LEDcolor = "Cyan";
data.cubicleOccupyStatus = "TBD";
break;
case 0x07:
data.LEDcolor = "White";
data.cubicleOccupyStatus = "TBD";
break;
case 0x08:
data.LEDcolor = "Red_Blue";
data.cubicleOccupyStatus = "EMERGENCY";
break;
case 0x23:
data.LEDcolor = "Red_Blue";
data.cubicleOccupyStatus = "EMERGENCY";
break;
case 0x20:
data.LEDcolor = "Red_Flash";
data.cubicleOccupyStatus = "EMERGENCY";
break;
default:
data.LEDcolor = "TBD_COLOR";
data.cubicleOccupyStatus = "TBD_status";
break;
}
switch (bytes[1]) {
case 0x0:
data.workmode = "Network_mode";
break;
case 0x01:
data.workmode = "Wired_Mode";
break;
case 0x02:
data.workmode = "Hall_element_mode";
break;
case 0x03:
data.workmode = "MotionDetect_mode";
break;
case 0x04:
data.workmode = "Dual_mode";
break;
case 0x05:
data.workmode = "Uni_Mode";
break;
default:
data.workmode = "Unknown Mode";
break;
}
// select only one below
// For NC(Normal Closed states
data.Sensor1_Door_Contact_Open = bytes[2] === 0 ? "Door Closed" : "Door Open";
// For NC(Normal Closed states
//data.Sensor1_Door_Contact_Open = bytes[3]===1?"Door Closed":"Door Open";
if (bytes[1] == 0x02) //Hall_element_mode
{
data.Sensor2_SOS_Pushed = bytes[3] === 0 ? "PushDown" : "RelaseUP";
} else if (bytes[1] > 0x02) {
data.Sensor2_Motion_Detected = bytes[3] === 0 ? "No Motion" : "Motion Detected";
}
return { "Yunhorn_SmarToilets_data": data };
}
else if ((fPort === 17) || (fPort === 19) || (fPort === 21)) {
data.BoardLED = ((bytes[0] & 0x7F) === 0x01) ? "ON" : "OFF";
switch (bytes[1]) {
case 0x00:
data.LEDcolor = "Dark";
break;
case 0x01:
data.LEDcolor = "Green";
data.cubicleOccupyStatus = "Vacant";
break;
case 0x02:
data.LEDcolor = "Red";
data.cubicleOccupyStatus = "Occupied";
break;
case 0x03:
data.LEDcolor = "Blue";
data.cubicleOccupyStatus = "Maintenance";
break;
case 0x04:
data.LEDcolor = "Yellow";
data.cubicleOccupyStatus = "TBD";
break;
case 0x05:
data.LEDcolor = "Pink";
data.cubicleOccupyStatus = "TBD";
break;
case 0x06:
data.LEDcolor = "Cyan";
data.cubicleOccupyStatus = "TBD";
break;
case 0x07:
data.LEDcolor = "White";
data.cubicleOccupyStatus = "TBD";
break;
case 0x08:
data.LEDcolor = "Red_Blue";
data.cubicleOccupyStatus = "EMERGENCY";
break;
case 0x23:
data.LEDcolor = "Red_Blue";
data.cubicleOccupyStatus = "EMERGENCY";
break;
case 0x20:
data.LEDcolor = "Red_Flash";
data.cubicleOccupyStatus = "EMERGENCY";
break;
default:
data.LEDcolor = "TBD_COLOR";
data.cubicleOccupyStatus = "TBD_status";
break;
}
switch (bytes[2]) {
case 0x0:
data.workmode = "Network_mode";
break;
case 0x01:
data.workmode = "Wired_Mode";
break;
case 0x02:
data.workmode = "Hall_element_mode";
break;
case 0x03:
data.workmode = "MotionDetect_mode";
break;
case 0x04:
data.workmode = "Dual_mode";
break;
case 0x05:
data.workmode = "Uni_Mode";
break;
default:
data.workmode = "Unknown Mode";
break;
}
// select only one below
// For NC(Normal Closed states
data.Sensor1_Door_Contact_Open = bytes[3] === 0 ? "Door Closed" : "Door Open";
// For NC(Normal Closed states
//data.Sensor1_Door_Contact_Open = bytes[3]===1?"Door Closed":"Door Open";
data.Sensor2_Emergency_Button = bytes[4] === 0 ? "Alarm Push Down" : "No Alarm, Released";
data.Sensor3_Motion_Detected = bytes[5] === 0 ? "No Motion" : "Motion Detected";
data.length = bytes.length;
if (data.length === 9) {
data.Over_stay_state = (bytes[6] === 0) ? "False" : "True";
data.Over_Stay_duration_in_Seconds = (bytes[7] << 8 | bytes[8]);
return { "Yunhorn_SmarToilets_data": data };
}
else if (data.length > 9) {
data.Sensor4_ALARM_MUTE = (bytes[6] === 0) ? "Down Mute" : "No Mute";
data.Sensor5_ALARM_RESET = (bytes[7] === 0) ? "Down RESET" : "NO Reset";
data.Distance_in_mm = (bytes[8] << 8 | bytes[9]);
data.MotionLevel = (bytes[10] << 8 | bytes[11]);
data.Unconcious_State = (bytes[12] == 0) ? "False" : "True";
switch (bytes[13]) {
case 0x0:
data.Fall_Down_Detected_State = "Presence_Normal";
break;
case 0x01:
data.Fall_Down_Detected_State = "Presence_Fall_Down";
break;
case 0x02:
data.Fall_Down_Detected_State = "Presence_Rising_Up";
break;
case 0x03:
data.Fall_Down_Detected_State = "Presence_LayDown";
break;
case 0x04:
data.Fall_Down_Detected_State = "Presence_Unconcious";
break;
case 0x05:
data.Fall_Down_Detected_State = "Presence_Stay_Still";
break;
default:
data.Fall_Down_Detected_State = "Presence_Normal";
break;
}
data.OverStay_Detected_State = (bytes[14] == 0x0) ? "False" : "True";
data.OverStay_Duration_in_Seconds = (bytes[15] << 8 | bytes[16]);
data.No_Movement_Duration_in_Seconds = (bytes[17] << 8 | bytes[18]);
data.Unconcious_Duration_in_Seconds = (bytes[17] << 8 | bytes[18]);
data.Fall_Down_Speed_in_m_per_s = (bytes[19]);
data.Fall_Down_Gravity_in_g = (bytes[20]);
data.SOS_PushDown_Stamp = (bytes[21] << 24 | bytes[22] << 16 | bytes[23] << 8 | bytes[24]);
if (data.SOS_PushDown_Stamp != 0) {
var sos_start = new Date(1000 * data.SOS_PushDown_Stamp);
data.SOS_PushDown_Time = "[" + sos_start.getDate() + "." + (sos_start.getMonth() + 1) + "." + (sos_start.getFullYear()) + "] " + sos_start.getHours() + ":" + sos_start.getMinutes() + ":" + sos_start.getSeconds();
} else data.SOS_PushDown_Time = "N/A";
data.SOS_ReleaseUP_Stamp = (bytes[25] << 24 | bytes[26] << 16 | bytes[27] << 8 | bytes[28]);
if (data.SOS_ReleaseUP_Stamp != 0) {
var sos_stop = new Date(1000 * data.SOS_ReleaseUP_Stamp);
data.SOS_ReleaseUP_Time = "[" + sos_stop.getDate() + "." + (sos_stop.getMonth() + 1) + "." + (sos_stop.getFullYear()) + "] " + sos_stop.getHours() + ":" + sos_stop.getMinutes() + ":" + sos_stop.getSeconds();
} else data.SOS_ReleaseUP_Time = "N/A";
data.Fall_Down_Stamp = (bytes[29] << 24 | bytes[30] << 16 | bytes[31] << 8 | bytes[32]);
if (data.Fall_Down_Stamp != 0) {
var fall_start = new Date(1000 * data.Fall_Down_Stamp);
data.Fall_Down_Time = "[" + fall_start.getDate() + "." + (fall_start.getMonth() + 1) + "." + (fall_start.getFullYear()) + "] " + fall_start.getHours() + ":" + fall_start.getMinutes() + ":" + fall_start.getSeconds();
} else data.Fall_RiseUp_Stamp = "N/A";
data.Fall_RiseUp_Stamp = (bytes[33] << 24 | bytes[34] << 16 | bytes[35] << 8 | bytes[36]);
if (data.Fall_RiseUp_Stamp != 0) {
var fall_stop = new Date(1000 * data.Fall_RiseUp_Stamp);
data.Fall_RiseUp_Time = "[" + fall_stop.getDate() + "." + (fall_stop.getMonth() + 1) + "." + (fall_stop.getFullYear()) + "] " + fall_stop.getHours() + ":" + fall_stop.getMinutes() + ":" + fall_stop.getSeconds();
} else data.Fall_RiseUp_Time = "N/A";
}
return { "Yunhorn_SmarToilets_data": data };
}
// Heart Beat
else if ((fPort === 20) || (fPort === 18) || (fPort === 5)) {
var data = {};
//data.led_state=(bytes[0] & 0x7f) === 0 ? "Off" : "On";
data.BoardLED = ((bytes[0] & 0x7F) === 0x01) ? "ON" : "OFF";
data.battery_level = bytes[1] + " %";
return { "Yunhorn_SmarToilets_data": data };
}
// UPLINK, RFAC
else if (fPort === 1) {
var data = {};
data.length = bytes.length;
if ((data.length === 4) && (bytes[0] == 0x52) && (bytes[1] = 0x46)) //RFAC
{
data.Request_Performed = "OK";
data.RFAC = "OK";
data.AC0 = bytes[0];
data.AC1 = bytes[1];
}
else if ((data.length === 4) && (bytes[0] === 0x50) && (bytes[1] === 0x31) && (bytes[2] === 0x31)) {
data.Work_Mode_Switch = "OK";
switch (bytes[3] - 0x30) {
case 0x0:
data.workmode = "Network_mode";
break;
case 0x01:
data.workmode = "Wired_Mode";
break;
case 0x02:
data.workmode = "Hall_element_mode";
break;
case 0x03:
data.workmode = "MotionDetect_mode";
break;
case 0x04:
data.workmode = "Dual_mode";
break;
case 0x05:
data.workmode = "Uni_Mode";
break;
default:
data.workmode = "Unknown Mode";
break;
}
}
if ((bytes[0] === 0x59) && (bytes[1] === 0x44)) //Duration interval
{
data.Heart_beat_Duration = (bytes[2] - 0x30) * 10 + (bytes[3] - 0x30);
data.Unit = String.fromCharCode(bytes[4]);
}
else if ((bytes[0] === 0x59) && (bytes[1] === 0x53)) //Sampling interval or Heart-beat interval
{
data.Wakeup_sampling_interval = (bytes[2] - 0x30) * 10 + (bytes[3] - 0x30);
data.Unit = String.fromCharCode(bytes[4]);
}
else if (bytes[0] === 0x43) { // report current nvm config
data.mtm_code1 = bytes[1];
data.mtm_code2 = bytes[2];
data.sts_verion = bytes[3];
data.sts_hw_ver = bytes[4];
data.sts_uplink_interval = bytes[5];
data.sts_uplink_interval_unit = String.fromCharCode(bytes[6]);
data.sts_sampling_interval = bytes[7];
data.sts_sampling_interval_unit = String.fromCharCode(bytes[8]);
data.sts_work_mode = bytes[9];
data.sts_service_mask = bytes[10];
data.sts_reserve01 = bytes[11];
data.sts_payload_length = bytes[12];
data.rss_start_distance = bytes[13] * 0.1 + " meter";
data.rss_range_length = bytes[14] * 0.1 + " meter";
data.rss_threshold = bytes[15] * 0.1;
data.rss_receiving_gain = bytes[16] + " %";
data.rss_profile = bytes[17];
data.rss_rate_tracking = bytes[18];
data.rss_rate_presence = bytes[19];
data.rss_HWAAS = bytes[20];
data.rss_nbr_removed_pc = bytes[21];
data.rss_inter_frame_deviation_time_const = bytes[22] * 0.1;
data.rss_inter_frame_fast_cutoff = bytes[23];
data.rss_inter_frame_slow_cutoff = bytes[24];
data.rss_intra_frame_time_const = bytes[25];
data.rss_intra_frame_weight = bytes[26] * 0.1;
data.rss_output_time_const = bytes[27] * 0.1;
data.rss_downsampling_factor = bytes[28];
data.rss_power_saving_mode_active = bytes[29];
data.rss_reserve02 = bytes[30];
data.rss_reserve03 = bytes[31];
data.rss_reserve04 = bytes[32];
data.reserve2 = bytes[33];
data.reserve3 = bytes[34];
data.sensor_install_height = bytes[35] * 10 + " cm";
data.alarm_parameter05 = bytes[36];
data.alarm_mute_expire_timer = bytes[37];
data.alarm_lamp_bar_flashing_color = bytes[38];
data.occupancy_overtime_threshold = bytes[39];
data.motionless_duration_threshold = bytes[40];
data.unconcious_threshold = bytes[41];
data.fall_detection_acc_threshold = bytes[42];
data.fall_detection_depth_threshold = bytes[43];
data.fall_down_confirm_threshold = bytes[44];
}
else if (bytes[0] === 0x53) { // SELF TEST FUNCTION
data.mtm_code1 = bytes[1];
data.mtm_code2 = bytes[2];
data.sts_verion = bytes[3];
data.sts_hw_ver = bytes[4];
data.battery_level = bytes[5];
data.sts_test_result_length = bytes[6];
data.sts_rss_sub_code1 = bytes[7];
data.sts_rss_sub_code2 = bytes[8];
data.sts_rss_sub_code3 = bytes[9];
data.sts_rss_sub_code4 = bytes[10];
data.sts_rss_sub_code5 = bytes[11];
data.sts_rss_sub_code6 = bytes[12];
data.sts_rss_sub_code7 = bytes[13];
data.sts_rss_sub_code8 = bytes[14];
data.sts_rss_sub_code9 = bytes[15];
data.sts_rss_sub_code10 = bytes[16];
data.sts_sensor_install_height = String.fromCharCode(bytes[17]) + String.fromCharCode(bytes[18]) + String.fromCharCode(bytes[19]) + String.fromCharCode(bytes[20]) + " mm";
}
else if (bytes[0] === 0x44) { // MEASURE INSTALLATION HEIGHT
data.mtm_code1 = bytes[1];
data.mtm_code2 = bytes[2];
data.sts_verion = bytes[3];
data.sts_hw_ver = bytes[4];
data.battery_level = bytes[5];
data.payload_length = bytes[6];
data.Measure_Distance = String.fromCharCode(bytes[7]) + String.fromCharCode(bytes[8]) + String.fromCharCode(bytes[9]) + String.fromCharCode(bytes[10]);
data.Distance_unit = "mm";
}
else if (bytes[0] === 0x4c) {
data.mtm_code1 = bytes[1];
data.mtm_code2 = bytes[2];
data.sts_verion = bytes[3];
data.LoRaWAN_Class = String.fromCharCode(bytes[4]);
}
else if (bytes[0] === 0x56) { // FIRMWARE VERSION
data.mtm_code1 = bytes[1];
data.mtm_code2 = bytes[2];
data.sts_verion = bytes[3];
data.sts_hw_ver = bytes[4];
data.sts_major = bytes[5];
data.sts_minor = bytes[6];
data.subminor = bytes[7];
if (data.length === 15) {
data.L_year = (bytes[8] << 8 | bytes[9]);
data.L_mon = bytes[10];
data.L_day = bytes[11];
data.L_hour = bytes[12];
data.L_min = bytes[13];
data.L_sec = bytes[14];
data.LocalTime_UTC = "UTC: " + data.L_year + "/" + data.L_mon + "/" + data.L_day + " " + data.L_hour + ":" + data.L_min + ":" + data.L_sec;
data.LocalTime_EST8 = "GMT+8: " + data.L_year + "/" + data.L_mon + "/" + data.L_day + " " + (data.L_hour + 8) + ":" + data.L_min + ":" + data.L_sec;
}
}
else if (bytes[0] === 0x50) { // P cmd report
if (data.length == 7) {
switch (bytes[3]) {
case 0x46: // F --- fall down & unconscious detection threshold
data.FALL_acceleration = (bytes[4] == 0x30 ? "Disabled" : ((bytes[4] - 0x30) * 10) + " mg/s2");
data.FALL_depth_measure = (bytes[5] == 0x30 ? "Disabled" : ((bytes[5] - 0x30) * 10) + " cm");
data.FALL_confirm_threshold = (bytes[6] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 10) + " seconds");
//data.FALL_reserved = (bytes[7]==0x0?"Disabled":((bytes[6]-0x30)*10)+" min");
break;
} //switch
}
else if (data.length == 8) {
switch (bytes[3]) {
case 0x4f: // O -- over stay, onconscious, long stay
data.OMU_Motionless_duration_in_min = (bytes[4] == 0x30 ? "Disabled" : ((bytes[4] - 0x30)) + " Min");
data.OMU_Long_Occupy_duration_in_Min = (bytes[5] == 0x30 ? "Disabled" : ((bytes[5] - 0x30) * 10) + " Min");
data.OMU_Unconcious_Threshold = (bytes[6] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 100) + "ml");
data.OMU_Alarm_Mute_Reset_Timer = (bytes[7] == 0x30 ? "Disabled" : ((bytes[7] - 0x30) * 10) + " Seconds");
break;
case 0x46: // F --- fall down & unconscious detection threshold
data.FALL_acceleration = (bytes[4] == 0x30 ? "Disabled" : ((bytes[4] - 0x30) * 10) + " mg/s2");
data.FALL_depth_measure = (bytes[5] == 0x30 ? "Disabled" : ((bytes[5] - 0x30) * 10) + " cm");
data.FALL_confirm_threshold = (bytes[6] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 10) + " seconds");
data.FALL_reserved = (bytes[7] == 0x30 ? "Disabled" : ((bytes[6] - 0x30) * 10) + " min");
break;
} //switch
} else if (data.length == 11) { // P 1108201365
data.RSS_SIMPLE_Start = ((bytes[3] - 0x30) * 100 + (bytes[4] - 0x30) * 10) + " cm";
data.RSS_SIMPLE_Length = ((bytes[5] - 0x30) * 100 + (bytes[6] - 0x030) * 10) + " cm";
data.RSS_SIMPLE_Threshold = ((bytes[7] - 0x30) * 1000 + (bytes[8] - 0x30) * 100) + " ml";
data.RSS_SIMPLE_Gain = ((bytes[9] - 0x30) * 10 + (bytes[10] - 0x30)) + " %";
} else if (data.length == 33) { // P 11
data.RSS_FULL_Start = ((bytes[3] - 0x30) * 100 + (bytes[4] - 0x30) * 10) + " cm";
data.RSS_FULL_Length = ((bytes[5] - 0x30) * 100 + (bytes[6] - 0x30) * 10) + " cm";
data.RSS_FULL_Threshold = ((bytes[7] - 0x30) * 1000 + (bytes[8] - 0x30) * 100) + " ml";
data.RSS_FULL_Gain = ((bytes[9] - 0x30) * 10 + (bytes[10] - 0x30)) + " %";
data.RSS_FULL_Profile = (bytes[11] - 0x30);
data.RSS_FULL_Rate_Tracking = ((bytes[12] - 0x30) * 10 + (bytes[13] - 0x30));
data.RSS_FULL_Rate_Presence = ((bytes[14] - 0x30) * 10 + (bytes[15] - 0x30));
data.RSS_FULL_HWAAS = ((bytes[16] - 0x30) * 10 + (bytes[17] - 0x30));
data.RSS_FULL_Num_Removed_PC = (bytes[18] - 0x30);
data.RSS_FULL_Inter_Deviation_Time_Const_in_Sec = ((bytes[19] - 0x30) + (bytes[20] - 0x30) * 0.1);
data.RSS_FULL_Inter_Fast_Cut_Off = ((bytes[21] - 0x30) * 10 + (bytes[22] - 0x30));
data.RSS_FULL_Inter_Slow_Cut_Off = ((bytes[23] - 0x30) * 0.1 + (bytes[24] - 0x30) * 0.001);
data.RSS_FULL_Inter_Time_Const_in_Sec = ((bytes[25] - 0x30) * 10 + (bytes[26] - 0x30));
data.RSS_FULL_Inter_Weight = ((bytes[27] - 0x30) + (bytes[28] - 0x30) * 0.1);
data.RSS_FULL_Output_Time_Const_in_Sec = ((bytes[29] - 0x30) + (bytes[30] - 0x30) * 0.1);
data.RSS_FULL_DownSampling_factor = (bytes[31] - 0x30);
data.RSS_FULL_Power_Saving_mode = (bytes[32] - 0x30);
}
}
return { "Yunhorn_SmarToilets_data": data };
}
}

View File

@ -89,7 +89,7 @@ void Error_Handler(void);
#define PME_ON HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET )
#define PME_OFF HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET )
#ifdef STS_O7
#if defined(STS_O7)||defined(STS_O6)
#define HALL1_Pin GPIO_PIN_0 // DOOR CONTACT
#define HALL1_GPIO_Port GPIOA

View File

@ -79,7 +79,7 @@ enum sts_oo_work_mode {
STS_TOF_PRESENCE_MODE, // A TOF PRESENCE OCCUPANCY
STS_TOF_IN_OUT_MODE, // B TOF IN OUT COUNT
STS_RSS_BACKGROUND_MODE, // C RSS_BACKGROUND EVALUATION MODE
STS_OTHER_MODE // ? OTHER MODE
};
#if defined(STS_O7)||defined(STS_O6)

View File

@ -50,12 +50,12 @@ extern "C" {
* #define VLEVEL_M 2 functional traces
* #define VLEVEL_H 3 all traces
*/
#define VERBOSE_LEVEL VLEVEL_M
#define VERBOSE_LEVEL VLEVEL_OFF
/**
* @brief Enable trace logs
*/
#define APP_LOG_ENABLED 1
#define APP_LOG_ENABLED 0
/**
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose
@ -78,7 +78,7 @@ extern "C" {
* @brief Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power
*/
#define DEBUGGER_ENABLED 1
#define DEBUGGER_ENABLED 0
/**
* @brief Disable Low Power mode

View File

@ -245,9 +245,9 @@
#define STS_IOC_MODE_4_MASK STS_IOC_IN_0|STS_IOC_IN_1|STS_IOC_IN_2|STS_IOC_OUT_0|STS_IOC_OUT_1 //DUAL MODE
#define STS_IOC_MODE_5_MASK STS_IOC_IN_ALL|STS_IOC_OUT_ALL //UNI_MODE
#define MajorVer 24U
#define MinorVer 8U
#define SubMinorVer 15U
#define MajorVer 25U
#define MinorVer 4U
#define SubMinorVer 24U
#define FirmwareVersion 3U
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
@ -271,10 +271,12 @@
#ifdef STS_O6
#define sts_senddataport (YUNHORN_STS_O6_LORA_APP_DATA_PORT)
#define sts_sendhtbtport (YUNHORN_STS_O6_LORA_APP_HTBT_PORT)
#define YUNHORN_STS_PRD_STRING "STS_O6"
#endif
#ifdef STS_O7
#define sts_senddataport (YUNHORN_STS_O7_LORA_APP_DATA_PORT)
#define sts_sendhtbtport (YUNHORN_STS_O7_LORA_APP_HTBT_PORT)
#define YUNHORN_STS_PRD_STRING "STS_O7"
#endif
#if defined(STS_O6)||defined(STS_O7)
#define sts_appctrlport (YUNHORN_STS_O7_USER_APP_CTRL_PORT)
@ -438,8 +440,12 @@
*/
#define FLASH_USER_START_ADDR ((void *) 0x0803F800UL) // Last 2kB of flash
#define FLASH_USER_CONFIG_SIZE ((void *) 0x000007FFUL) //0x400=1KB=1024
#define FLASH_USER_CONFIG_SIZE ((void *) 0x000003FFUL) //0x400=1KB=1024
#define FLASH_USER_END_ADDR (FLASH_USER_START_ADDR + FLASH_USER_CONFIG - 1)
#define FLASH_MFG_DEFAULT_START_ADDR ((void *) 0x0803FC00UL) // Last 1kB of flash
#define FLASH_MFG_DEFAULT_CONFIG_SIZE ((void *) 0x000003FFUL) //0x400=1KB=1024
#define FLASH_MFG_DEFAULT_END_ADDR (FLASH_MFG_DEFAULT_START_ADDR + FLASH_MFG_DEFAULT_CONFIG_SIZE - 1)
/* 2KB = 2048 = 0x800 End @ of user Flash area */
/**

View File

@ -64,26 +64,29 @@ enum p_cmd_order{
};
enum RSS_CFG_order{
// FOR SIMPLE CONFIG .... 8 BYTES
// FOR SIMPLE CONFIG .... 4 BYTES
RSS_CFG_START_M=0,
RSS_CFG_LENGTH_M,
RSS_CFG_THRESHOLD,
RSS_CFG_RECEIVER_GAIN,
// FOR SIMPLE CONFIG .... 8 BYTES
// FOR SIMPLE CONFIG .... 4 BYTES
RSS_CFG_PROFILE,
RSS_CFG_RATE_TRACKING,
RSS_CFG_RATE_PRESENCE,
RSS_CFG_HWAAS,
RSS_CFG_NBR_REMOVED_PC,
RSS_CFG_ITE_DEVIATION,
RSS_CFG_ITE_FAST_CUTOFF,
RSS_CFG_ITE_SLOW_CUTOFF,
RSS_CFG_ITR_TIME,
RSS_CFG_ITR_WEIGHT,
RSS_CFG_OUTPUT_TIME,
RSS_CFG_DOWNSAMPLING_FACTOR,
RSS_CFG_POWER_MODE
RSS_CFG_NBR_REMOVED_PC, // 8
RSS_CFG_ITE_DEVIATION, // 9
RSS_CFG_ITE_FAST_CUTOFF, // 10
RSS_CFG_ITE_SLOW_CUTOFF, // 11
RSS_CFG_ITR_TIME, // 12
RSS_CFG_ITR_WEIGHT, // 13
RSS_CFG_OUTPUT_TIME, // 14
RSS_CFG_DOWNSAMPLING_FACTOR, // 15
RSS_CFG_POWER_MODE, // 16
RSS_CFG_UPDATE_FLAG, // 17 ADD AT 2025-04-11
RSS_CFG_BG_MOTION_NOISE, // 18
RSS_CFG_SLID_WIN, // 19 THRESHOLD AND WIN
};
#endif
@ -369,6 +372,9 @@ typedef struct STS_OO_RSS_SensorTuneDataTypeDef
float default_downsampling_factor; //[2](2) //default 1
float default_receiver_gain; //[45](0.45f) //default 0.9 gain mdB [4]
uint8_t default_config_update_flag; // 1,2,3,4,5
} STS_OO_RSS_SensorTuneDataTypeDef;
@ -679,6 +685,8 @@ void OnStoreSTSCFGContextRequest(void);
*/
void OnRestoreSTSCFGContextRequest(void *cfg_in_nvm);
void OnRestoreSTSCFG_FactoryDefault_ContextRequest(void);
void STS_REBOOT_CONFIG_Init(void);
/**
@ -718,7 +726,7 @@ void STS_PRESENCE_SENSOR_Read(STS_OO_SensorStatusDataTypeDef *o6_data);
void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *sensor_data);
void STS_PRESENCE_SENSOR_Init(void);
void STS_PRESENCE_SENSOR_RSS_Init(void);
//void STS_PRESENCE_SENSOR_RSS_Init(void);
void STS_PRESENCE_SENSOR_REEDSWITCH_HALL_Init(void);
void STS_PRESENCE_SENSOR_TOF_Init(void);
@ -762,9 +770,16 @@ void STS_SENSOR_Function_Test_Process(void);
void STS_SENSOR_Distance_Test_Process(void);
void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_t count);
void STS_PRESENCE_SENSOR_Distance_Measure_Process(void);
void STS_PRESENCE_SENSOR_Background_Measure_Process(uint16_t *bg_distance, uint16_t *bg_motion_noise);
int sts_presence_rss_background_evaluation_process(uint16_t *evaluated_distance, uint16_t *evaluated_score);
void STS_Sensor_Init(void);
void STS_Sensor_Prepare(void);
float KalmanFilter(float inData);
uint8_t STS_RSS_Filter(uint8_t pre_sts_rss_result);
#define PRESET_NUMERATOR 10
#define PRESET_DENOMINATOR 15
void STS_RSS_Filter(uint8_t pre_sts_rss_result);
/* USER CODE BEGIN Private defines */
/*
In this example TIM2 input clock (TIM2CLK) is set to APB1 clock (PCLK1),

View File

@ -31,7 +31,7 @@
#include "tim.h"
#include "sys_app.h"
/* USER CODE END Includes */
#include "yunhorn_sts_sensors.h"
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
@ -97,9 +97,9 @@ int main(void)
MX_LoRaWAN_Init();
/* USER CODE BEGIN 2 */
STS_Sensor_Init();
/* USER CODE END 2 */
STS_Sensor_Prepare();
/* Infinite loop */
/* USER CODE BEGIN WHILE */

View File

@ -126,7 +126,7 @@ void STS_Lamp_Bar_Scoller(uint8_t color, uint8_t lum_level)
for(uint8_t i = 0; i<STS_LAMP_BAR_LED_NUM; i++)
{
HAL_Delay(10); //MAKE THIS LESS THAN 10 NOT TO BLOCK JOIN THE LORAWAN
HAL_Delay(20); //MAKE THIS LESS THAN 10 NOT TO BLOCK JOIN THE LORAWAN
STS_WS2812B_Set_RGB(color_rgb[color][0]*lum_level,color_rgb[color][1]*lum_level, color_rgb[color][2]*lum_level, i);
STS_WS2812B_Refresh();
}

View File

@ -113,7 +113,7 @@ int sts_distance_rss_detector_distance(void)
}
bool success = true;
const int iterations = 5; //5;
const int iterations = 1; //5;
uint16_t number_of_peaks = 1; // FSB first significant Bin
acc_detector_distance_result_t result[number_of_peaks];
acc_detector_distance_result_info_t result_info;

View File

@ -52,7 +52,7 @@
#define DEFAULT_DETECTION_THRESHOLD (2.0f)
#define DEFAULT_NBR_REMOVED_PC_2 (0)
#define DEFAULT_PROFILE ACC_SERVICE_PROFILE_2 //ACC_SERVICE_PROFILE_4
#define DEFAULT_PROFILE ACC_SERVICE_PROFILE_4 //ACC_SERVICE_PROFILE_4
#define DEFAULT_UPDATE_RATE (10)
#define DEFAULT_POWER_SAVE_MODE ACC_POWER_SAVE_MODE_ACTIVE
#define DEFAULT_SENSOR_ID (1)
@ -76,6 +76,8 @@
#define DEFAULT_INTRA_FRAME_TIME_CONST (0) //default 0.0 unit(seconds)
#define DEFAULT_INTRA_FRAME_WEIGHT (0) //default 0.6 for normal slow tracking 1.0 for fast tracking
// 2025 03 26 *** if detection toggles too often, increase the following, if too sluggish, decrease it instead
//#define DEFAULT_OUTPUT_TIME_CONST (0.8f) //default 0.5 unit(seconds) [5]
#define DEFAULT_OUTPUT_TIME_CONST (0.5f) //default 0.5 unit(seconds) [5]
//#define DEFAULT_OUTPUT_TIME_CONST (0.4f) //default 0.5 unit(seconds) [5]
@ -126,6 +128,7 @@ volatile float sts_presence_rss_distance, sts_presence_rss_score;
volatile STS_OO_RSS_SensorTuneDataTypeDef sts_presence_rss_config;
//static void update_configuration(acc_detector_presence_configuration_t presence_configuration);
static void print_result(acc_detector_presence_result_t result);
void STS_Yunhorn_DistanceStandardDeviation(void);
volatile uint8_t motion_detected_count=0;
volatile uint8_t motion_in_hs_zone[12][10]={0}; //0.4*12=4.8meter high, past 10 measures
volatile uint8_t detected_hs_zone=0;;
@ -145,6 +148,9 @@ volatile uint16_t last_average_presence_distance=0;
volatile uint16_t sts_fall_rising_pattern_factor1=0, sts_fall_rising_pattern_factor2=0, sts_fall_rising_pattern_factor3=0;
volatile uint16_t sts_roc_acc_standard_variance=0;
extern volatile uint8_t sts_presence_fall_detection;
static uint8_t sts_rss_init_ok=0;
volatile uint8_t sts_presence_singularity=1;
extern uint8_t sts_lamp_bar_color;
/* USER CODE END Includes */
/* External variables ---------------------------------------------------------*/
@ -189,20 +195,11 @@ extern volatile uint8_t sts_presence_fall_detection;
*
* @param[in] presence_configuration The presence configuration to set default values in
*/
static void set_default_configuration(acc_detector_presence_configuration_t presence_configuration)
static void set_default_configuration_common(acc_detector_presence_configuration_t presence_configuration)
{
acc_detector_presence_configuration_service_profile_set(presence_configuration, DEFAULT_PROFILE);
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
acc_detector_presence_configuration_update_rate_set(presence_configuration, DEFAULT_UPDATE_RATE_PRESENCE);
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, DEFAULT_THRESHOLD);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//acc_service_sparse_configuration_sweeps_per_frame_set(sparse_configuration, sweeps_per_frame);
acc_detector_presence_configuration_start_set(presence_configuration, DEFAULT_START_M);
acc_detector_presence_configuration_length_set(presence_configuration, DEFAULT_LENGTH_M);
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, DEFAULT_RECEIVER_GAIN);
acc_detector_presence_configuration_update_rate_set(presence_configuration, sts_presence_rss_config.default_update_rate_presence);
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, sts_presence_rss_config.default_downsampling_factor);
acc_detector_presence_configuration_filter_parameters_t filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
@ -222,6 +219,47 @@ static void set_default_configuration(acc_detector_presence_configuration_t pres
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
acc_detector_presence_configuration_nbr_removed_pc_set(presence_configuration, DEFAULT_NBR_REMOVED_PC);
acc_detector_presence_configuration_power_save_mode_set(presence_configuration, ACC_POWER_SAVE_MODE_ACTIVE);
}
static void set_default_configuration(acc_detector_presence_configuration_t presence_configuration)
{
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
acc_detector_presence_configuration_service_profile_set(presence_configuration, DEFAULT_PROFILE); // *** optional
acc_detector_presence_configuration_update_rate_set(presence_configuration, DEFAULT_UPDATE_RATE_PRESENCE);
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, DEFAULT_THRESHOLD);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//acc_service_sparse_configuration_sweeps_per_frame_set(sparse_configuration, sweeps_per_frame);
acc_detector_presence_configuration_start_set(presence_configuration, DEFAULT_START_M);
acc_detector_presence_configuration_length_set(presence_configuration, DEFAULT_LENGTH_M);
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, DEFAULT_RECEIVER_GAIN);
set_default_configuration_common(presence_configuration);
// by set_default_configuration_common
#if 0
acc_detector_presence_configuration_filter_parameters_t filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
filter.inter_frame_deviation_time_const = DEFAULT_INTER_FRAME_DEVIATION_TIME_CONST;
// will be disabled if this value > 1/2 of update rate, default update rate 65, so must < 30
filter.inter_frame_fast_cutoff = DEFAULT_INTER_FRAME_FAST_CUTOFF;
filter.inter_frame_slow_cutoff = DEFAULT_INTER_FRAME_SLOW_CUTOFF;
// no effect if intra-frame-weight set to 0
filter.intra_frame_time_const = DEFAULT_INTRA_FRAME_TIME_CONST;
// for slow movement, people sit still, rest in sofa, seat, closestool, etc.
// set the intra_frame_weight to 0.0
filter.intra_frame_weight = DEFAULT_INTRA_FRAME_WEIGHT;
// if detection toggles too often, increase the following, if too sluggish, decrease it instead
filter.output_time_const = DEFAULT_OUTPUT_TIME_CONST; //0.0f;
acc_detector_presence_configuration_filter_parameters_set(presence_configuration, &filter);
acc_detector_presence_configuration_nbr_removed_pc_set(presence_configuration, DEFAULT_NBR_REMOVED_PC);
acc_detector_presence_configuration_power_save_mode_set(presence_configuration, ACC_POWER_SAVE_MODE_ACTIVE);
#endif
// by set_default_configuration_common
}
/**
@ -232,14 +270,12 @@ static void set_default_configuration(acc_detector_presence_configuration_t pres
static void set_default_fall_rise_configuration(acc_detector_presence_configuration_t presence_configuration)
{
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
acc_detector_presence_configuration_service_profile_set(presence_configuration, DEFAULT_PROFILE);
acc_detector_presence_configuration_update_rate_set(presence_configuration, DEFAULT_UPDATE_RATE_PRESENCE);
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, DEFAULT_THRESHOLD);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//acc_service_sparse_configuration_sweeps_per_frame_set(sparse_configuration, sweeps_per_frame);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//acc_service_sparse_configuration_sweeps_per_frame_set(sparse_configuration, sweeps_per_frame);
acc_detector_presence_configuration_start_set(presence_configuration, DEFAULT_START_M);
acc_detector_presence_configuration_length_set(presence_configuration, DEFAULT_LENGTH_M);
acc_detector_presence_configuration_downsampling_factor_set(presence_configuration, DEFAULT_DOWNSAMPLING_FACTOR);
@ -300,27 +336,85 @@ static void sts_rss_set_current_configuration_full(acc_detector_presence_configu
}
static void sts_rss_set_configuration_background_evalution(acc_detector_presence_configuration_t presence_configuration)
{
APP_LOG(TS_OFF, VLEVEL_H, "\r\nsts_rss_cfg-start: %4d ,length: %4d ,threshold: %4d ,gain: %2d ,rate: %2d ,profile: %1d \r\n",
(int)(sts_presence_rss_config.default_start_m*1000),
(int)(sts_presence_rss_config.default_length_m*1000),
(int)(sts_presence_rss_config.default_threshold*1000),
(int)(sts_presence_rss_config.default_receiver_gain*100),
(int)(sts_presence_rss_config.default_update_rate_presence),
(int)(sts_presence_rss_config.default_profile));
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
acc_detector_presence_configuration_service_profile_set(presence_configuration, sts_presence_rss_config.default_profile);
acc_detector_presence_configuration_start_set(presence_configuration, ((float)sts_sensor_install_height/2000.0));
acc_detector_presence_configuration_length_set(presence_configuration, ((float)(sts_sensor_install_height)/1000.0));
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, (float)300.0/1000.0);
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, (float)80/100.0);
set_default_configuration_common(presence_configuration);
}
static void sts_rss_set_current_configuration_simple(acc_detector_presence_configuration_t presence_configuration)
{
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
//acc_detector_presence_configuration_update_rate_set(presence_configuration, DEFAULT_UPDATE_RATE_PRESENCE); 2024-08-21 update
APP_LOG(TS_OFF, VLEVEL_H, "\r\nsts_rss_cfg-start: %4d ,length: %4d ,threshold: %4d ,gain: %2d ,rate: %2d ,profile: %1d \r\n",
(int)(sts_presence_rss_config.default_start_m*1000),
(int)(sts_presence_rss_config.default_length_m*1000),
(int)(sts_presence_rss_config.default_threshold*1000),
(int)(sts_presence_rss_config.default_receiver_gain*100),
(int)(sts_presence_rss_config.default_update_rate_presence),
(int)(sts_presence_rss_config.default_profile));
acc_detector_presence_configuration_sensor_set(presence_configuration, DEFAULT_SENSOR_ID);
acc_detector_presence_configuration_service_profile_set(presence_configuration, sts_presence_rss_config.default_profile);
acc_detector_presence_configuration_update_rate_set(presence_configuration, sts_presence_rss_config.default_update_rate_presence);
acc_detector_presence_configuration_start_set(presence_configuration, sts_presence_rss_config.default_start_m);
acc_detector_presence_configuration_length_set(presence_configuration, sts_presence_rss_config.default_length_m); //DEFAULT_LENGTH_M_2);
acc_detector_presence_configuration_detection_threshold_set(presence_configuration, sts_presence_rss_config.default_threshold);//DEFAULT_DETECTION_THRESHOLD_2);
acc_detector_presence_configuration_receiver_gain_set(presence_configuration, sts_presence_rss_config.default_receiver_gain);
set_default_configuration_common(presence_configuration);
}
static void print_current_configuration(acc_detector_presence_configuration_t presence_configuration)
{
float sts_run_start = acc_detector_presence_configuration_start_get(presence_configuration);
float sts_run_length = acc_detector_presence_configuration_length_get(presence_configuration);
float sts_run_threshold = acc_detector_presence_configuration_detection_threshold_get(presence_configuration);
float sts_run_gain = acc_detector_presence_configuration_receiver_gain_get(presence_configuration);
float sts_run_update_rate = acc_detector_presence_configuration_update_rate_get(presence_configuration);
float sts_run_profile = acc_detector_presence_configuration_service_profile_get(presence_configuration);
acc_detector_presence_configuration_filter_parameters_t sts_run_filter = acc_detector_presence_configuration_filter_parameters_get(presence_configuration);
float sts_run_f_inter_fast_cutoff = sts_run_filter.inter_frame_fast_cutoff;
float sts_run_f_inter_slow_cutoff = sts_run_filter.inter_frame_slow_cutoff;
float sts_run_f_inter_frame_dev_time_const = sts_run_filter.inter_frame_deviation_time_const;
float sts_run_f_intra_frame_time_const = sts_run_filter.intra_frame_time_const;
float sts_run_f_intra_frame_weight = sts_run_filter.intra_frame_weight;
float sts_run_f_output_time_const = sts_run_filter.output_time_const;
APP_LOG(TS_OFF, VLEVEL_M, "\r\nWork_mode:%2d Start: %4d (mm) Length: %4d (mm) Threshold: %4d (*) Gain= %2d (%) UpdateRate=%4d Profile= %d \r\n",
sts_work_mode, (int)(1000.0*sts_run_start), (int)(1000.0*sts_run_length), (int)(1000.0*sts_run_threshold),
(int)(100.0*sts_run_gain),(int)sts_run_update_rate, (int)sts_run_profile);
APP_LOG(TS_OFF, VLEVEL_H, "\rn\n(1)FastCut:%4u (2)SlowCut:%4u (3)InterFrameDevTime:%4u "
"(4)IntraFrameTimeConst:%4d (5)IntraWeight:%4u (5)OutputTime:%4u \r\n",
(int)(1000.0*sts_run_f_inter_fast_cutoff), (int)(1000*sts_run_f_inter_slow_cutoff), (int)(1000*sts_run_f_inter_frame_dev_time_const),
(int)(1000*sts_run_f_intra_frame_time_const),(int)(1000*sts_run_f_intra_frame_weight),(int)(1000*sts_run_f_output_time_const));
}
static void print_result(acc_detector_presence_result_t result)
{
if (result.presence_detected)
{
//uint32_t detected_zone = (uint32_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH);
uint32_t detected_zone = (uint32_t)((float)(result.presence_distance - DEFAULT_START_M) / (float)DEFAULT_ZONE_LENGTH);
// 2024-08-05
uint32_t detected_zone = (uint32_t)((float)(result.presence_distance) / (float)DEFAULT_ZONE_LENGTH);
//uint32_t detected_zone = (uint32_t)((float)(result.presence_distance) / (float)DEFAULT_ZONE_LENGTH);
APP_LOG(TS_OFF, VLEVEL_M,"Motion in zone: %u, distance: %d, score: %d\n", (unsigned int)detected_zone,
(int)(result.presence_distance * 1000.0f),
(int)(result.presence_score * 1000.0f));
@ -336,6 +430,107 @@ static void print_result(acc_detector_presence_result_t result)
* OUTPUT: sts_rss_result = STS_PRESENCE_MOTION, STS_PRESENCE_NO_MOTION
* sts_rss_result
*/
int sts_presence_rss_background_evaluation_process(uint16_t *evaluated_distance, uint16_t *evaluated_score)
{
const acc_hal_t *hal = acc_hal_integration_get_implementation();
if (!acc_rss_activate(hal))
{
APP_LOG(TS_OFF, VLEVEL_H,"Failed to activate RSS\n");
return EXIT_FAILURE;
}
acc_rss_override_sensor_id_check_at_creation(true);
acc_detector_presence_configuration_t presence_configuration = acc_detector_presence_configuration_create();
if (presence_configuration == NULL)
{
APP_LOG(TS_OFF, VLEVEL_H,"Failed to create configuration\n");
acc_rss_deactivate();
return EXIT_FAILURE;
}
sts_rss_set_configuration_background_evalution(presence_configuration);
acc_detector_presence_handle_t handle = acc_detector_presence_create(presence_configuration);
if (handle == NULL)
{
APP_LOG(TS_OFF, VLEVEL_H,"Failed to create detector\n");
acc_detector_presence_configuration_destroy(&presence_configuration);
acc_detector_presence_destroy(&handle);
acc_rss_deactivate();
return EXIT_FAILURE;
}
print_current_configuration(presence_configuration);
acc_detector_presence_configuration_destroy(&presence_configuration);
if (!acc_detector_presence_activate(handle))
{
APP_LOG(TS_OFF, VLEVEL_H, "Failed to activate detector \n");
return false;
}
bool deactivated = false;
bool success = true;
const int iterations = 1000;
acc_detector_presence_result_t result;
uint16_t motioncount = 0;
float average_distance =0.0f;
float average_score =0.0f;
for (int i = 0; i < (iterations); i++)
{
success = acc_detector_presence_get_next(handle, &result);
if (!success)
{
APP_LOG(TS_OFF, VLEVEL_H,"acc_detector_presence_get_next() failed\n");
break;
}
//print_result(result);
if (!result.data_saturated)
{
if (result.presence_detected)
{
//print_result(result);
motioncount++;
average_distance += result.presence_distance;
average_score += result.presence_score;
}
}
acc_integration_sleep_ms(60); //--- around 1000ms in total
if (motioncount%10 ==0)
{
LED1_TOGGLE;
}
}
deactivated = acc_detector_presence_deactivate(handle);
acc_detector_presence_destroy(&handle);
acc_rss_deactivate();
average_distance = (1000.0f*average_distance)/motioncount; // in meters
average_score = (1000.0f*average_score)/motioncount;
APP_LOG(TS_OFF, VLEVEL_M, "\r\nBackground Scan: MotionCount: %d , Distance Center Around: %d (mm) , Score: %d \r\n", (int) motioncount, (int)average_distance, (int)average_score);
*evaluated_distance = (uint16_t)average_distance;
*evaluated_score = (uint16_t)average_score;
LED1_ON;
return EXIT_SUCCESS;
}
int sts_presence_rss_fall_rise_detection(void)
{
const acc_hal_t *hal = acc_hal_integration_get_implementation();
@ -356,56 +551,60 @@ int sts_presence_rss_fall_rise_detection(void)
return EXIT_FAILURE;
}
switch (sts_rss_config_updated_flag)
if ((sts_rss_config_updated_flag != STS_RSS_CONFIG_NON) || (sts_rss_init_ok != 1))
{
case STS_RSS_CONFIG_NON:
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Non *** cfg \n");
return EXIT_SUCCESS;
break;
case STS_RSS_CONFIG_DEFAULT:
set_default_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Default *** cfg applied\n");
break;
case STS_RSS_CONFIG_SIMPLE:
sts_rss_set_current_configuration_simple(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n");
break;
case STS_RSS_CONFIG_FULL:
sts_rss_set_current_configuration_full(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n");
break;
case STS_RSS_CONFIG_FALL_DETECTION:
set_default_fall_rise_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FALL DETECTION *** cfg applied\n");
break;
case STS_RSS_CONFIG_DEFAULT|STS_RSS_CONFIG_SIMPLE:
set_default_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Default *** cfg applied\n");
sts_rss_set_current_configuration_simple(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n");
break;
case STS_RSS_CONFIG_DEFAULT|STS_RSS_CONFIG_FULL:
set_default_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Default *** cfg applied\n");
sts_rss_set_current_configuration_full(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n");
break;
case STS_RSS_CONFIG_FULL|STS_RSS_CONFIG_FALL_DETECTION:
set_default_fall_rise_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FALL DETECTION *** cfg applied\n");
sts_rss_set_current_configuration_full(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n");
break;
case STS_RSS_CONFIG_SIMPLE|STS_RSS_CONFIG_FALL_DETECTION:
set_default_fall_rise_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Default *** cfg applied\n");
sts_rss_set_current_configuration_simple(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n");
break;
default:
break;
APP_LOG(TS_OFF, VLEVEL_H, "\r\n ------ ---------- rss cfg update flag=%02x \r\n", sts_rss_config_updated_flag);
if (sts_rss_init_ok==0)
{
if (sts_work_mode ==STS_UNI_MODE)
{
sts_rss_config_updated_flag = STS_RSS_CONFIG_FALL_DETECTION;
}
else if ((sts_work_mode == STS_RSS_MODE) || (sts_work_mode == STS_DUAL_MODE))
{
if (sts_rss_config_updated_flag == STS_RSS_CONFIG_NON)
sts_rss_config_updated_flag = STS_RSS_CONFIG_DEFAULT;
}
//set_default_configuration(presence_configuration);
//APP_LOG(TS_OFF, VLEVEL_M, "\r\n First Time RSS init, update flag=%02x\r\n", sts_rss_config_updated_flag);
//print_current_configuration(presence_configuration);
sts_rss_init_ok = 1;
}
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Update flag=%02x, workmode=%2d \r\n", sts_rss_config_updated_flag, sts_work_mode);
switch (sts_rss_config_updated_flag)
{
#if 0
case STS_RSS_CONFIG_NON:
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Non *** cfg \n");
// return EXIT_SUCCESS;
break;
#endif
case STS_RSS_CONFIG_DEFAULT:
set_default_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Default *** cfg applied\n");
break;
case STS_RSS_CONFIG_SIMPLE:
sts_rss_set_current_configuration_simple(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n##### YUNHORN STS *** Simple *** cfg applied\n");
break;
case STS_RSS_CONFIG_FULL:
sts_rss_set_current_configuration_full(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FULL *** cfg applied\n");
break;
case STS_RSS_CONFIG_FALL_DETECTION:
set_default_fall_rise_configuration(presence_configuration);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n######### YUNHORN STS *** FALL DETECTION *** cfg applied\n");
break;
default:
break;
}
// sts_rss_config_updated_flag = STS_RSS_CONFIG_NON; //update finished, set to 0
}
//sts_rss_config_updated_flag = STS_RSS_CONFIG_DEFAULT; //update finished, set to 0
acc_detector_presence_handle_t handle = acc_detector_presence_create(presence_configuration);
if (handle == NULL)
@ -416,6 +615,14 @@ int sts_presence_rss_fall_rise_detection(void)
acc_rss_deactivate();
return EXIT_FAILURE;
}
APP_LOG(TS_OFF, VLEVEL_H,"\r\n============= Start Scan\n");
print_current_configuration(presence_configuration);
acc_detector_presence_configuration_destroy(&presence_configuration);
// BEFORE MERGE FIRST AND SECOND HALF FALL RISE DETECTION
if (!acc_detector_presence_activate(handle))
@ -425,7 +632,7 @@ int sts_presence_rss_fall_rise_detection(void)
}
bool deactivated = false;
bool success = true;
const int iterations = (DEFAULT_UPDATE_RATE_PRESENCE+1);
const int iterations = (DEFAULT_UPDATE_RATE_PRESENCE);
acc_detector_presence_result_t result;
uint8_t average_result = 0;
float average_distance =0.0f;
@ -497,7 +704,7 @@ int sts_presence_rss_fall_rise_detection(void)
acc_detector_presence_destroy(&handle);
acc_rss_deactivate();
APP_LOG(TS_OFF, VLEVEL_M, "\r\n First Half --- Motion Count = %u \r\n", motion_count);
APP_LOG(TS_OFF, VLEVEL_H, "\r\n First Half --- Motion Count = %u \r\n", motion_count);
//acc_detector_presence_deactivate(handle);
}
@ -585,7 +792,7 @@ int sts_presence_rss_fall_rise_detection(void)
acc_rss_deactivate();
APP_LOG(TS_OFF, VLEVEL_M, "\r\n Second Half --- Motion Count Sum to = %u \r\n", motion_count);
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Second Half --- Motion Count Sum to = %u \r\n", motion_count);
//APP_LOG(TS_OFF, VLEVEL_L,"Second Half, Fall Rise Detection, Motion Count = %u \r\n", (int)motion_count);
@ -601,23 +808,56 @@ int sts_presence_rss_fall_rise_detection(void)
}
average_distance = (1000.0f*average_distance)/average_result; // in meters
average_score = (1000.0f*average_score)/average_result;
average_distance = (float)(1000.0f*average_distance)/(float)average_result; // in meters
average_score = (float)(1000.0f*average_score)/(float)average_result;
sts_presence_rss_distance = average_distance;
sts_presence_rss_score = average_score;
uint8_t pre_sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/20))? 1: 0;
sts_rss_result=STS_RSS_Filter(pre_sts_rss_result);
STS_Yunhorn_DistanceStandardDeviation();
// APP_LOG(TS_OFF, VLEVEL_H, "\r\nAverage Distance: %d (mm) Score: %d Singularity: %d \r\n",(int)average_distance, (int)average_score, sts_presence_singularity);
// uint8_t pre_sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/5))? 1: 0;
// sts_rss_result=STS_RSS_Filter(pre_sts_rss_result);
//APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Result=%d Distance=%d, Score=%d MotionCount=%d \r\n",
// (int)average_result, (int)average_distance, (int)average_score, (int)motion_count);
// sts_rss_result = (average_result > (DEFAULT_UPDATE_RATE_PRESENCE/5))? 1: 0;
// sts_rss_result = (average_result > 0)? 1: 0;
uint8_t pre_sts_rss_result=0;
if (sts_work_mode == STS_UNI_MODE) {
pre_sts_rss_result = (average_result > 0)? 1: 0;
} else {
pre_sts_rss_result = ((average_result > 0)&&(sts_presence_singularity ==0))? 1: 0;
}
//Write_RingBuff(pre_sts_rss_result);
//STS_RSS_Filter_ring();
STS_RSS_Filter(pre_sts_rss_result);
//else {
// sts_rss_result = 0;
// }
// APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotionCount=%4d Overall Motion=%d \r\n", (int)motion_count, (int)sts_rss_result);
//APP_LOG(TS_OFF, VLEVEL_M, "\r\nAverage Result=%d Distance=%d, Score=%d MotionCount=%d ---Overall Result=%d \r\n",
// (int)average_result, (int)average_distance, (int)average_score, (int)motion_count, (int)sts_rss_result);
APP_LOG(TS_OFF, VLEVEL_M, "\r\nMotion Status: %d %d (mm) %d singularity: %d Rated-> %d \r\n",(int)average_result, (int)average_distance, (int)average_score, (int)sts_presence_singularity, (int)sts_rss_result);
#if 0
if (sts_rss_result) //if (average_score !=0) //if (sts_rss_result)
{
APP_LOG(TS_OFF, VLEVEL_M,"\r\n######## MotionLevel=%4u (level) Gain=%2u (%) Start=%4u (mm) Length=%4u (mm)\r\n",
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######## MotionLevel=%4u (level) Gain=%2u (%) Start=%4u (mm) Length=%4u (mm)\r\n",
(int)(1000.0f*sts_presence_rss_config.default_threshold),(int)(100.0f*sts_presence_rss_config.default_receiver_gain),
(int)(1000.0f*sts_presence_rss_config.default_start_m), (int)(1000.0f*sts_presence_rss_config.default_length_m));
APP_LOG(TS_OFF, VLEVEL_M,"\r\n######## Motion: %u Distance=%u mm, Score=%u Average_result=%u out of %u \r\n",
(uint8_t)sts_rss_result,(int) sts_presence_rss_distance, (int)(sts_presence_rss_score), (int)average_result, (int)iterations);
}
#endif
// RSS feature 1: Motion, No-motion process
@ -627,7 +867,6 @@ int sts_presence_rss_fall_rise_detection(void)
OnSensorRSS3AStateChanged();
} else {
LED1_OFF;
}
// RSS feature 2: Fall Detection process
@ -647,7 +886,7 @@ int sts_presence_rss_fall_rise_detection(void)
// RSS feature 3: No motion, or stay still , or unconscious process
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u \r\n", motion_detected_count);
uint8_t thiscnt= motion_detected_count++;
//uint8_t thiscnt= motion_detected_count++;
// APP_LOG(TS_OFF, VLEVEL_M,"\r\n|Motion Detected Count =%u and thiscnt=%u \r\n", motion_detected_count, thiscnt);
if (motion_detected_count == 10) {
//for (uint8_t j=0; j<12; j++) motion_in_hs_zone[j][thiscnt]=0;
@ -681,14 +920,38 @@ int sts_presence_rss_fall_rise_detection(void)
if (deactivated && success)
{
//APP_LOG(TS_OFF, VLEVEL_M,"Application finished OK\n");
APP_LOG(TS_OFF, VLEVEL_H,"Application finished OK\n");
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}
void STS_Yunhorn_DistanceStandardDeviation(void)
{
uint16_t i,j;
uint32_t sum_presence_distance = 0;
uint32_t average_presence_distance = 0;
uint8_t SAMPLE_DATASET_NUM = MIN(motion_count,DEFAULT_UPDATE_RATE_PRESENCE );
for(i= 0; i< SAMPLE_DATASET_NUM; i++)
{
sum_presence_distance += (uint32_t)sts_motion_dataset[i].presence_distance;
}
average_presence_distance = ((uint32_t)sum_presence_distance/(uint32_t)(SAMPLE_DATASET_NUM));
sum_presence_distance = 0;
for (j = 0; j < SAMPLE_DATASET_NUM; j++)
{
sum_presence_distance += (uint32_t)(sts_motion_dataset[j].presence_distance - average_presence_distance);
}
sts_presence_singularity = (sum_presence_distance > 0)? 0:1;
// APP_LOG(TS_OFF, VLEVEL_M, "\r\n*** STS_Singularity=%u ***\r\n", sts_presence_singularity);
}
void STS_YunhornCheckStandardDeviation(void)
{
uint16_t i,j; // sts_sensor_install_height <--- average_presence_distance should be approaching this distance - 50cm

View File

@ -45,7 +45,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
uint8_t t=0;
uint8_t test_result[20]={0x0};
APP_LOG(TS_OFF, VLEVEL_L,"-- 0 -- Acconeer software version %s\n", acc_version_get());
// APP_LOG(TS_OFF, VLEVEL_L,"-- 0 -- Acconeer software version %s\n", acc_version_get());
const acc_hal_t *hal = acc_hal_integration_get_implementation();
@ -67,7 +67,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 0; //(3)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
@ -81,7 +81,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 0; //(4)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
@ -89,7 +89,7 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
acc_rss_assembly_test_configuration_communication_write_read_test_disable(configuration);
// Enable and run: Interrupt Test
APP_LOG(TS_OFF, VLEVEL_L,"-- Interrupt Test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Interrupt Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_communication_interrupt_test_enable(configuration);
if (!run_test(configuration))
@ -97,125 +97,125 @@ int sts_presence_rss_bring_up_test(uint8_t *rss_self_test_result)
test_result[t++] = 0; //(5)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_communication_interrupt_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Interrupt Test --- End ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Interrupt Test --- End ********************\r\n");
// Enable and run: Clock Test
APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_clock_test_enable(configuration);
if (!run_test(configuration))
{
test_result[t++] = 0; // (8)
test_result[t++] = 0; // (6)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_clock_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- end ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- end ********************\r\n");
// Enable and run: Power cycle test
APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration);
if (!run_test(configuration))
{
test_result[t++] = 0; //(9)
test_result[t++] = 0; //(7)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n");
// Enable and run: Hibernate Test
APP_LOG(TS_OFF, VLEVEL_L,"-- Hibernate Test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Hibernate Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_communication_hibernate_test_enable(configuration);
if (!run_test(configuration))
{
test_result[t++] = 0; //(6)
test_result[t++] = 0; //(8)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_communication_hibernate_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Hibernate Test --- End ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Hibernate Test --- End ********************\r\n");
// Enable and run: Supply Test
APP_LOG(TS_OFF, VLEVEL_L,"-- Supply Test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Supply Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_supply_test_enable(configuration);
if (!run_test(configuration))
{
test_result[t++] = 0; //(7)
test_result[t++] = 0; //(9)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_supply_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Supply Test --- End ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Supply Test --- End ********************\r\n");
// Enable and run: Clock Test
APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_clock_test_enable(configuration);
if (!run_test(configuration))
{
test_result[t++] = 0; // (8)
test_result[t++] = 0; // (10)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_clock_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- end ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Clock Test --- end ********************\r\n");
// Enable and run: Power cycle test
APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- Start ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- Start ********************\r\n");
acc_rss_assembly_test_configuration_power_cycle_test_enable(configuration);
if (!run_test(configuration))
{
test_result[t++] = 0; //(9)
test_result[t++] = 0; //(11)
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
//return EXIT_FAILURE;
return EXIT_FAILURE;
} else {
test_result[t++] = 1;
}
acc_rss_assembly_test_configuration_power_cycle_test_disable(configuration);
APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n");
// APP_LOG(TS_OFF, VLEVEL_L,"-- Power cycle test --- end ********************\r\n");
APP_LOG(TS_OFF, VLEVEL_L,"-- 10 -- Bring up test: All tests passed\n");
test_result[t++] = 1; //(10)
// APP_LOG(TS_OFF, VLEVEL_L,"-- 10 -- Bring up test: All tests passed\n");
test_result[t++] = 1; //(12)
memcpy(rss_self_test_result, test_result, 12);
APP_LOG(TS_OFF, VLEVEL_L,"--Bring up test result #=%d \r\n", t);
// APP_LOG(TS_OFF, VLEVEL_L,"--Bring up test result #=%d \r\n", t);
acc_rss_assembly_test_configuration_destroy(&configuration);
acc_rss_deactivate();
@ -234,7 +234,7 @@ static bool run_test(acc_rss_assembly_test_configuration_t configuration)
APP_LOG(TS_OFF, VLEVEL_L,"Bring up test: Failed to complete\n");
return false;
} else {
APP_LOG(TS_OFF, VLEVEL_L,"Bring up test: SUCCESS to complete\n");
APP_LOG(TS_OFF, VLEVEL_H,"Bring up test: SUCCESS to complete\n");
}

View File

@ -117,6 +117,10 @@ volatile uint8_t sts_rss_result = STS_RESULT_NO_MOTION;
volatile uint8_t sts_rss_2nd_result = STS_RESULT_NO_MOTION; //2nd RSS sensor status
volatile uint8_t sts_tof_result = STS_RESULT_NO_MOTION;
volatile uint8_t last_sts_rss_result=STS_RESULT_NO_MOTION;
_Bool Motion_Flag = 0;
extern volatile uint8_t sts_presence_singularity;
volatile uint8_t sts_rss_cfg_slid_win_threshold=8;
volatile uint8_t sts_rss_cfg_slid_win_size=12;
//extern volatile uint8_t last_sts_reed_hall_result;
extern volatile uint8_t last_lamp_bar_color;
@ -185,6 +189,46 @@ char sts_presence_fall_detection_message[10][20]={
/* USER CODE END PFP */
/* Exported functions --------------------------------------------------------*/
#if 0
void STS_Sensor_Init(void)
{
/// **************************************************************************** TO-DO LIST
STS_REBOOT_CONFIG_Init();
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_YunhornSTSEventP2_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), UTIL_SEQ_RFU, STS_YunhornSTSEventP3_Process);
#if 0
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP7), UTIL_SEQ_RFU, STS_YunhornSTSEventP7_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP8), UTIL_SEQ_RFU, STS_YunhornSTSEventP8_Process);
#endif
#if defined(STS_O7)||defined(STS_O6)
UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, YUNHORN_STS_HEART_BEAT_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
UTIL_TIMER_Start(&STSLampBarColorTimer);
//UTIL_TIMER_Start(&STSDurationCheckTimer);
#else
UTIL_TIMER_Create(&YunhornSTSSamplingCheckTimer, YUNHORN_STS_SAMPLING_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSSamplingCheckTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSSamplingCheckTimer);
#endif
}
#endif
void STS_YunhornAuthenticationCode_Process(void)
{
@ -273,6 +317,7 @@ void STS_YunhornSTSEventP2_Process(void)
//STS_Lamp_Bar_Refresh(); //TODO XXX eliminate refresh every second.... try
if ((sts_work_mode >= STS_RSS_MODE) && (sts_work_mode <= STS_TOF_RSS_MODE))
{
#if 0
switch (sts_work_mode) {
case STS_RSS_MODE:
sts_rss_config_updated_flag |= STS_RSS_CONFIG_DEFAULT;
@ -286,26 +331,29 @@ void STS_YunhornSTSEventP2_Process(void)
default:
break;
}
#endif
int res = sts_presence_rss_fall_rise_detection();
if (res == 0)
{
sts_presence_rss_fall_rise_detection();
sts_rss_result_changed_flag = (sts_rss_result == last_sts_rss_result)? 0:1;
sts_rss_result_changed_flag = (sts_rss_result == last_sts_rss_result)? 0:1;
last_sts_rss_result = sts_rss_result;
last_sts_rss_result = sts_rss_result;
//sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result == last_sts_fall_rising_detected_result)?0:1;
//sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result != last_sts_fall_rising_detected_result)?1:0;
//sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result == last_sts_fall_rising_detected_result)?0:1;
//sts_fall_rising_detected_result_changed_flag = (sts_fall_rising_detected_result != last_sts_fall_rising_detected_result)?1:0;
last_sts_fall_rising_detected_result = sts_fall_rising_detected_result;
last_sts_fall_rising_detected_result = sts_fall_rising_detected_result;
if (sts_service_mask > 0 ) {
sts_rss_result_changed_flag =0;
sts_reed_hall_changed_flag = 0;
sts_fall_rising_detected_result_changed_flag =0;
}
if (sts_service_mask > 0 ) {
sts_rss_result_changed_flag =0;
sts_reed_hall_changed_flag = 0;
sts_fall_rising_detected_result_changed_flag =0;
}
STS_Combined_Status_Processing();
STS_Combined_Status_Processing();
} else APP_LOG(TS_OFF, VLEVEL_H, "\r\n RSS detection error =%d \r\n", res);
}
}
@ -711,7 +759,14 @@ void STS_PRESENCE_SENSOR_NVM_CFG(void)
sts_presence_rss_config.default_downsampling_factor = (float)(sts_cfg_nvm.p[RSS_CFG_DOWNSAMPLING_FACTOR]);
sts_presence_rss_config.default_power_save_mode = (float)(sts_cfg_nvm.p[RSS_CFG_POWER_MODE]);
sts_rss_config_updated_flag = (sts_rss_config_updated_flag|STS_RSS_CONFIG_FULL); //set to 2 for FULL config effect in next detection
// sts_rss_config_updated_flag = (sts_rss_config_updated_flag|STS_RSS_CONFIG_FULL); //set to 2 for FULL config effect in next detection
//sts_rss_config_updated_flag = (STS_RSS_CONFIG_FULL); //set to 2 for FULL config effect in next detection
//sts_presence_rss_config.default_config_update_flag = (uint8_t) sts_rss_config_updated_flag;
sts_rss_config_updated_flag = (uint8_t)(sts_cfg_nvm.p[RSS_CFG_UPDATE_FLAG]);
sts_rss_cfg_slid_win_threshold = (uint8_t)(sts_cfg_nvm.p[RSS_CFG_SLID_WIN])>>4;
sts_rss_cfg_slid_win_size = (uint8_t)(sts_cfg_nvm.p[RSS_CFG_SLID_WIN])&0x0F;
APP_LOG(TS_ON, VLEVEL_H, "\r\n##### Reboot --- with NVM CFG'ED RSS flag =%02x \r\n", sts_rss_config_updated_flag);
}
void STS_PRESENCE_SENSOR_NVM_CFG_SIMPLE(void)
@ -721,7 +776,20 @@ void STS_PRESENCE_SENSOR_NVM_CFG_SIMPLE(void)
sts_presence_rss_config.default_threshold = (float)(sts_cfg_nvm.p[RSS_CFG_THRESHOLD]*0.1f);
sts_presence_rss_config.default_receiver_gain = (float)(sts_cfg_nvm.p[RSS_CFG_RECEIVER_GAIN]*0.01f);
sts_rss_config_updated_flag = (sts_rss_config_updated_flag|STS_RSS_CONFIG_SIMPLE); //set to 1 for simple config effect in next detection
sts_presence_rss_config.default_zone_length_m = DEFAULT_ZONE_LENGTH;
sts_presence_rss_config.default_profile = (float)(sts_cfg_nvm.p[RSS_CFG_PROFILE]);
sts_presence_rss_config.default_update_rate_tracking = (float)(sts_cfg_nvm.p[RSS_CFG_RATE_TRACKING]);
sts_presence_rss_config.default_update_rate_presence = (float)(sts_cfg_nvm.p[RSS_CFG_RATE_PRESENCE]);
sts_presence_rss_config.default_hwaas = (float)(sts_cfg_nvm.p[RSS_CFG_HWAAS]);
sts_presence_rss_config.default_nbr_removed_pc = (float)(sts_cfg_nvm.p[RSS_CFG_NBR_REMOVED_PC]);
// sts_rss_config_updated_flag = (sts_rss_config_updated_flag|STS_RSS_CONFIG_SIMPLE); //set to 1 for simple config effect in next detection
sts_rss_config_updated_flag = (STS_RSS_CONFIG_SIMPLE); //set to 1 for simple config effect in next detection
//sts_presence_rss_config.default_config_update_flag = (uint8_t) sts_rss_config_updated_flag;
sts_rss_config_updated_flag = (uint8_t)(sts_cfg_nvm.p[RSS_CFG_UPDATE_FLAG]);
sts_rss_cfg_slid_win_threshold = (uint8_t)(sts_cfg_nvm.p[RSS_CFG_SLID_WIN])>>4;
sts_rss_cfg_slid_win_size = (uint8_t)(sts_cfg_nvm.p[RSS_CFG_SLID_WIN])&0x0F;
}
void STS_PRESENCE_SENSOR_Init_Send_Data(void)
@ -879,7 +947,7 @@ void STS_PRESENCE_SENSOR_Prepare_Send_Data(STS_OO_SensorStatusDataTypeDef *senso
*/
void STS_PRESENCE_SENSOR_Init(void)
{
APP_LOG(TS_ON, VLEVEL_M, "##### YunHorn SmarToilets(r) Presence Sensor Started\r\n");
APP_LOG(TS_ON, VLEVEL_H, "##### YunHorn SmarToilets(r) Presence Sensor Started\r\n");
sts_o7_sensorData.workmode = (uint8_t)sts_work_mode; //STS_DUAL_MODE;
sts_o7_sensorData.lamp_bar_color = (uint8_t)STS_GREEN;
@ -938,31 +1006,33 @@ void STS_PRESENCE_SENSOR_REEDSWITCH_HALL_Init(void)
APP_LOG(TS_ON, VLEVEL_H, "##### YunHorn SmarToilets(r) REED SWITCH HALL ELEMENT Initializing \r\n");
}
#if 0
void STS_PRESENCE_SENSOR_RSS_Init(void)
{
APP_LOG(TS_ON, VLEVEL_H, "##### YunHorn SmarToilets(r) MEMS RSS Initializing \r\n");
// PME_ON;
#if 0
//if ((sts_distance_rss_distance==0)&&(sts_sensor_install_height==0))
{
uint8_t exit_status =0;
do {
exit_status=sts_distance_rss_detector_distance();
if (exit_status ==0) {
APP_LOG(TS_ON, VLEVEL_H, "##### RSS Installation Height =%u \r\n", (uint16_t)sts_distance_rss_distance);
APP_LOG(TS_ON, VLEVEL_M, "##### RSS Installation Height =%u \r\n", (uint16_t)sts_distance_rss_distance);
}
else {
APP_LOG(TS_ON, VLEVEL_H, "##### RSS Installation Height Error \r\n");
HAL_Delay(100);
APP_LOG(TS_ON, VLEVEL_M, "##### RSS Installation Height Error \r\n");
//HAL_Delay(100);
}
} while((0));
sts_sensor_install_height = (uint16_t)sts_distance_rss_distance;
}
#endif
STS_PRESENCE_SENSOR_NVM_CFG();
#if 0
switch (sts_work_mode)
{
case STS_RSS_MODE:
@ -978,9 +1048,10 @@ void STS_PRESENCE_SENSOR_RSS_Init(void)
default:
break;
}
#endif
APP_LOG(TS_ON, VLEVEL_M, "\r\n##### Reboot --- with NVM CFG'ED RSS flag =%02x \r\n", sts_rss_config_updated_flag);
}
#endif
void STS_PRESENCE_SENSOR_Distance_Measure_Process(void)
{
@ -991,18 +1062,44 @@ void STS_PRESENCE_SENSOR_Distance_Measure_Process(void)
(unsigned int)(distance_cfg.acc_profile),(unsigned int)(distance_cfg.hwaas));
do
{
LED1_TOGGLE;
exit_status = sts_distance_rss_detector_distance();
HAL_Delay(100);
HAL_Delay(10);
i++;
} while ((exit_status == EXIT_FAILURE) && (i < 2));
} while ((exit_status == EXIT_FAILURE) && (i < 1));
LED1_ON;
}
void STS_PRESENCE_SENSOR_Background_Measure_Process(uint16_t *bg_distance, uint16_t *bg_motion_noise)
{
uint8_t previous_sts_work_mode = sts_work_mode, previous_sts_lamp_bar_color = sts_lamp_bar_color;
uint16_t distance_center=0, motion_noise=0;
sts_work_mode = STS_RSS_BACKGROUND_MODE;
sts_lamp_bar_color = STS_BLUE;
APP_LOG(TS_OFF, VLEVEL_M, "\r\n SCAN Background Noise ... \r\n");
sts_presence_rss_background_evaluation_process(&distance_center, &motion_noise);
APP_LOG(TS_OFF, VLEVEL_H, "\r\n Background Distance center at %d mm, and Motion Noise =%d \r\n", distance_center, motion_noise);
*bg_distance = distance_center;
*bg_motion_noise = motion_noise;
sts_work_mode = previous_sts_work_mode;
sts_lamp_bar_color = previous_sts_lamp_bar_color;
}
void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_t count)
{
uint8_t bring_up_result[20];
uint8_t bring_up_result[18]={0};
uint8_t previous_lamp_bar_color=sts_lamp_bar_color;
uint16_t bg_range=0, bg_noise=0;
PME_ON;
HAL_Init();
MX_GPIO_Init();
@ -1011,19 +1108,34 @@ void STS_PRESENCE_SENSOR_Function_Test_Process(uint8_t *self_test_result, uint8_
for (uint8_t i=0;i < count; i++) //while(1)
{
STS_Lamp_Bar_Self_Test_Simple();
sts_lamp_bar_color = STS_PINK;
STS_Lamp_Bar_Refresh();
HAL_Delay(1000);
sts_presence_rss_bring_up_test(bring_up_result);
HAL_Delay(200);
sts_lamp_bar_color = STS_PINK;
int bur = sts_presence_rss_bring_up_test(bring_up_result);
HAL_Delay(1000);
if (bur == EXIT_SUCCESS)
{
HAL_Delay(200);
sts_lamp_bar_color = STS_CYAN;
STS_PRESENCE_SENSOR_Distance_Measure_Process();
bring_up_result[12]=sts_sensor_install_height>>8&0xff;
bring_up_result[13]=sts_sensor_install_height&0xff;
STS_PRESENCE_SENSOR_Distance_Measure_Process();
HAL_Delay(200);
STS_PRESENCE_SENSOR_Background_Measure_Process(&bg_range, &bg_noise);
bring_up_result[14]=bg_range>>8&0xff;
bring_up_result[15]=bg_range&0xff;
bring_up_result[16]=bg_noise>>8&0xff;
bring_up_result[17]=bg_noise&0xff;
}
}
HAL_Delay(1000);
HAL_Delay(200);
sts_lamp_bar_color = previous_lamp_bar_color;
UTIL_MEM_cpy_8(self_test_result, bring_up_result, 10);
UTIL_MEM_cpy_8(self_test_result, bring_up_result, sizeof(bring_up_result));
}
@ -1431,51 +1543,66 @@ void Radar_Filtering_clutter(volatile uint8_t *color)
}
#endif
#define PRESET_DENOMINATOR 8
#define PRESET_NUMERATOR 5
uint8_t STS_RSS_Filter(uint8_t pre_sts_rss_result)
#if 1
#define FILTER_LEN 15
// #define SLIDING_WIN_LEN 12
// #define SLIDING_THRESHOLD 8
// replaced by sts_rss_cfg_slid_win_threshold and sts_rss_cfg_slid_win_size
//
static uint8_t motion_read[FILTER_LEN]={0};
static uint8_t idx_filter=0;
//static uint8_t sts_cnt_singularity=0;
void STS_RSS_Filter(uint8_t pre_sts_rss_result)
{
_Bool pNew_Motion_Flag = 0;
static uint8_t Motion_Changed_Flag = 0;
static uint8_t numerator = 0;
static uint8_t denominator = 0;
uint8_t Motion_Flag = sts_rss_result, xReturn=0;
uint8_t j=0;
//uint8_t sum_sliding_win = 0;
pNew_Motion_Flag = pre_sts_rss_result;
if(pNew_Motion_Flag != Motion_Flag){
Motion_Changed_Flag = 1;
}
motion_read[idx_filter] = pre_sts_rss_result;
if(Motion_Changed_Flag == 1)
{
denominator++;
if(pNew_Motion_Flag != Motion_Flag){
numerator++;
}
if(denominator >= PRESET_DENOMINATOR)
uint8_t sum_filter = 0;
uint8_t k=0;
for (j=0; j<sts_rss_cfg_slid_win_size; j++)
{
if(numerator >= PRESET_NUMERATOR) //SURE CHANGED
if ((idx_filter - j) >=0)
{
Motion_Flag = !Motion_Flag;
if(Motion_Flag)
{
//M100C_Send_Data(10,0,ZhanYong);
xReturn = 1;
}
else
{
//M100C_Send_Data(10,0,KeYong);
xReturn = 0;
}
k = idx_filter - j;
}
denominator = 0;
numerator = 0;
Motion_Changed_Flag = 0;
else
{
k = (idx_filter - j + FILTER_LEN)%FILTER_LEN;
}
sum_filter += motion_read[k];
}
}
return xReturn;
idx_filter = (idx_filter + 1) % FILTER_LEN;
if (sts_rss_result)
{
//sts_rss_result= ((sum_filter >= SLIDING_THRESHOLD))? 1:0;
// sts_rss_result= ((sum_filter > (SLIDING_WIN_LEN - SLIDING_THRESHOLD)))? 1:0;
sts_rss_result= ((sum_filter > (sts_rss_cfg_slid_win_size - sts_rss_cfg_slid_win_threshold)))? 1:0;
} else {
sts_rss_result= ((sum_filter > sts_rss_cfg_slid_win_threshold))? 1:0;
}
#if 0
if ((sts_presence_singularity == 1 )&& (sts_cnt_singularity ++ > sts_rss_cfg_slid_win_threshold))
{
sts_rss_result = 0;
sts_cnt_singularity =0;
}
#endif
}
#endif
/* USER CODE BEGIN EF */

View File

@ -86,16 +86,22 @@ volatile bool p2_work_finished=true;
extern volatile uint8_t luminance_level;
uint8_t outbuf[255]={0x0};
volatile static bool r_b=true;
static uint8_t nvm_stored_value[2*YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
static uint8_t sts_cfg_nvm_factory_default[YUNHORN_STS_MAX_NVM_CFG_SIZE];
static void STS_Show_STS_CFG_NVM(uint8_t * store_value, uint16_t store_size);
extern volatile uint8_t sts_rss_cfg_slid_win_threshold;
extern volatile uint8_t sts_rss_cfg_slid_win_size;
volatile sts_cfg_nvm_t sts_cfg_nvm = {
sts_mtmcode1,
sts_mtmcode2,
sts_version,
sts_hardware_ver,
0x05,
0x0A,
'M', //Uplink data interval for heart-beat uplink
0x01,
'S', //Sampling sensor interval for real-time sensing of MEMS
0x04, // dual mode=4, uni_mode =5
0x03, // dual mode=4, uni_mode =5
0x00, // sts service mask
0x00, //sts_ioc_mask
0x20, //32 bytes, below start of p[0] 20 BYTES AND 12 BYTES FALL DOWN CFG
@ -114,12 +120,12 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
0x01, //inter frame slow cutoff,0x01=1[1]*0.01=0.01f
0x00, //intra frame time const [0]=0 Lower to reduce sensitivity, higher to increase sensitivity
0x0A, //intra frame weight, 0x00=[0]*0.1=0.0F 0x0A=10, 10*0.1=1 FOR FAST MOVEMENT TRACKING FALL DETECTION
0x05, //output time const 0x05=[5]*0.1=0.5
0x09, //output time const 0x05=[5]*0.1=0.5 0.5--> 0.9 2025-03-26 TODO XXXXXX
0x02, //downsampling factor [2]=2
0x03, //power saving mode ACTIVE [3] = 3U
0x00, //reserve --P[17]
0x00, //reserve --P[18]
0x00, //reserve --P[19]
0x02, //P[17] RSS CFG UPDATE FLAG 2025-04-14
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
0x00, //reserve3
@ -139,7 +145,7 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
// below 20 bytes for RFAC code
{0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0}
};
static uint32_t sts_warm_up_count = 0;
#if defined(STS_O6)||defined(STS_O7)
extern volatile uint8_t sensor_data_ready;
extern volatile STS_OO_SensorStatusDataTypeDef sts_o7_sensorData;
@ -575,8 +581,8 @@ void LoRaWAN_Init(void)
/* USER CODE END LoRaWAN_Init_LV */
/* USER CODE BEGIN LoRaWAN_Init_1 */
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n##### YUNHORN_STS_SWV%d HWV:%d MTM:%d.%d R:%d.%d.%d####\r\n\n\n",
sts_version, sts_hardware_ver, sts_mtmcode1,sts_mtmcode2, MajorVer, MinorVer, SubMinorVer);
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n##### YUNHORN_STS_SWV:%d HWV:%d MTM:%d.%d %s R:%d.%d.%d####\r\n\n\n",
sts_version, sts_hardware_ver, sts_mtmcode1,sts_mtmcode2, YUNHORN_STS_PRD_STRING, MajorVer, MinorVer, SubMinorVer);
/* Get LoRaWAN APP version*/
APP_LOG(TS_OFF, VLEVEL_M, "APPLICATION_VERSION: V%X.%X.%X\r\n",
@ -614,8 +620,9 @@ void LoRaWAN_Init(void)
UTIL_TIMER_Create(&TxLedTimer, LED_PERIOD_TIME, UTIL_TIMER_ONESHOT, OnTxTimerLedEvent, NULL);
UTIL_TIMER_Create(&RxLedTimer, LED_PERIOD_TIME, UTIL_TIMER_ONESHOT, OnRxTimerLedEvent, NULL);
UTIL_TIMER_Create(&JoinLedTimer, LED_PERIOD_TIME, UTIL_TIMER_PERIODIC, OnJoinTimerLedEvent, NULL);
UTIL_TIMER_Create(&STSLampBarColorTimer, LED_PERIOD_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSLampBarColorTimerEvent, NULL);
UTIL_TIMER_Create(&STSDurationCheckTimer, 20*LED_PERIOD_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSDurationCheckTimerEvent, NULL);
UTIL_TIMER_Create(&STSLampBarColorTimer, 2*LED_PERIOD_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSLampBarColorTimerEvent, NULL);
// UTIL_TIMER_Create(&STSDurationCheckTimer, 30*LED_PERIOD_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSDurationCheckTimerEvent, NULL);
if (FLASH_IF_Init(NULL) != FLASH_IF_OK)
{
@ -666,6 +673,9 @@ void LoRaWAN_Init(void)
}
/* USER CODE BEGIN LoRaWAN_Init_Last */
/* VVVVVV migrated to yunhorn_sts_process.c */
#if 0
/// **************************************************************************** TO-DO LIST
STS_REBOOT_CONFIG_Init();
@ -683,8 +693,8 @@ void LoRaWAN_Init(void)
#endif
#if defined(STS_O7)||defined(STS_O6)
//UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
//UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, YUNHORN_STS_HEART_BEAT_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
@ -697,9 +707,67 @@ void LoRaWAN_Init(void)
UTIL_TIMER_Create(&YunhornSTSSamplingCheckTimer, YUNHORN_STS_SAMPLING_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSSamplingCheckTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSSamplingCheckTimer);
#endif
#endif
/* VVVVVV migrated to yunhorn_sts_process.c */
/* USER CODE END LoRaWAN_Init_Last */
}
void STS_Sensor_Init(void)
{
/* VVVVVV migrated to yunhorn_sts_process.c */
// #if 0
/// **************************************************************************** TO-DO LIST
STS_REBOOT_CONFIG_Init();
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_YunhornSTSEventP1_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_YunhornSTSEventP2_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP3), UTIL_SEQ_RFU, STS_YunhornSTSEventP3_Process);
#if 0
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), UTIL_SEQ_RFU, STS_YunhornSTSEventP4_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP5), UTIL_SEQ_RFU, STS_YunhornSTSEventP5_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP6), UTIL_SEQ_RFU, STS_YunhornSTSEventP6_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP7), UTIL_SEQ_RFU, STS_YunhornSTSEventP7_Process);
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP8), UTIL_SEQ_RFU, STS_YunhornSTSEventP8_Process);
#endif
#if defined(STS_O7)||defined(STS_O6)
UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
// UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
// HeartBeatPeriodicity HAS BEEN CHANGED IN REBOOT SESSION UPDATE 2025-04-23
// UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, YUNHORN_STS_HEART_BEAT_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity, UTIL_TIMER_PERIODIC, OnYunhornSTSHeartBeatTimerEvent, NULL);
// UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
//UTIL_TIMER_Start(&STSDurationCheckTimer);
#else
UTIL_TIMER_Create(&YunhornSTSSamplingCheckTimer, YUNHORN_STS_SAMPLING_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSSamplingCheckTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSSamplingCheckTimer);
#endif
// #endif
/* VVVVVV migrated to yunhorn_sts_process.c */
}
void STS_Sensor_Prepare(void)
{
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
}
/* USER CODE BEGIN PB_Callbacks */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
@ -1042,11 +1110,11 @@ static void SendTxData(void)
char colorshow[30]="";
strcpy(colorshow, (ich==0)?"":sts_lamp_color_code[ich]);
APP_LOG(TS_OFF, VLEVEL_L,
APP_LOG(TS_OFF, VLEVEL_H,
"\r\n######| Color = %s%s | Mode = %5s |\r\n",(char *)colorshow, sts_lamp_color_code[icl], (char*)sts_work_mode_code[sts_work_mode]);
if (sts_work_mode == STS_UNI_MODE)
{
APP_LOG(TS_OFF, VLEVEL_L,
APP_LOG(TS_OFF, VLEVEL_H,
"\r\n######| S1-Door | S2-SOS | S3-Motion| S4 |Distance(mm) | MotionScore| Unconscious | Over_Stay_(min) | Fall Detected|"
"\r\n######| %s | %s | %d | %1d | %04d | %04d | %1d | %4d | %s |\r\n",
sts_door_status_code[sensorData.state_sensor1_on_off],
@ -1057,21 +1125,21 @@ static void SendTxData(void)
sensorData.unconscious_state, sensorData.over_stay_duration, sts_fall_mode_code[sensorData.fall_state]);
} else if (sts_work_mode == STS_DUAL_MODE) {
APP_LOG(TS_OFF, VLEVEL_L,
APP_LOG(TS_OFF, VLEVEL_H,
"\r\n######| S1-Door | S2-SOS | S3-Motion |\r\n"
"\r\n######| %s | %s | %d |\r\n",
sts_door_status_code[sensorData.state_sensor1_on_off],
sts_sos_status_code[sensorData.state_sensor2_on_off],
sensorData.state_sensor3_on_off);
} else if (sts_work_mode == STS_RSS_MODE) {
APP_LOG(TS_OFF, VLEVEL_L,
APP_LOG(TS_OFF, VLEVEL_H,
"\r\n######| S3-Motion |\r\n"
"\r\n######| %d |\r\n",sensorData.state_sensor3_on_off);
} else {
APP_LOG(TS_OFF, VLEVEL_M,"\r\n\n**************************************** UNKNOWN MODE \r\n");
APP_LOG(TS_OFF, VLEVEL_H,"\r\n\n**************************************** UNKNOWN MODE \r\n");
}
} else if (sensor_data_ready == 0) {
APP_LOG(TS_OFF, VLEVEL_M,"\r\n\n**************************************** SENSOR_DATA_READY =%u \r\n", sensor_data_ready);
APP_LOG(TS_OFF, VLEVEL_H,"\r\n\n**************************************** SENSOR_DATA_READY =%u \r\n", sensor_data_ready);
}
AppData.BufferSize = (uint8_t)(sts_service_mask > STS_SERVICE_MASK_L1? 0:i)&0xff;;
@ -1126,15 +1194,19 @@ static void OnTxTimerEvent(void *context)
{
/* USER CODE BEGIN OnTxTimerEvent_1 */
if (sts_warm_up_count < 5)
{
/* USER CODE END OnTxTimerEvent_1 */
if ((sensor_data_ready ==1)) //|| (sts_reed_hall_changed_flag)) //||(sts_rss_result_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
//if ((sensor_data_ready ==1)) //|| (sts_reed_hall_changed_flag)) //||(sts_rss_result_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
//if ((sensor_data_ready ==1) || (sts_reed_hall_changed_flag) || (sts_rss_result_changed_flag)||(sts_fall_rising_detected_result_changed_flag))
{
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
/*Wait for next tx slot*/
UTIL_TIMER_Start(&TxTimer);
}
/*Wait for next tx slot*/
sts_warm_up_count++;
}
UTIL_TIMER_Start(&TxTimer);
//}
/* USER CODE BEGIN OnTxTimerEvent_2 */
@ -1412,39 +1484,53 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
STS_LoRa_WAN_Joined = (uint8_t) joinParams->Mode;
APP_LOG(TS_OFF, VLEVEL_L,"\r\n STS_LoRa_WAN_Joined = %s \r\n", (STS_LoRa_WAN_Joined == 1)?"ABP":"OTAA");
AppData.Port = 1;
AppData.BufferSize = 16;
// UTIL_MEM_cpy_8(AppData.Buffer, (uint8_t*)"YUNHORN168", 10);
UTIL_MEM_cpy_8((uint8_t*)AppData.Buffer, (uint8_t *)YUNHORN_STS_PRD_STRING, sizeof(YUNHORN_STS_PRD_STRING));
AppData.BufferSize = sizeof(YUNHORN_STS_PRD_STRING);
LmHandlerParams.IsTxConfirmed = true;
LmHandlerErrorStatus_t status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
if (status ==LORAMAC_HANDLER_SUCCESS ) LmHandlerParams.IsTxConfirmed = false;
}
else
{
APP_LOG(TS_OFF, VLEVEL_M, "\r\n###### = JOIN FAILED\r\n");
}
APP_LOG(TS_OFF, VLEVEL_H, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower);
APP_LOG(TS_OFF, VLEVEL_M, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower);
}
if (STS_LoRa_WAN_Joined)
{
//STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, 20, (uint8_t*)"STS_Calibrated");
#if 0
STS_SENSOR_Distance_Test_Process();
APP_LOG(TS_OFF, VLEVEL_M, "\r\nRSS Measured Distance=[%u] mm \r\n", (uint16_t)sts_distance_rss_distance);
//STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, 20, (uint8_t*)"STS_Calibrated");
heart_beat_timer = 1;
//SendTxData();
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
//UTIL_TIMER_Start(&TxTimer);
UTIL_TIMER_Start(&STSDurationCheckTimer);
//UTIL_TIMER_Start(&STSDurationCheckTimer);
OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity);
//UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_PERIODIC, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
STS_SENSOR_Distance_Test_Process();
APP_LOG(TS_OFF, VLEVEL_H, "\r\nRSS Measured Distance=[%u] mm \r\n", (uint16_t)sts_distance_rss_distance);
UTIL_TIMER_Create(&YunhornSTSRSSWakeUpTimer, YUNHORN_STS_RSS_WAKEUP_CHECK_TIME, UTIL_TIMER_ONESHOT, OnYunhornSTSOORSSWakeUpTimerEvent, NULL);
UTIL_TIMER_Start(&YunhornSTSRSSWakeUpTimer);
#endif
}
// update 2025 04 16
UTIL_TIMER_Start(&STSLampBarColorTimer);
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
/* USER CODE END OnJoinRequest_1 */
}
@ -1930,7 +2016,17 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
__set_FAULTMASK(1);
OnSystemReset();
} else if ((char)tlv_buf[CFG_CMD3] == 'S') { // Self Function Testing "YZS"
} else if ((char)tlv_buf[CFG_CMD3] == 'F') { // RESET TO FACTORY ORIGINAL SETTING "YZF"
sts_cfg_nvm_factory_default[0] = 0x46; // F flag set
//STS_REBOOT_CONFIG_Init();
OnRestoreSTSCFG_FactoryDefault_ContextRequest();
__set_FAULTMASK(1);
OnSystemReset();
} else if ((char)tlv_buf[CFG_CMD3] == 'S') { // Self Function Testing "YZS"
i=0;
//outbuf[i++] = (uint8_t) 'Y';
//outbuf[i++] = (uint8_t) 'Z';
@ -1988,11 +2084,10 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
outbuf[i++] = (uint8_t)(99*((GetBatteryLevel()/254)&0xff));
#if defined(STS_O7)||defined(STS_O6)
outbuf[i++] = (uint8_t)0x04; //length of following data
outbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/1000)%10+0x30)&0xff;
outbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/100)%10+0x30)&0xff;
outbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/10)%10+0x30)&0xff;
outbuf[i++] = (uint8_t) (((uint16_t)sts_distance_rss_distance)%10+0x30)&0xff;
outbuf[i++] = (uint8_t)0x02; //length of following data, 2025 04 14 UPDATE
outbuf[i++] = (uint8_t) (((uint16_t)sts_distance_rss_distance>>8)&0xff);
outbuf[i++] = (uint8_t) ((uint16_t)sts_distance_rss_distance&0xff);
#endif
#if (defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R1_ENABLED))
#ifdef TOF_1
@ -2012,9 +2107,36 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
} else if ((char)tlv_buf[CFG_CMD3] == 'B')
{ // Background Noise Measure "YZB"
#if defined(STS_O7)||defined(STS_O6)
uint16_t bg_distance=0, bg_motion_noise=0;
STS_PRESENCE_SENSOR_Background_Measure_Process(&bg_distance, &bg_motion_noise);
APP_LOG(TS_OFF, VLEVEL_M, "\r\nRSS Measured Background Center Distance=[%u] mm Motion Noise Level = [%d] \r\n",
(uint16_t)bg_distance, (uint16_t)bg_motion_noise);
sts_cfg_nvm.p[RSS_CFG_BG_MOTION_NOISE] = (uint8_t)(bg_motion_noise/10)&0xff;
OnStoreSTSCFGContextRequest();
i=0;
outbuf[i++] = (uint8_t)'B';
outbuf[i++] = (uint8_t)sts_mtmcode1;
outbuf[i++] = (uint8_t)sts_mtmcode2;
outbuf[i++] = (uint8_t)sts_version;
outbuf[i++] = (uint8_t)sts_hardware_ver;
outbuf[i++] = (uint8_t)(99*((GetBatteryLevel()/254)&0xff));
outbuf[i++] = (uint8_t) 0x04; //length of following data
outbuf[i++] = (uint8_t) (bg_distance>>8)&0xff;
outbuf[i++] = (uint8_t) (bg_distance)&0xff;
outbuf[i++] = (uint8_t) (bg_motion_noise>>8)&0xff;
outbuf[i++] = (uint8_t) (bg_motion_noise)&0xff;
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
#endif
}
break;
break; // "YZ_"
case 'M': //"YM"
if ((char)tlv_buf[CFG_CMD3] >= '0' && (char)tlv_buf[CFG_CMD3]<='9') // Service Mask "YZM"
@ -2263,6 +2385,39 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
}
break;
case 'W': // YWXYY --- CHANGE RSS SLIDING WINDOW X: THRESHOLD, YY: WINDOW LENGTH
if ( ((char)tlv_buf[CFG_CMD3] >= '0') && ((char)tlv_buf[CFG_CMD3] <= '9')
&& ((char)tlv_buf[CFG_CMD4] >= '0') && ((char)tlv_buf[CFG_CMD4] <= '9')
&& ((char)tlv_buf[CFG_CMD5] >= '0') && ((char)tlv_buf[CFG_CMD5] <= '9'))
{
uint8_t slid_win_threshold=0, slid_win_size=0;
slid_win_threshold = (tlv_buf[CFG_CMD3] - 0x30)&0x0f;
slid_win_size = ((tlv_buf[CFG_CMD4] - 0x30)*10 + (tlv_buf[CFG_CMD5] - 0x30))&0x0f;
if (slid_win_size > slid_win_threshold)
{
sts_rss_cfg_slid_win_threshold = slid_win_threshold;
sts_rss_cfg_slid_win_size = slid_win_size;
sts_cfg_nvm.p[RSS_CFG_SLID_WIN] = (slid_win_threshold<<4)|(slid_win_size&0x0f);
APP_LOG(TS_OFF, VLEVEL_M, "\r\nSliding win threshold:%d window length: %d stored cfg:0x%02x \r\n",
sts_rss_cfg_slid_win_threshold, sts_rss_cfg_slid_win_size, sts_cfg_nvm.p[RSS_CFG_SLID_WIN]);
OnStoreSTSCFGContextRequest();
} else
{
APP_LOG(TS_OFF, VLEVEL_M, "\r\nCFG ERR, sliding win threshold/length incorrect");
}
}
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;
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
break;
default:
//STS_SENSOR_Upload_Config_Invalid_Message();
@ -2527,6 +2682,8 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
if (invalid_flag == 0)
{
sts_cfg_nvm.p[RSS_CFG_UPDATE_FLAG] = STS_RSS_CONFIG_FULL;
STS_PRESENCE_SENSOR_NVM_CFG();
i=0; // Step 1: Prepare status update message
@ -2567,7 +2724,10 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
sts_cfg_nvm.p[RSS_CFG_THRESHOLD] = (uint8_t)((tlv_buf[CFG_CMD8] - 0x30)*10+(tlv_buf[CFG_CMD9] - 0x30));
sts_cfg_nvm.p[RSS_CFG_RECEIVER_GAIN] = (uint8_t)((tlv_buf[CFG_CMD10]- 0x30)*10+(tlv_buf[CFG_CMD11]- 0x30));
APP_LOG(TS_OFF, VLEVEL_M,"\r\nStart,Lenght,threshold,gain=%02x %02x %02x %02x \r\n",
sts_cfg_nvm.p[RSS_CFG_START_M],sts_cfg_nvm.p[RSS_CFG_LENGTH_M],sts_cfg_nvm.p[RSS_CFG_THRESHOLD],sts_cfg_nvm.p[RSS_CFG_RECEIVER_GAIN]);
sts_cfg_nvm.p[RSS_CFG_UPDATE_FLAG] = STS_RSS_CONFIG_SIMPLE;
STS_PRESENCE_SENSOR_NVM_CFG_SIMPLE();
i=0; // Step 1: Prepare status update message
@ -2637,6 +2797,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
for (uint8_t j=0; j < YUNHORN_STS_AC_CODE_SIZE; j++)
{
sts_cfg_nvm.ac[j] = sts_ac_code[j];
sts_cfg_nvm_factory_default[NVM_AC_CODE_START+j] = sts_ac_code[j];
}
sts_service_mask = STS_SERVICE_MASK_L0;
@ -2650,11 +2811,13 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, uint8_t tlv_buf_size)
}
i=0;
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;
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t *)outbuf);
}
} // END OF USER_APP_AUTO_RESPONDER_Parse
@ -2725,54 +2888,19 @@ void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, uint8
void OnStoreSTSCFGContextRequest(void)
{
/* USER CODE BEGIN OnStoreContextRequest_1 */
uint8_t i=0,j=0,nvm_store_value[YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
//#if (defined(STS_O7)||defined(STS_O5) || defined(STS_O6) || defined(STS_R0) || defined(STS_R5)|| defined(STS_R4)|| defined(STS_R1D))
sts_cfg_nvm.length = STS_O7_NVM_CFG_SIZE;
nvm_store_value[i++] = sts_cfg_nvm.mtmcode1;
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;
nvm_store_value[i++] = sts_cfg_nvm.periodicity;
nvm_store_value[i++] = sts_cfg_nvm.unit;
nvm_store_value[i++] = sts_cfg_nvm.sampling;
nvm_store_value[i++] = sts_cfg_nvm.s_unit;
nvm_store_value[i++] = sts_cfg_nvm.work_mode;
nvm_store_value[i++] = sts_cfg_nvm.sts_service_mask;
nvm_store_value[i++] = sts_cfg_nvm.sts_ioc_mask;
nvm_store_value[i++] = sts_cfg_nvm.length; //(uint8_t) STS_O7_NVM_CFG_SIZE; //sts_cfg_nvm.length;
for (j = 0; j < STS_O7_CFG_PCFG_SIZE; j++) {
nvm_store_value[i++] = (sts_cfg_nvm.p[j]);
}
nvm_store_value[i++] = sts_cfg_nvm.reserve02;
nvm_store_value[i++] = sts_cfg_nvm.reserve03;
nvm_store_value[i++] = sts_cfg_nvm.sensor_install_height_in_10cm;
nvm_store_value[i++] = sts_cfg_nvm.alarm_parameter05;
nvm_store_value[i++] = sts_cfg_nvm.alarm_mute_reset_timer_in_10sec;
nvm_store_value[i++] = sts_cfg_nvm.alarm_lamp_bar_flashing_color;
nvm_store_value[i++] = sts_cfg_nvm.occupancy_overtime_threshold_in_10min;
nvm_store_value[i++] = sts_cfg_nvm.motionless_duration_threshold_in_min;
nvm_store_value[i++] = sts_cfg_nvm.unconscious_or_motionless_level_threshold;
nvm_store_value[i++] = sts_cfg_nvm.fall_detection_acc_threshold;
nvm_store_value[i++] = sts_cfg_nvm.fall_detection_depth_threshold;
nvm_store_value[i++] = sts_cfg_nvm.fall_confirm_threshold_in_10sec;
if ((sts_cfg_nvm.ac[0]!=0x0) && (sts_cfg_nvm.ac[19]!=0x0)) {
for (j = 0; j < YUNHORN_STS_AC_CODE_SIZE; j++) {
nvm_store_value[i++] = (sts_cfg_nvm.ac[j]);
}
}
//#endif
UTIL_MEM_cpy_8(nvm_stored_value,(void*)&sts_cfg_nvm, sizeof(sts_cfg_nvm));
UTIL_MEM_cpy_8(nvm_stored_value + YUNHORN_STS_MAX_NVM_CFG_SIZE, (const void*)sts_cfg_nvm_factory_default, sizeof(sts_cfg_nvm_factory_default));
/* USER CODE END OnStoreContextRequest_1 */
/* store nvm in flash */
if (FLASH_IF_Erase(STS_CONFIG_NVM_BASE_ADDRESS, FLASH_PAGE_SIZE) == FLASH_IF_OK)
{
FLASH_IF_Write(STS_CONFIG_NVM_BASE_ADDRESS, (const void *)nvm_store_value, YUNHORN_STS_MAX_NVM_CFG_SIZE);
}
// final write once only
FLASH_IF_Write(STS_CONFIG_NVM_BASE_ADDRESS, (const void *)nvm_stored_value, sizeof(sts_cfg_nvm)+sizeof(sts_cfg_nvm_factory_default));
}
/* USER CODE BEGIN OnStoreContextRequest_Last */
@ -2780,6 +2908,33 @@ void OnStoreSTSCFGContextRequest(void)
/* USER CODE END OnStoreContextRequest_Last */
}
void OnRestoreSTSCFG_FactoryDefault_ContextRequest(void)
{
//uint8_t nvm_store_value[2*YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
APP_LOG(TS_OFF, VLEVEL_M, "Restore Factory Default NVM ********************** \r\n");
/* USER CODE END OnRestoreSTSCFGContextRequest_1 */
FLASH_IF_Read((void*)sts_cfg_nvm_factory_default, (void*)STS_CONFIG_NVM_BASE_ADDRESS+YUNHORN_STS_MAX_NVM_CFG_SIZE, YUNHORN_STS_MAX_NVM_CFG_SIZE);
UTIL_MEM_cpy_8((void*)nvm_stored_value, (void*)sts_cfg_nvm_factory_default, YUNHORN_STS_MAX_NVM_CFG_SIZE);
UTIL_MEM_cpy_8((void*)&nvm_stored_value+YUNHORN_STS_MAX_NVM_CFG_SIZE, (void*)sts_cfg_nvm_factory_default, YUNHORN_STS_MAX_NVM_CFG_SIZE);
STS_Show_STS_CFG_NVM((uint8_t*)nvm_stored_value, sizeof(nvm_stored_value));
if (FLASH_IF_Erase(STS_CONFIG_NVM_BASE_ADDRESS, FLASH_PAGE_SIZE) == FLASH_IF_OK)
{
APP_LOG(TS_OFF, VLEVEL_M, "\r\n %%%%% write CFG to normal NVM \r\n");
FLASH_IF_Write(STS_CONFIG_NVM_BASE_ADDRESS, (const void *)nvm_stored_value, 2*YUNHORN_STS_MAX_NVM_CFG_SIZE);
//FLASH_IF_Write(FLASH_MFG_DEFAULT_START_ADDR, (const void *)sts_cfg_nvm_factory_default, YUNHORN_STS_MAX_NVM_CFG_SIZE);
//sts_cfg_nvm_factory_default[0] = 0xF3; // with valid ac code
}
}
void OnRestoreSTSCFGContextRequest(void *cfg_in_nvm)
{
/* USER CODE BEGIN OnRestoreSTSCFGContextRequest_1 */
@ -2802,22 +2957,28 @@ void OnRestoreSTSCFGContextRequest(void *cfg_in_nvm)
void STS_REBOOT_CONFIG_Init(void)
{
/* USER CODE BEGIN OnRestoreContextRequest_1 */
uint8_t nvm_stored_value[YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
//uint8_t nvm_stored_value[2*YUNHORN_STS_MAX_NVM_CFG_SIZE]={0x0};
/* USER CODE END OnRestoreContextRequest_1 */
//UTIL_MEM_cpy_8(nvm_stored_value, (void *)STS_CONFIG_NVM_BASE_ADDRESS, YUNHORN_STS_MAX_NVM_CFG_SIZE);
FLASH_IF_Read(nvm_stored_value, STS_CONFIG_NVM_BASE_ADDRESS, YUNHORN_STS_MAX_NVM_CFG_SIZE);
FLASH_IF_Read(nvm_stored_value, STS_CONFIG_NVM_BASE_ADDRESS, 2*YUNHORN_STS_MAX_NVM_CFG_SIZE);
STS_Show_STS_CFG_NVM((uint8_t*)nvm_stored_value, sizeof(nvm_stored_value));
/* USER CODE BEGIN OnRestoreContextRequest_Last */
//#if (defined(STS_O7)||defined(STS_O5) || defined(STS_O6) || defined(STS_R0) || defined(STS_R5)|| defined(STS_R4)|| defined(STS_R1D))
if ((nvm_stored_value[NVM_MTM1] != sts_mtmcode1) || (nvm_stored_value[NVM_MTM2] != sts_mtmcode2) || (nvm_stored_value[NVM_VER] != sts_version))
{
APP_LOG(TS_OFF, VLEVEL_M, "Initial Boot with Empty Config, Flash with default config....\r\n");
UTIL_MEM_cpy_8(sts_cfg_nvm_factory_default, (void*)&sts_cfg_nvm, (sizeof(sts_cfg_nvm)));
OnStoreSTSCFGContextRequest();
//UTIL_MEM_set_8((void *)sts_ac_code, 0x00, YUNHORN_STS_AC_CODE_SIZE);
HAL_Delay(1000);
} else
{
UTIL_MEM_cpy_8(sts_cfg_nvm_factory_default, nvm_stored_value+YUNHORN_STS_MAX_NVM_CFG_SIZE, YUNHORN_STS_MAX_NVM_CFG_SIZE);
sts_cfg_nvm.mtmcode1 = (uint8_t)nvm_stored_value[NVM_MTM1];
sts_cfg_nvm.mtmcode2 = (uint8_t)nvm_stored_value[NVM_MTM2];
sts_cfg_nvm.version = (uint8_t)nvm_stored_value[NVM_VER];
@ -2853,6 +3014,7 @@ void STS_REBOOT_CONFIG_Init(void)
for (uint8_t j=0; j< YUNHORN_STS_AC_CODE_SIZE; j++) {
sts_cfg_nvm.ac[j] = (uint8_t)nvm_stored_value[NVM_AC_CODE_START +j];
}
}
//#endif
@ -2944,6 +3106,7 @@ void OnRestoreSTSCFGContextProcess(void)
// if ((sts_version == sts_cfg_nvm.version)&& (NVM_CFG_PARAMETER_SIZE == sts_cfg_nvm.length))
{
STS_PRESENCE_SENSOR_Init();
STS_PRESENCE_SENSOR_NVM_CFG();
//STS_PRESENCE_SENSOR_RSS_Init();
}
#endif
@ -2965,7 +3128,7 @@ void STS_SENSOR_Distance_Test_Process(void)
void STS_SENSOR_Function_Test_Process(void)
{
char tstbuf[128] =""; uint8_t i=0, count = 1;
uint8_t tstbuf[128] ={0x0}; uint8_t i=0, count = 1;
uint8_t mems_Dev_ID[2] = {0x0};
tstbuf[i++] = (uint8_t) 'S';
@ -2983,22 +3146,23 @@ void STS_SENSOR_Function_Test_Process(void)
}
else
{
tstbuf[i++] = (uint8_t)14; //length of following data
tstbuf[i++] = (uint8_t)18; //length of following data 16 bytes
#if defined(STS_O7)||defined(STS_O6)
uint8_t self_test_result[10]={0x0};
uint8_t self_test_result[18]={0x0};
STS_PRESENCE_SENSOR_Function_Test_Process(self_test_result, count);
for (uint8_t j=0; j < 10; j++)
for (uint8_t j=0; j < 18; j++)
tstbuf[i++] = (uint8_t) (self_test_result[j])&0xff;
//STS_PRESENCE_SENSOR_Distance_Measure_Process();
#if 0
tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/1000)%10+0x30)&0xff;
tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/100)%10+0x30)&0xff;
tstbuf[i++] = (uint8_t) ((((uint16_t)sts_distance_rss_distance)/10)%10+0x30)&0xff;
tstbuf[i++] = (uint8_t) (((uint16_t)sts_distance_rss_distance)%10+0x30)&0xff;
#endif
#endif
#if (defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R1_ENABLED))
tstbuf[i++] = (uint8_t) (count)&0xff;
//MX_TOF_Process();
@ -3021,7 +3185,7 @@ void STS_SENSOR_Function_Test_Process(void)
}
//memset((void*)outbuf,0x0, sizeof(outbuf));
UTIL_MEM_cpy_8((void*)outbuf, (void*)tstbuf, i);
UTIL_MEM_cpy_8((void*)outbuf, (void*)tstbuf, sizeof(tstbuf));
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, (uint8_t*)outbuf);
}
@ -3034,9 +3198,25 @@ 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_H, "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);
return (uint32_t)UnixEpoch.Seconds;
}
static void STS_Show_STS_CFG_NVM(uint8_t * store_value, uint16_t store_size)
{
APP_LOG(TS_OFF, VLEVEL_H, "\n-----------------------------------------------\n");
APP_LOG(TS_OFF, VLEVEL_H, "\n00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15\n");
for (uint16_t i=0; i< store_size; i++)
{
if (i%16==0) APP_LOG(TS_OFF, VLEVEL_M, "\n");
APP_LOG(TS_OFF, VLEVEL_H, "%02X ", store_value[i]);
}
APP_LOG(TS_OFF, VLEVEL_H, "\n\r");
APP_LOG(TS_OFF, VLEVEL_H, "\n###############################################\n\r");
}

View File

@ -135,7 +135,7 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.2109882892" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="NUCLEO-WL55JC1" valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.239742593" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.5 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || NUCLEO-WL55JC1 || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../../Core/Inc | ../../LoRaWAN/Target | ../../../../../../../Utilities/misc | ../../../../../../../Middlewares/Third_Party/SubGHz_Phy | ../../../../../../../Utilities/lpm/tiny_lpm | ../../../../../../../Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver | ../../../../../../../Drivers/CMSIS/Device/ST/STM32WLxx/Include | ../../../../../../../Utilities/sequencer | ../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler/Packages | ../../LoRaWAN/App | ../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac/Region | ../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc | ../../../../../../../Drivers/STM32WLxx_HAL_Driver/Inc/Legacy | ../../../../../../../Utilities/trace/adv_trace | ../../../../../../../Drivers/BSP/STM32WLxx_Nucleo | ../../../../../../../Utilities/timer | ../../../../../../../Middlewares/Third_Party/LoRaWAN/Mac | ../../../../../../../Middlewares/Third_Party/LoRaWAN/Utilities | ../../../../../../../Middlewares/Third_Party/LoRaWAN/Crypto | ../../../../../../../Middlewares/Third_Party/LoRaWAN/LmHandler | ../../../../../../../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32WL55xx | CORE_CM4 || || || || || ${workspace_loc:/${ProjName}/STM32WL55JCIX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || " valueType="string"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat.1874218879" name="Use float with scanf from newlib-nano (-u _scanf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.1776401448" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.1776401448" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertbinary.639397767" name="Convert to binary file (-O binary)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertbinary" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.2096511505" name="Convert to Intel Hex file (-O ihex)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.listfile.769752034" name="Generate list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.listfile" useByScannerDiscovery="false" value="false" valueType="boolean"/>
@ -155,8 +155,8 @@
<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="CLOCK_SYNC"/>
<listOptionValue builtIn="false" value="RM2_1"/>
<listOptionValue builtIn="false" value="STS_O7"/>
<listOptionValue builtIn="false" value="RM2"/>
<listOptionValue builtIn="false" value="STS_O6"/>
<listOptionValue builtIn="false" value="YUNHORN_STS_RANDOM"/>
<listOptionValue builtIn="false" value="STM32WLE5xx"/>
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
@ -201,7 +201,7 @@
<listOptionValue builtIn="false" value=":libSTM32Cryptographic_CM4.a"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.directories.1886557558" name="Library search path (-L)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.directories" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rss/lib}&quot;"/>
<listOptionValue builtIn="false" value="../../rss/lib"/>
<listOptionValue builtIn="false" value="../../../../../../../Middlewares/ST/STM32_Cryptographic/lib"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.otherflags.612263897" name="Other flags" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.otherflags" useByScannerDiscovery="false" valueType="stringList">

View File

@ -32,11 +32,21 @@
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>Doc/AS923_HK_CLASS_A_C.js</name>
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/AS923_HK_CLASS_A_C.js</locationURI>
</link>
<link>
<name>Doc/AS923_HK_DECODER.js</name>
<type>1</type>
<locationURI>copy_PARENT/AS923_HK_DECODER.js</locationURI>
</link>
<link>
<name>Doc/AS923_HK_DECODER_o2o3o6v2023.js</name>
<type>1</type>
<locationURI>PARENT-1-PROJECT_LOC/AS923_HK_DECODER_o2o3o6v2023.js</locationURI>
</link>
<link>
<name>Doc/YUNHORN-STS-O7.pdf</name>
<type>1</type>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
################################################################################
# Automatically-generated file. Do not edit!
# Toolchain: GNU Tools for STM32 (12.3.rel1)
# Toolchain: GNU Tools for STM32 (13.3.rel1)
################################################################################
-include ../makefile.init
@ -12,9 +12,12 @@ RM := rm -rf
-include Utilities/subdir.mk
-include Middlewares/SubGHz_Phy/subdir.mk
-include Middlewares/LoRaWAN/subdir.mk
-include Drivers/vl53l1x_uld/subdir.mk
-include Drivers/STM32WLxx_HAL_Driver/subdir.mk
-include Drivers/CMSIS/subdir.mk
-include Drivers/BSP/STM32WLxx_Nucleo/subdir.mk
-include Application/User/TOF/Target/subdir.mk
-include Application/User/TOF/App/subdir.mk
-include Application/User/Startup/subdir.mk
-include Application/User/LoRaWAN/Target/subdir.mk
-include Application/User/LoRaWAN/App/subdir.mk
@ -68,7 +71,7 @@ main-build: STS_O7.elf secondary-outputs
# Tool invocations
STS_O7.elf STS_O7.map: $(OBJS) $(USER_OBJS) D:\ONEDRIVE\STM32WLV13\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\YUNHORN_STS_E5CC_AS923_POC\STM32CubeIDE\STM32WLE5CCUX_FLASH.ld makefile objects.list $(OPTIONAL_TOOL_DEPS)
arm-none-eabi-gcc -o "STS_O7.elf" @"objects.list" $(USER_OBJS) -Wl,--start-group $(LIBS) -Wl,--end-group -mcpu=cortex-m4 -T"D:\ONEDRIVE\STM32WLV13\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\YUNHORN_STS_E5CC_AS923_POC\STM32CubeIDE\STM32WLE5CCUX_FLASH.ld" --specs=nosys.specs -Wl,-Map="STS_O7.map" -Wl,--gc-sections -static -L"D:\ONEDRIVE\STM32WLV13\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\STS_O7\STM32CubeIDE\rss\lib" -L../../../../../../../Middlewares/ST/STM32_Cryptographic/lib -Xlinker -no-enum-size-warning -z noexecstack --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
arm-none-eabi-gcc -o "STS_O7.elf" @"objects.list" $(USER_OBJS) -Wl,--start-group $(LIBS) -Wl,--end-group -mcpu=cortex-m4 -T"D:\ONEDRIVE\STM32WLV13\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\YUNHORN_STS_E5CC_AS923_POC\STM32CubeIDE\STM32WLE5CCUX_FLASH.ld" --specs=nosys.specs -Wl,-Map="STS_O7.map" -Wl,--gc-sections -static -L../../rss/lib -L../../../../../../../Middlewares/ST/STM32_Cryptographic/lib -Xlinker -no-enum-size-warning -z noexecstack --specs=nano.specs -mfloat-abi=soft -mthumb -u _printf_float -Wl,--start-group -lc -lm -Wl,--end-group
@echo 'Finished building target: $@'
@echo ' '

Binary file not shown.

Binary file not shown.