diff --git a/LoRaWAN/App/lora_app.c b/LoRaWAN/App/lora_app.c index f7c849f..06e5c4d 100644 --- a/LoRaWAN/App/lora_app.c +++ b/LoRaWAN/App/lora_app.c @@ -132,6 +132,23 @@ char sts_lamp_color_code[10][10]={ "Red_Blue", }; +char sts_work_mode_code[15][25] ={ + "NETWORK_MODE", + "WIRED_MODE", + "REEDSWITCH_MODE", + "RSS_MODE", + "DUAL_MODE", + "REMOTE_REED_RSS_MODE", + "DUAL_RSS_MODE", + "TOF_RSS_MODE", + "TOF_DISTANCE_MODE", + "TOF_PRESENCE_MODE", + "TOF_IN_OUT_MODE", + "FALL_DETECTION_MODE", + "OTHER_MODE1", + "OTHER_MODE2", + "OTHER_MODE3", +}; #endif /* USER CODE END EV */ @@ -789,8 +806,8 @@ static uint8_t PrepareSendTxData(void) 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 |" - "\r\n######| %1d %1d %2d% %4d mV|\r\n", - sts_work_mode, AppData.Buffer[2], AppData.Buffer[3], batteryLevelmV); + "\r\n######| %1d | %1d | %2d% | %4d mV|\r\n", + (char*)sts_work_mode_code[(uint8_t)sts_work_mode], AppData.Buffer[2], AppData.Buffer[3], batteryLevelmV); break; @@ -803,9 +820,9 @@ static uint8_t PrepareSendTxData(void) 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]); + "\r\n######| Color | Mode | S1 | S2 | S3 | S4 |" + "\r\n######|%10s | %15s | %1d | %1d | %1d | %1d |\r\n", + (char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2],AppData.Buffer[3], AppData.Buffer[4],AppData.Buffer[5]); break; case STS_REEDSWITCH_MODE: @@ -817,9 +834,9 @@ static uint8_t PrepareSendTxData(void) 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######| Color Mode S1 VBAT in mV|" - "\r\n######| %1d %1d %1d %2d% %4d mV|\r\n", - AppData.Buffer[0], AppData.Buffer[1], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV); + "\r\n######| Color | Mode | S1 | VBAT in mV|" + "\r\n######|%10s | %15s | %1d | %2d% | %4d mV|\r\n", + (char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2],AppData.Buffer[3], batteryLevelmV); break; case STS_RSS_MODE: @@ -835,9 +852,9 @@ static uint8_t PrepareSendTxData(void) 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######| %s %1d %1d |%04d %04d |\r\n", - (char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], AppData.Buffer[1], AppData.Buffer[2], (uint16_t)o7_data.rss_presence_distance,(uint16_t)o7_data.rss_presence_score); + "\r\n######| Color | Mode | S2 | |Distance(mm) | MotionScore|" + "\r\n######|%10s | %15s | %1d | %04d | %04d |\r\n", + (char*)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[(uint8_t)AppData.Buffer[1]], AppData.Buffer[2], (uint16_t)o7_data.rss_presence_distance,(uint16_t)o7_data.rss_presence_score); break; @@ -859,9 +876,9 @@ static uint8_t PrepareSendTxData(void) } 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######| %s %1d %1d %1d %1d %1d |%04d %04d |\r\n", - (char *)sts_lamp_color_code[(uint8_t)(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); + "\r\n######| Color | Mode | S1 | S2 | S3 | S4 |Distance(mm) | MotionScore|" + "\r\n######|%10s | %15s | %1d | %1d | %1d | %1d | %04d | %04d |\r\n", + (char *)sts_lamp_color_code[(uint8_t)(AppData.Buffer[0])], (char*)sts_work_mode_code[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; }