diff --git a/Core/Src/main.c b/Core/Src/main.c
index 6e229fe..b01f0ea 100644
--- a/Core/Src/main.c
+++ b/Core/Src/main.c
@@ -115,7 +115,7 @@ int main(void)
       MX_LoRaWAN_Init();
   }
 
-  MX_TOF_Process();
+  //MX_TOF_Process();
 
   /* USER CODE BEGIN 2 */
 
diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c
index a302a3c..6c895de 100644
--- a/LoRaWAN/App/lora_app.c
+++ b/LoRaWAN/App/lora_app.c
@@ -1514,6 +1514,17 @@ static void OnYunhornSTSWakeUpScanTimerEvent(void *context)
 
 }
 
+void STSWakeupScanTimerStop(void)
+{
+	UTIL_TIMER_Stop(&YunhornSTSWakeUpScanTimer);
+}
+
+
+
+void STSWakeupScanTimerStart(void)
+{
+  UTIL_TIMER_Start(&YunhornSTSWakeUpScanTimer);
+}
 /**
   * @brief  Yunhorn STS Tx Periodicity Change function
   * @param  duration of periodicty in ms (1/1000 sec)
diff --git a/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf b/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf
index 0506f66..fdd85dc 100644
Binary files a/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf and b/STM32CubeIDE/Release/WLE5CC_NODE_STS.elf differ
diff --git a/STS/Core/Inc/yunhorn_sts_sensors.h b/STS/Core/Inc/yunhorn_sts_sensors.h
index 7aeea6d..3d3f5e1 100644
--- a/STS/Core/Inc/yunhorn_sts_sensors.h
+++ b/STS/Core/Inc/yunhorn_sts_sensors.h
@@ -255,6 +255,7 @@ typedef struct sts_fhmos_sensor_config
 typedef struct sts_fhmos_sensor_ambient_height
 {
 	uint32_t	h2cm[64];	//height in 2cm scan data, ensure it less than 250*2=500cm, 5meter
+	uint8_t 	maskoff[64];
 } sts_fhmos_sensor_ambient_height_t;
 
 
@@ -323,7 +324,8 @@ void STS_LMZ_Ambient_Height_Scan_Process(void);
 void STS_FHMOS_sensor_read(sts_fhmos_sensor_data_t *sts_fhmos_data);
 void STS_FHMOS_sensor_config_init(void);
 void STS_FHMOS_sensor_config_update(void);
-
+void STSWakeupScanTimerStop(void);
+void STSWakeupScanTimerStart(void);
 
 /* USER CODE BEGIN Private defines */
 /* 
diff --git a/STS/Core/Src/yunhorn_sts_process.c b/STS/Core/Src/yunhorn_sts_process.c
index e8e3418..7494f0a 100644
--- a/STS/Core/Src/yunhorn_sts_process.c
+++ b/STS/Core/Src/yunhorn_sts_process.c
@@ -1821,11 +1821,16 @@ void STS_SENSOR_Distance_Test_Process(void)
 
 #if	defined(VL53LX)||defined(L8)
 		//MX_TOF_Init();
-		MX_TOF_Process();
+		STSWakeupScanTimerStop();
+		STS_TOF_L8_Process();
+
+		//MX_TOF_Process();
 		sts_sensor_install_height = (uint16_t)MX_TOF_Ranging_Process();
 		APP_LOG(TS_OFF, VLEVEL_M, "\n STS SENSOR INSTALLATION HEIGHT =%d mm\n\r", (uint16_t)sts_sensor_install_height);
 
 		STS_LMZ_Ambient_Height_Scan_Process();
+
+		STSWakeupScanTimerStart();
 #endif
 #if	defined(VL53L0)
 		STS_TOF_VL53L0X_Range_Process();
diff --git a/STS/TOF/App/app_tof.c b/STS/TOF/App/app_tof.c
index 41735f6..67556c6 100644
--- a/STS/TOF/App/app_tof.c
+++ b/STS/TOF/App/app_tof.c
@@ -37,6 +37,7 @@ extern "C" {
 #include "yunhorn_sts_sensors.h"
 volatile uint8_t fhmos_fall=0, fhmos_human_movement=0, fhmos_occupancy=0, fhmos_sos_alarm=0;
 volatile uint32_t fhmos_fall_counter=0;
+volatile sts_fhmos_sensor_data_t sts_fhmos_data;
 volatile sts_fhmos_sensor_config_t sts_fhmos_cfg;
 volatile sts_fhmos_sensor_ambient_height_t sts_fhmos_bg={0x0};
 extern volatile uint16_t sts_sensor_install_height; //in mm
@@ -164,34 +165,32 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
 	uint8_t i=0;
 	uint32_t range_distance =0;
 
-	printf("ambient height init...\r\n");
-
-	for (i=0; i<64; i++) sts_fhmos_bg.h2cm[i] = 0;
-
-	printf("sts sensor install height = %4d \r\n", (int)sts_sensor_install_height);
+	for (i=0; i<64; i++)
+	{
+		sts_fhmos_bg.h2cm[i] = 0;
+		sts_fhmos_bg.maskoff[i] = 0;
+	}
+//	printf("sts sensor install height = %4d \r\n", (int)sts_sensor_install_height);
 
 	for (uint8_t k=0; k<10; k++)
 	{
-		int status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
-
+		STS_TOF_L8_Process();
 		for (uint8_t i = 0; i < 64; i++)
 		{
-		  /* Print distance and status */
-			if (Result.ZoneResult[i].NumberOfTargets > 0)
-			{
-				range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
+			  /* Print distance and status */
+				if ((Result.ZoneResult[i].NumberOfTargets > 0))
+				{
+					range_distance = (uint32_t)Result.ZoneResult[i].Distance[0];
 
-				if (sts_sensor_install_height > range_distance)
-					sts_fhmos_bg.h2cm[i] = sts_fhmos_bg.h2cm[i] + ((uint32_t)sts_sensor_install_height - range_distance);
-				printf("|%4d %4d ", range_distance, sts_fhmos_bg.h2cm[i]);
-								if (i%8==0) printf("\r\n");
-				//sts_fhmos_bg.h2cm[i] += ((uint32_t)sts_sensor_install_height - range_distance;
-				//sts_fhmos_bg.h2cm[i] += ((uint32_t)sts_sensor_install_height - (uint32_t)Result.ZoneResult[i].Distance[0]);
-			}
-			else {
-				sts_fhmos_bg.h2cm[i] += 0;
-				printf(" .%2d. ", i);
-			}
+					if (sts_sensor_install_height > range_distance)
+						sts_fhmos_bg.h2cm[i] +=  ((uint32_t)sts_sensor_install_height - range_distance);
+					printf("|%4d %4d ", range_distance, sts_fhmos_bg.h2cm[i]);
+									if (i%8==0) printf("\r\n");
+				}
+				else {
+					sts_fhmos_bg.h2cm[i] += 0;
+					//printf(" .%d. ", i);
+				}
 
 		}
 
@@ -199,7 +198,13 @@ void STS_LMZ_Ambient_Height_Scan_Process(void)
 	for (i=0; i<64; i++)
 	{
 		sts_fhmos_bg.h2cm[i] /= 10;
-		printf("|%4d ", (uint32_t)sts_fhmos_bg.h2cm[i]);
+		if (fabs(sts_sensor_install_height - sts_fhmos_bg.h2cm[i]) <500) {
+			sts_fhmos_bg.maskoff[i] = 0;
+		} else {
+			sts_fhmos_bg.maskoff[i] = 1;
+		}
+
+		printf("|%d ", (uint32_t)sts_fhmos_bg.maskoff[i]);
 		if (i%8==0) printf("\r\n");
 	}
 
@@ -218,13 +223,17 @@ uint16_t MX_TOF_Ranging_Process(void)
 #elif defined(L8)
 	uint32_t range_distance=0;
 	uint8_t center_roi[4] = {27,28,35,36};
-	uint8_t range_mode = 2; //STS_TOF_LONG_RANGE;
-	//int status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
+	// uint8_t range_mode = 2; //STS_TOF_LONG_RANGE;
+	// int status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
 
-	printf("\r|    27    |    28    |    35    |    36    |\r\n");
+	// printf("\r|    27    |    28    |    35    |    36    |\r\n");
 	for (uint8_t k=0; k<10; k++)
 	{
-		int status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
+		STS_TOF_L8_Process();
+
+		// int status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
+		// printf("\r\n status =%d \r\n", status);
+
 
 		for (uint8_t zone_nbr = 0; zone_nbr < 4; zone_nbr++)
 		{
@@ -240,11 +249,9 @@ uint16_t MX_TOF_Ranging_Process(void)
 			}
 
 			range_distance += Result.ZoneResult[center_roi[zone_nbr]].Distance[RANGING_SENSOR_NB_TARGET_PER_ZONE-1];
-			//printf("|   %6d --    ", range_distance);
-
 		}
-		printf("\n\r");
 	}
+
     printf("\n\r");
 
     range_distance /=40;
@@ -284,8 +291,6 @@ void STS_TOF_L8_Init(void)
 }
 void STS_TOF_L8_Process(void)
 {
-	//printf("\r\n Tof L8 Process\r\n");
-
 	  //while (1)
 	  {
 	    /* interrupt mode */
@@ -294,10 +299,10 @@ void STS_TOF_L8_Process(void)
 	      ToF_EventDetected = 0;
 
 	      status = VL53L8A1_RANGING_SENSOR_GetDistance(VL53L8A1_DEV_CENTER, &Result);
-
+	      //printf("\r\n status =%d \r\n", status);
 	      if (status == BSP_ERROR_NONE)
 	      {
-	        //print_result(&Result);
+	        print_result(&Result);
 	      }
 	    }
 	  }
@@ -365,12 +370,14 @@ static void MX_53L8A1_ThresholdDetection_Process(void)
     printf("VL53L8A1_RANGING_SENSOR_Start failed\n");
     while (1);
   }
-
+#if 0
   printf("\033[2H\033[2J");
   printf("53L8A1 Threshold Detection demo application\n\r");
   printf("-------------------------------------------\n\r");
   printf("please put a target between %d and %d millimeters from the sensor\n\r",
 		  LOW_THRESHOLD, HIGH_THRESHOLD);
+#endif
+
 #if 0
   	  while (1)
   {
@@ -457,9 +464,13 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
         	int32_t roi_distance =(uint32_t)(Result->ZoneResult[j + k].Distance[l]);
         	/* state tree */
         	if ((roi_distance > LOW_THRESHOLD)&&(roi_distance < OCCUPANCY_THRESHOLD))
-        		fhmos_occupancy = 1;
+        		//fhmos_occupancy = 1;
+        		sts_fhmos_data.occupancy_state = 1;
         	if ((roi_distance < HIGH_THRESHOLD)&&(roi_distance > OCCUPANCY_THRESHOLD))
         	{
+        		sts_fhmos_data.fall_state = 1;
+        		sts_fhmos_data.human_movement_state = 1;
+
         		fhmos_fall = 1;
         		fhmos_human_movement = 1;
         		fhmos_fall_counter ++;
@@ -556,13 +567,14 @@ static void print_result(RANGING_SENSOR_Result_t *Result)
  *
  */
 
-void STS_FHMOS_sensor_read(sts_fhmos_sensor_data_t *sts_fhmos_data)
+void STS_FHMOS_sensor_read(sts_fhmos_sensor_data_t *sts_data)
 {
 	//uint8_t fhmos_fall=0, fhmos_human_movement=0, fhmos_occupancy=0, fhmos_sos_alarm=0;
-	sts_fhmos_data->fall_state = fhmos_fall;
-	sts_fhmos_data->human_movement_state =fhmos_human_movement;
-	sts_fhmos_data->occupancy_state =fhmos_occupancy;
-	sts_fhmos_data->sos_alarm_state =fhmos_sos_alarm;
+	sts_data->occupancy_state = sts_fhmos_data.occupancy_state;
+	sts_data->fall_state = sts_fhmos_data.fall_state;
+	sts_data->human_movement_state =sts_fhmos_data.human_movement_state;
+	sts_data->occupancy_state = sts_fhmos_data.occupancy_state;
+	sts_data->sos_alarm_state = sts_fhmos_data.sos_alarm_state;
 }
 
 
@@ -577,7 +589,7 @@ uint8_t IsInterruptDetected(uint16_t dev)
 	// return 1 when an interrupt is raised by the ToF on GPIO1 pin (pin7)
 	if (ToF_EventDetected )
 	{
-		APP_LOG(TS_OFF, VLEVEL_L,"###############   TOF EVENT DETECTED \r\n");
+		APP_LOG(TS_OFF, VLEVEL_M,"###############   TOF EVENT DETECTED \r\n");
 		ToF_EventDetected =0;
 		return 1;
 	} else {