revised MTM-2 Code

This commit is contained in:
Yunhorn 2023-11-10 13:30:59 +08:00
parent 56bceacce4
commit 84d7af6fb1
3 changed files with 11 additions and 9 deletions

View File

@ -263,7 +263,7 @@
#ifdef YUNHORN_STS_R4_ENABLED
#define sts_mtmcode1 0U
#define sts_mtmcode2 7U
#define sts_mtmcode2 86U
#define sts_hardware_ver 1U
#define sts_version 1U
#define sts_senddataport (YUNHORN_STS_R4_LORA_APP_DATA_PORT)

View File

@ -345,7 +345,7 @@ void STS_YunhornSTSEventP5_Process(void)
*/
void STS_YunhornSTSEventP6_Process(void)
{
APP_LOG(TS_OFF, VLEVEL_L, "\r\n P6 Testing Process\r\n");
APP_LOG(TS_OFF, VLEVEL_H, "\r\n P6 Testing Process\r\n");
STS_SENSOR_Power_ON(0);
#ifdef LED_ONBOARD
LED_ON;

View File

@ -835,23 +835,25 @@ static void SendTxData(void)
AppData.Port = LORAWAN_USER_APP_PORT;
AppData.Buffer[i++] = AppLedStateOn;
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode1); //mtmcode1; //#02
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode2); //mtmcode2; //#03
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_hardware_ver); //hardware_Ver; //#04
AppData.Buffer[i++] = (uint8_t)(0xFF & (99*batteryLevel/254)); //#05
if (heart_beat_timer != 0U)
{
heart_beat_timer = 0U;
AppData.Port = LORAWAN_USER_HTBT_PORT; //LORAWAN_USER_APP_PORT+1;
AppData.Buffer[i++] = (uint8_t)(0x01); //length of the following value
AppData.Buffer[i++] = (uint8_t)(r4_data.on_off_event);
AppData.Buffer[i++]= AppLedStateOn|0x80;
AppData.Buffer[i++] = (uint8_t)(0xFF & (99*batteryLevel/254)); //#05
} else if ((upload_message_timer != 0U)||(sensor_data_ready!= 0U)) //sensor_data_ready for manual push button-1 trigger)
{
sensor_data_ready =0;
upload_message_timer =0;
AppData.Buffer[i++] = AppLedStateOn;
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode1); //mtmcode1; //#02
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode2); //mtmcode2; //#03
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_hardware_ver); //hardware_Ver; //#04
AppData.Buffer[i++] = (uint8_t)(0xFF & (99*batteryLevel/254)); //#05
#if defined(STS_O5)
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff;