try V13 for join speed, not good so far
This commit is contained in:
parent
f0d7f6ac3a
commit
583ae17ada
|
@ -47,12 +47,12 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
* @brief Verbose level for all trace logs
|
* @brief Verbose level for all trace logs
|
||||||
*/
|
*/
|
||||||
#define VERBOSE_LEVEL VLEVEL_H
|
#define VERBOSE_LEVEL VLEVEL_M
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable trace logs
|
* @brief Enable trace logs
|
||||||
*/
|
*/
|
||||||
#define APP_LOG_ENABLED 0
|
#define APP_LOG_ENABLED 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose
|
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose
|
||||||
|
|
|
@ -211,9 +211,10 @@
|
||||||
#endif /* YUNHORN_STS_R0_ENABLED */
|
#endif /* YUNHORN_STS_R0_ENABLED */
|
||||||
|
|
||||||
#ifdef YUNHORN_STS_M7_ENABLED
|
#ifdef YUNHORN_STS_M7_ENABLED
|
||||||
|
#include "yunhorn_sts_motion_sensor.h"
|
||||||
#define MajorVer 23U
|
#define MajorVer 23U
|
||||||
#define MinorVer 02U
|
#define MinorVer 10U
|
||||||
#define SubMinorVer 23U
|
#define SubMinorVer 14U
|
||||||
#define FirmwareVersion 3U
|
#define FirmwareVersion 3U
|
||||||
#define STS_NVM_CFG_SIZE 32U
|
#define STS_NVM_CFG_SIZE 32U
|
||||||
#define STS_CFG_PCFG_SIZE 28U
|
#define STS_CFG_PCFG_SIZE 28U
|
||||||
|
@ -225,7 +226,7 @@
|
||||||
#define YUNHORN_STS_M7_CFG_CMD_SIZE 9U
|
#define YUNHORN_STS_M7_CFG_CMD_SIZE 9U
|
||||||
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
|
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
|
||||||
#define YUNHORN_STS_AC_CODE_SIZE 20U
|
#define YUNHORN_STS_AC_CODE_SIZE 20U
|
||||||
#include "yunhorn_sts_motion_sensor.h"
|
|
||||||
#define YUNHORN_STS_M7_LORA_APP_DATA_PORT 20U
|
#define YUNHORN_STS_M7_LORA_APP_DATA_PORT 20U
|
||||||
#define YUNHORN_STS_M7_LORA_APP_HTBT_PORT 21U
|
#define YUNHORN_STS_M7_LORA_APP_HTBT_PORT 21U
|
||||||
#define YUNHORN_STS_M7_USER_APP_CTRL_PORT 2U
|
#define YUNHORN_STS_M7_USER_APP_CTRL_PORT 2U
|
||||||
|
|
|
@ -411,7 +411,7 @@ void LoRaWAN_Init(void)
|
||||||
/* USER CODE END LoRaWAN_Init_LV */
|
/* USER CODE END LoRaWAN_Init_LV */
|
||||||
|
|
||||||
/* USER CODE BEGIN LoRaWAN_Init_1 */
|
/* USER CODE BEGIN LoRaWAN_Init_1 */
|
||||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n\n\n##### YUNHORN_STS_FW:%d SWV%d HWV:%d MTM:%d.%d R:%d.%d.%d####\r\n\n\n",
|
APP_LOG(TS_OFF, VLEVEL_M, "\r\n\n\n##### YUNHORN_STS_FW:%d SWV%d HWV:%d MTM:%d.%d R:%d.%d.%d####\r\n\n\n",
|
||||||
FirmwareVersion, sts_version, sts_hardware_ver, sts_mtmcode1,sts_mtmcode2, MajorVer, MinorVer, SubMinorVer);
|
FirmwareVersion, sts_version, sts_hardware_ver, sts_mtmcode1,sts_mtmcode2, MajorVer, MinorVer, SubMinorVer);
|
||||||
/* Get LoRaWAN APP version*/
|
/* Get LoRaWAN APP version*/
|
||||||
APP_LOG(TS_OFF, VLEVEL_M, "APPLICATION_VERSION: V%X.%X.%X\r\n",
|
APP_LOG(TS_OFF, VLEVEL_M, "APPLICATION_VERSION: V%X.%X.%X\r\n",
|
||||||
|
@ -490,15 +490,16 @@ void LoRaWAN_Init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* USER CODE BEGIN LoRaWAN_Init_Last */
|
/* USER CODE BEGIN LoRaWAN_Init_Last */
|
||||||
STS_REBOOT_CONFIG_Init();
|
|
||||||
UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL);
|
|
||||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
|
|
||||||
|
|
||||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_MOTION_SENSOR_WakeUp_Process);
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), UTIL_SEQ_RFU, STS_MOTION_SENSOR_WakeUp_Process);
|
||||||
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_SENSOR_Function_Test_Process);
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventP2), UTIL_SEQ_RFU, STS_SENSOR_Function_Test_Process);
|
||||||
|
UTIL_SEQ_RegTask((1 << CFG_SEQ_Task_YunhornSTSEventRFAC), UTIL_SEQ_RFU, STS_YunhornSTSEventRFAC_Process);
|
||||||
|
|
||||||
|
STS_REBOOT_CONFIG_Init();
|
||||||
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
|
|
||||||
|
//UTIL_TIMER_Create(&YunhornSTSHeartBeatTimer, HeartBeatPeriodicity, UTIL_TIMER_ONESHOT, OnYunhornSTSHeartBeatTimerEvent, NULL);
|
||||||
|
//UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
|
||||||
|
|
||||||
|
|
||||||
/* USER CODE END LoRaWAN_Init_Last */
|
/* USER CODE END LoRaWAN_Init_Last */
|
||||||
|
@ -1089,8 +1090,6 @@ static void SendTxData(void)
|
||||||
STS_M7_SensorDataTypeDef m7_data;
|
STS_M7_SensorDataTypeDef m7_data;
|
||||||
UTIL_TIMER_Time_t nextTxIn = 0;
|
UTIL_TIMER_Time_t nextTxIn = 0;
|
||||||
|
|
||||||
//if (LmHandlerIsBusy() == false)
|
|
||||||
{
|
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
//EnvSensors_Read(&sensor_data);
|
//EnvSensors_Read(&sensor_data);
|
||||||
|
@ -1103,9 +1102,10 @@ static void SendTxData(void)
|
||||||
if (heart_beat_timer != 0U)
|
if (heart_beat_timer != 0U)
|
||||||
{
|
{
|
||||||
heart_beat_timer = 0U;
|
heart_beat_timer = 0U;
|
||||||
AppData.Port = sts_sendhtbtport; //LORAWAN_USER_APP_PORT;
|
AppData.Port = LORAWAN_USER_HTBT_PORT; //LORAWAN_USER_APP_PORT;
|
||||||
AppData.Buffer[i++] = (uint8_t)(99*batteryLevel/254); //#01
|
AppData.Buffer[i++] = (uint8_t)(99*batteryLevel/254); //#01
|
||||||
} else
|
}
|
||||||
|
if (sensor_data_ready !=0U)
|
||||||
{
|
{
|
||||||
sensor_data_ready = 0U;
|
sensor_data_ready = 0U;
|
||||||
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode1); //mtmcode1; //#01
|
AppData.Buffer[i++] = (uint8_t)(0xFF & sts_mtmcode1); //mtmcode1; //#01
|
||||||
|
@ -1148,8 +1148,8 @@ static void SendTxData(void)
|
||||||
UTIL_TIMER_Stop(&JoinLedTimer);
|
UTIL_TIMER_Stop(&JoinLedTimer);
|
||||||
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); /* LED_RED */
|
HAL_GPIO_WritePin(LED3_GPIO_Port, LED3_Pin, GPIO_PIN_RESET); /* LED_RED */
|
||||||
}
|
}
|
||||||
//if (i>1)
|
if (i>1)
|
||||||
//{
|
{
|
||||||
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
|
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
|
||||||
if (LORAMAC_HANDLER_SUCCESS == status)
|
if (LORAMAC_HANDLER_SUCCESS == status)
|
||||||
{
|
{
|
||||||
|
@ -1163,9 +1163,7 @@ static void SendTxData(void)
|
||||||
APP_LOG(TS_ON, VLEVEL_H, "Next Tx in : ~%d second(s)\r\n", (nextTxIn / 1000));
|
APP_LOG(TS_ON, VLEVEL_H, "Next Tx in : ~%d second(s)\r\n", (nextTxIn / 1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
} // if (LmHandlerIsBusy() == false)
|
|
||||||
|
|
||||||
if (EventType == TX_ON_TIMER)
|
if (EventType == TX_ON_TIMER)
|
||||||
{
|
{
|
||||||
|
@ -1630,17 +1628,22 @@ void STS_REBOOT_CONFIG_Init(void)
|
||||||
|
|
||||||
void OnRestoreSTSCFGContextProcess(void)
|
void OnRestoreSTSCFGContextProcess(void)
|
||||||
{
|
{
|
||||||
uint32_t periodicity = (sts_cfg_nvm.periodicity); //TxPeriodicty interval
|
uint32_t periodicity_length = (sts_cfg_nvm.periodicity); //TxPeriodicty interval
|
||||||
if ((char)sts_cfg_nvm.unit =='M') {
|
if ((char)sts_cfg_nvm.unit =='M') {
|
||||||
periodicity *= 60;
|
periodicity_length *= 60;
|
||||||
} else if ((char) sts_cfg_nvm.unit =='H') {
|
} else if ((char) sts_cfg_nvm.unit =='H') {
|
||||||
periodicity *= 3600;
|
periodicity_length *= 3600;
|
||||||
} else if ((char) sts_cfg_nvm.unit =='S') {
|
} else if ((char) sts_cfg_nvm.unit =='S') {
|
||||||
periodicity *= 1;
|
periodicity_length *= 1;
|
||||||
}
|
}
|
||||||
periodicity = (periodicity > 10)? periodicity : 10; // in seconds unit
|
periodicity_length = (periodicity_length > 10)? periodicity_length : 10; // in seconds unit
|
||||||
TxPeriodicity= periodicity*1000; // to ms
|
|
||||||
OnTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
if (sts_lorawan_joined)
|
||||||
|
{
|
||||||
|
OnTxPeriodicityChanged(periodicity_length*1000); // in msec unit
|
||||||
|
} else {
|
||||||
|
OnTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t samplingperiodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval
|
uint32_t samplingperiodicity = (sts_cfg_nvm.sampling); //Heart-beat or Sampling interval
|
||||||
if ((char)sts_cfg_nvm.s_unit =='M') {
|
if ((char)sts_cfg_nvm.s_unit =='M') {
|
||||||
|
|
|
@ -55,9 +55,10 @@ extern "C" {
|
||||||
* LoRaWAN User application port
|
* LoRaWAN User application port
|
||||||
* @note do not use 224. It is reserved for certification
|
* @note do not use 224. It is reserved for certification
|
||||||
*/
|
*/
|
||||||
#define LORAWAN_USER_APP_PORT sts_senddataport
|
#define LORAWAN_USER_APP_PORT 20
|
||||||
#define LORAWAN_USER_APP_CTRL_PORT sts_appctrlport
|
#define LORAWAN_USER_HTBT_PORT 21
|
||||||
#define LORAWAN_USER_APP_CTRL_REPLY_PORT sts_appctrl_reply_port
|
#define LORAWAN_USER_APP_CTRL_PORT 2
|
||||||
|
#define LORAWAN_USER_APP_CTRL_REPLY_PORT 1
|
||||||
/*!
|
/*!
|
||||||
* LoRaWAN Switch class application port
|
* LoRaWAN Switch class application port
|
||||||
* @note do not use 224. It is reserved for certification
|
* @note do not use 224. It is reserved for certification
|
||||||
|
|
Loading…
Reference in New Issue