change o6_data to o7_data

This commit is contained in:
Yunhorn 2024-04-13 22:32:44 +08:00
parent 145dbd861b
commit 166e88cc1a
2 changed files with 68 additions and 68 deletions

View File

@ -210,7 +210,7 @@
#ifdef YUNHORN_STS_O7_ENABLED
#define MajorVer 24U
#define MinorVer 04U
#define SubMinorVer 8U
#define SubMinorVer 13U
#define FirmwareVersion 3U
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U

View File

@ -740,10 +740,10 @@ static uint8_t PrepareSendTxData(void)
uint16_t batteryLevelmV = SYS_GetBatteryLevel();
SysTime_t occupy_check_time = SysTimeGetMcuTime();
//sensor_t sensor_data;
STS_OO_SensorStatusDataTypeDef o6_data;
STS_OO_SensorStatusDataTypeDef o7_data;
STS_PRESENCE_SENSOR_Read(&o6_data);
o6_data.battery_Pct = (uint8_t)(99*batteryLevel/254);
STS_PRESENCE_SENSOR_Read(&o7_data);
o7_data.battery_Pct = (uint8_t)(99*batteryLevel/254);
// For occupancy over time process
@ -773,8 +773,8 @@ static uint8_t PrepareSendTxData(void)
AppData.Buffer[i++] = sts_mtmcode1;
AppData.Buffer[i++] = sts_mtmcode2;
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //01 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //01 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######| Mode S1 BAT % BAT mV |"
@ -784,13 +784,13 @@ static uint8_t PrepareSendTxData(void)
break;
case STS_NETWORK_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor4_on_off); //06 Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); //06 Sensor head #4 status
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color Mode S1 S2 S3 S4 |"
"\r\n######| %1d %1d %1d %1d %1d %1d |\r\n",
@ -798,11 +798,11 @@ static uint8_t PrepareSendTxData(void)
break;
case STS_REEDSWITCH_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
APP_LOG(TS_OFF, VLEVEL_L,
@ -812,45 +812,45 @@ static uint8_t PrepareSendTxData(void)
break;
case STS_RSS_MODE:
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor2_on_off); //03 Sensor head #2 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor3_on_off); // Sensor head #3 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor4_on_off); // Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance>>8); //04 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance); //05 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score >>8); //06 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score); //07 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor2_on_off); //03 Sensor head #2 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); // Sensor head #3 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); // Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance>>8); //04 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance); //05 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score >>8); //06 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score); //07 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //08 occupancy over time or not
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color Mode S2 |Distance(mm) MotionScore|"
"\r\n######| %1d %1d %1d |%04d %04d |\r\n",
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2], (uint16_t)o6_data.rss_presence_distance,(uint16_t)o6_data.rss_presence_score);
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2], (uint16_t)o7_data.rss_presence_distance,(uint16_t)o7_data.rss_presence_score);
break;
default:
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor4_on_off); //06 Sensor head #4 status
if (o6_data.state_sensor2_on_off !=0)
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); //06 Sensor head #4 status
if (o7_data.state_sensor2_on_off !=0)
{
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance>>8); //07 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance); //08 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score >>8); //09 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score); //10 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance>>8); //07 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance); //08 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score >>8); //09 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score); //10 LSB score
}
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //11 occupancy over time or not
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color Mode S1 S2 S3 S4 |Distance(mm) MotionScore|"
"\r\n######| %1d %1d %1d %1d %1d %1d |%04d %04d |\r\n",
AppData.Buffer[0], AppData.Buffer[1],AppData.Buffer[2], AppData.Buffer[3],AppData.Buffer[4], AppData.Buffer[5], (uint16_t)o6_data.rss_presence_distance,(uint16_t)o6_data.rss_presence_score);
AppData.Buffer[0], AppData.Buffer[1],AppData.Buffer[2], AppData.Buffer[3],AppData.Buffer[4], AppData.Buffer[5], (uint16_t)o7_data.rss_presence_distance,(uint16_t)o7_data.rss_presence_score);
break;
}
@ -924,7 +924,7 @@ static void OnTxTimerEvent(void *context)
/* USER CODE BEGIN OnTxTimerEvent_1 */
/* USER CODE END OnTxTimerEvent_1 */
heart_beat_timer = 1;
//heart_beat_timer = 1;
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
@ -2305,8 +2305,8 @@ void STS_SENSOR_Function_Test_Process(void)
{
AppData.Buffer[i++] = sts_mtmcode1;
AppData.Buffer[i++] = sts_mtmcode2;
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //01 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //01 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
APP_LOG(TS_OFF, VLEVEL_L,"\r\n######| Mode S1 BAT % BAT mV |"
@ -2315,23 +2315,23 @@ void STS_SENSOR_Function_Test_Process(void)
} else
{
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.workmode); //02 WORK MODE
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.lamp_bar_color); //01
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.workmode); //02 WORK MODE
if (sts_work_mode == STS_NETWORK_MODE)
{
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor4_on_off); //06 Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); //06 Sensor head #4 status
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color Mode S1 S2 S3 S4 |"
"\r\n######| %1d %1d %1d %1d %1d %1d |\r\n",
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2],AppData.Buffer[3], AppData.Buffer[4],AppData.Buffer[5]);
} else if (sts_work_mode == STS_REEDSWITCH_MODE)
{
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.battery_Pct); //02 Battery Level %
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV >>8); //03 Battery mV MSB
AppData.Buffer[i++] = (uint8_t)(0xFF & batteryLevelmV ); //04 Battery mV LSB
APP_LOG(TS_OFF, VLEVEL_L,
@ -2340,38 +2340,38 @@ void STS_SENSOR_Function_Test_Process(void)
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV);
} else if (sts_work_mode == STS_RSS_MODE) {
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor2_on_off); //03 Sensor head #2 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor3_on_off); // Sensor head #3 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor4_on_off); // Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance>>8); //04 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance); //05 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score >>8); //06 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score); //07 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor2_on_off); //03 Sensor head #2 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); // Sensor head #3 status
//AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); // Sensor head #4 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance>>8); //04 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance); //05 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score >>8); //06 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score); //07 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //11 occupancy over time or not
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color Mode S2 |Distance(mm) MotionScore|"
"\r\n######| %1d %1d %1d |%04d %04d |\r\n",
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2], (uint16_t)o6_data.rss_presence_distance,(uint16_t)o6_data.rss_presence_score);
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2], (uint16_t)o7_data.rss_presence_distance,(uint16_t)o7_data.rss_presence_score);
} else {
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.state_sensor4_on_off); //06 Sensor head #4 status
if (o6_data.state_sensor2_on_off !=0)
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor1_on_off); //03 Sensor head #1 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor2_on_off); //04 Sensor head #2 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor3_on_off); //05 Sensor head #3 status
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.state_sensor4_on_off); //06 Sensor head #4 status
if (o7_data.state_sensor2_on_off !=0)
{
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance>>8); //07 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_distance); //08 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score >>8); //09 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.rss_presence_score); //10 LSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance>>8); //07 MSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_distance); //08 LSB distance
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score >>8); //09 MSB score
AppData.Buffer[i++] = (uint8_t)(0xFF & o7_data.rss_presence_score); //10 LSB score
}
// overtime dismissed while state not back to zero
if ((o6_data.state_sensor1_on_off == 0)&& (o6_data.state_sensor2_on_off == 0))
if ((o7_data.state_sensor1_on_off == 0)&& (o7_data.state_sensor2_on_off == 0))
sts_occupancy_overtime_state = 0;
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_occupancy_overtime_state); //11 occupancy over time or not
APP_LOG(TS_OFF, VLEVEL_L,
"\r\n######| Color Mode S1 S2 S3 S4 |Distance(mm) MotionScore|"
"\r\n######| %1d %1d %1d %1d %1d %1d |%04d %04d |\r\n",
AppData.Buffer[0], AppData.Buffer[1],AppData.Buffer[2], AppData.Buffer[3],AppData.Buffer[4], AppData.Buffer[5], (uint16_t)o6_data.rss_presence_distance,(uint16_t)o6_data.rss_presence_score);
AppData.Buffer[0], AppData.Buffer[1],AppData.Buffer[2], AppData.Buffer[3],AppData.Buffer[4], AppData.Buffer[5], (uint16_t)o7_data.rss_presence_distance,(uint16_t)o7_data.rss_presence_score);
}
}