reformat prepare send tx data from if else to switch case
This commit is contained in:
parent
ae918aa783
commit
cf057722a9
|
@ -732,9 +732,9 @@ static uint8_t PrepareSendTxData(void)
|
||||||
// For occupancy over time process
|
// For occupancy over time process
|
||||||
|
|
||||||
|
|
||||||
|
switch (sts_work_mode) {
|
||||||
|
case STS_WIRED_MODE:
|
||||||
|
|
||||||
if (sts_work_mode == STS_WIRED_MODE)
|
|
||||||
{
|
|
||||||
AppData.Buffer[i++] = sts_mtmcode1;
|
AppData.Buffer[i++] = sts_mtmcode1;
|
||||||
AppData.Buffer[i++] = sts_mtmcode2;
|
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.state_sensor1_on_off); //01 Sensor head #1 status
|
||||||
|
@ -745,13 +745,12 @@ static uint8_t PrepareSendTxData(void)
|
||||||
"\r\n######| %1d %1d %2d% %4d mV|\r\n",
|
"\r\n######| %1d %1d %2d% %4d mV|\r\n",
|
||||||
sts_work_mode, AppData.Buffer[2], AppData.Buffer[3], batteryLevelmV);
|
sts_work_mode, AppData.Buffer[2], AppData.Buffer[3], batteryLevelmV);
|
||||||
|
|
||||||
} else
|
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.lamp_bar_color); //01
|
||||||
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_data.workmode); //02 WORK MODE
|
AppData.Buffer[i++] = (uint8_t)(0xFF & o6_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_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_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_sensor3_on_off); //05 Sensor head #3 status
|
||||||
|
@ -760,8 +759,12 @@ static uint8_t PrepareSendTxData(void)
|
||||||
"\r\n######| Color Mode S1 S2 S3 S4 |"
|
"\r\n######| Color Mode S1 S2 S3 S4 |"
|
||||||
"\r\n######| %1d %1d %1d %1d %1d %1d |\r\n",
|
"\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]);
|
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)
|
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 & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
|
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 & o6_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 >>8); //03 Battery mV MSB
|
||||||
|
@ -770,9 +773,12 @@ static uint8_t PrepareSendTxData(void)
|
||||||
"\r\n######| Color Mode S1 VBAT in mV|"
|
"\r\n######| Color Mode S1 VBAT in mV|"
|
||||||
"\r\n######| %1d %1d %1d %2d% %4d mV|\r\n",
|
"\r\n######| %1d %1d %1d %2d% %4d mV|\r\n",
|
||||||
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV);
|
AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV);
|
||||||
|
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
|
||||||
|
|
||||||
} 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_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_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.state_sensor4_on_off); // Sensor head #4 status
|
||||||
|
@ -785,7 +791,14 @@ static uint8_t PrepareSendTxData(void)
|
||||||
"\r\n######| Color Mode S2 |Distance(mm) MotionScore|"
|
"\r\n######| Color Mode S2 |Distance(mm) MotionScore|"
|
||||||
"\r\n######| %1d %1d %1d |%04d %04d |\r\n",
|
"\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)o6_data.rss_presence_distance,(uint16_t)o6_data.rss_presence_score);
|
||||||
} else {
|
|
||||||
|
|
||||||
|
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 & o6_data.state_sensor1_on_off); //03 Sensor head #1 status
|
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_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_sensor3_on_off); //05 Sensor head #3 status
|
||||||
|
@ -802,8 +815,7 @@ static uint8_t PrepareSendTxData(void)
|
||||||
"\r\n######| Color Mode S1 S2 S3 S4 |Distance(mm) MotionScore|"
|
"\r\n######| Color Mode S1 S2 S3 S4 |Distance(mm) MotionScore|"
|
||||||
"\r\n######| %1d %1d %1d %1d %1d %1d |%04d %04d |\r\n",
|
"\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)o6_data.rss_presence_distance,(uint16_t)o6_data.rss_presence_score);
|
||||||
}
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
|
Reference in New Issue