disable log for production
This commit is contained in:
parent
454af4fa92
commit
d62c55304d
|
@ -52,7 +52,7 @@ extern "C" {
|
|||
/**
|
||||
* @brief Enable trace logs
|
||||
*/
|
||||
#define APP_LOG_ENABLED 1
|
||||
#define APP_LOG_ENABLED 0
|
||||
|
||||
/**
|
||||
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose
|
||||
|
|
|
@ -272,22 +272,21 @@ void STS_YunhornSTSEventP3_Process(void)
|
|||
void STS_YunhornSTSEventP4_Process(void)
|
||||
{
|
||||
STS_SENSOR_Power_ON(0);
|
||||
#ifdef LED_ONBOARD
|
||||
LED_ON;
|
||||
HAL_Delay(20);
|
||||
HAL_Delay(10);
|
||||
LED_OFF;
|
||||
|
||||
#endif
|
||||
#if defined(TOF_1)||defined(TOF_2)
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n TOF_1, TOF_2 Testing Process\r\n");
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n TOF_1, TOF_2 RANGING Process\r\n");
|
||||
STS_TOF_VL53L0X_Range_Process();
|
||||
#endif
|
||||
|
||||
#ifdef TOF_3
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n TOF 3 Testing Process ---- TOF250 Ranging \r\n");
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\n TOF 3 RANGING Process ---- TOF250 Ranging \r\n");
|
||||
STS_TOF250_Range_Process();
|
||||
#endif
|
||||
|
||||
|
||||
LED_OFF;
|
||||
STS_SENSOR_Power_OFF(0);
|
||||
|
||||
}
|
||||
|
@ -314,13 +313,11 @@ void STS_YunhornSTSEventP6_Process(void)
|
|||
{
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n P6 Testing Process\r\n");
|
||||
STS_SENSOR_Power_ON(0);
|
||||
#ifdef LED_ONBOARD
|
||||
LED_ON;
|
||||
HAL_Delay(50);
|
||||
LED_OFF;
|
||||
HAL_Delay(20);
|
||||
LED_ON;
|
||||
HAL_Delay(50);
|
||||
LED_OFF;
|
||||
#endif
|
||||
/* 1. Sensor Power On */
|
||||
#if defined(SOAP_LEVEL_SENSOR)
|
||||
HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_SET);
|
||||
|
@ -330,16 +327,21 @@ void STS_YunhornSTSEventP6_Process(void)
|
|||
sts_soap_level_state = 0;
|
||||
sts_soap_level_state = HAL_GPIO_ReadPin(SOAP_STATUS_GPIO_Port,SOAP_STATUS_Pin);
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\n Soap State = %d \r\n", sts_soap_level_state);
|
||||
if (sts_soap_level_state == 1) LED_ON;
|
||||
|
||||
HAL_GPIO_WritePin(SOAP_SWITCH_GPIO_Port, SOAP_SWITCH_Pin, GPIO_PIN_RESET);
|
||||
|
||||
if (sts_soap_level_state == 1)
|
||||
{
|
||||
#ifdef LED_ONBOARD
|
||||
LED_ON;
|
||||
HAL_Delay(20);
|
||||
LED_OFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
/* 3. Sensor Power Off */
|
||||
STS_SENSOR_Power_OFF(0);
|
||||
|
||||
LED_ON;
|
||||
HAL_Delay(500);
|
||||
LED_OFF;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -486,7 +486,7 @@ void LoRaWAN_Init(void)
|
|||
/* USER CODE END LoRaWAN_Init_LV */
|
||||
|
||||
/* 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_L, "\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);
|
||||
|
||||
/* Get LoRaWAN APP version*/
|
||||
|
@ -875,7 +875,7 @@ static void SendTxData(void)
|
|||
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
|
||||
if (LORAMAC_HANDLER_SUCCESS == status)
|
||||
{
|
||||
APP_LOG(TS_ON, VLEVEL_M, "SEND REQUEST\r\n");
|
||||
APP_LOG(TS_ON, VLEVEL_H, "SEND REQUEST\r\n");
|
||||
}
|
||||
else if (LORAMAC_HANDLER_DUTYCYCLE_RESTRICTED == status)
|
||||
{
|
||||
|
@ -991,18 +991,16 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
|
|||
|
||||
STS_LoRa_WAN_Joined = (uint8_t) joinParams->Mode;
|
||||
//STS_REBOOT_CONFIG_Init();
|
||||
//OnTxPeriodicityChanged(HeartBeatPeriodicity);
|
||||
OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity);
|
||||
OnTxPeriodicityChanged(TxPeriodicity);
|
||||
APP_LOG(TS_OFF, VLEVEL_L,"\r\n STS_LoRa_WAN_Joined = %d \r\n", STS_LoRa_WAN_Joined);
|
||||
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_L,"\r\n STS_LoRa_WAN_Joined = %s \r\n", (STS_LoRa_WAN_Joined == 1)?"ABP":"OTAA");
|
||||
}
|
||||
else
|
||||
{
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n###### = JOIN FAILED\r\n");
|
||||
}
|
||||
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower);
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "###### U/L FRAME:JOIN | DR:%d | PWR:%d\r\n", joinParams->Datarate, joinParams->TxPower);
|
||||
}
|
||||
/* USER CODE END OnJoinRequest_1 */
|
||||
}
|
||||
|
@ -1086,7 +1084,7 @@ static void OnTxPeriodicityChanged(uint32_t periodicity)
|
|||
UTIL_TIMER_SetPeriod(&TxTimer, TxPeriodicity);
|
||||
UTIL_TIMER_Start(&TxTimer);
|
||||
/* USER CODE BEGIN OnTxPeriodicityChanged_2 */
|
||||
APP_LOG(TS_OFF, VLEVEL_L,"\r\n TxPeriodicity changed to %u (msec) \r\n", TxPeriodicity);
|
||||
APP_LOG(TS_OFF, VLEVEL_H,"\r\n TxPeriodicity changed to %u (msec) \r\n", TxPeriodicity);
|
||||
/* USER CODE END OnTxPeriodicityChanged_2 */
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1290,7 @@ static void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t periodicity)
|
|||
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
|
||||
|
||||
/* USER CODE BEGIN OnTxPeriodicityChanged_2 */
|
||||
APP_LOG(TS_OFF, VLEVEL_L,"**************** HeartBeatPeriodicity Changed to: %u (ms)\r\n", HeartBeatPeriodicity );
|
||||
APP_LOG(TS_OFF, VLEVEL_H,"**************** HeartBeatPeriodicity Changed to: %u (ms)\r\n", HeartBeatPeriodicity );
|
||||
/* USER CODE END OnTxPeriodicityChanged_2 */
|
||||
}
|
||||
|
||||
|
@ -1727,7 +1725,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
sts_cfg_nvm.sts_service_mask = (uint8_t)sts_service_mask;
|
||||
|
||||
OnStoreSTSCFGContextRequest();
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "###### YUNHORN Periodicity Changed to [ %d ] Seconds\r\n", periodicity_length);
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "###### YUNHORN Periodicity Changed to [ %d ] Seconds\r\n", periodicity_length);
|
||||
|
||||
} else {
|
||||
STS_SENSOR_Upload_Config_Invalid_Message();
|
||||
|
@ -1773,7 +1771,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
sts_cfg_nvm.sts_service_mask = (uint8_t)sts_service_mask;
|
||||
|
||||
OnStoreSTSCFGContextRequest();
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "###### YUNHORN Sampling Or Heart-Beat Interval Changed to [ %d ] Seconds\r\n", heart_beat_or_sampling_periodicity_length);
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "###### YUNHORN Sampling Or Heart-Beat Interval Changed to [ %d ] Seconds\r\n", heart_beat_or_sampling_periodicity_length);
|
||||
|
||||
} else {
|
||||
STS_SENSOR_Upload_Config_Invalid_Message();
|
||||
|
@ -1813,7 +1811,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
for (j =0; j < CFG_CMD_TOF_SIMPLE_SIZE; j++)
|
||||
{
|
||||
sts_cfg_nvm.p[j] = (uint8_t)((tlv_buf[CFG_CMD4+j] - 0x30)&0xff);
|
||||
APP_LOG(TS_OFF,VLEVEL_L,"\r\n tlv_buf %d = %02x cfg->p[%d]=%02x \r\n",
|
||||
APP_LOG(TS_OFF,VLEVEL_H,"\r\n tlv_buf %d = %02x cfg->p[%d]=%02x \r\n",
|
||||
j,tlv_buf[CFG_CMD4+j], j, sts_cfg_nvm.p[j]);
|
||||
}
|
||||
|
||||
|
@ -1832,7 +1830,7 @@ void USER_APP_AUTO_RESPONDER_Parse(char *tlv_buf, size_t tlv_buf_size)
|
|||
{
|
||||
outbuf[i++] = (uint8_t)(sts_cfg_nvm.p[j]+0x30)&0xff;
|
||||
}
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "###### RSS Simple CFG=%s\r\n",*outbuf);
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "###### RSS Simple CFG=%s\r\n",*outbuf);
|
||||
|
||||
// Step 2: Save valid config to NVM
|
||||
sts_cfg_nvm.mtmcode1 = sts_mtmcode1;
|
||||
|
@ -1954,14 +1952,14 @@ void STS_SENSOR_Upload_Message(uint8_t appDataPort, uint8_t appBufferSize, char
|
|||
status = LmHandlerSend(&AppData, LmHandlerParams.IsTxConfirmed, false);
|
||||
if (LORAMAC_HANDLER_SUCCESS == status)
|
||||
{
|
||||
APP_LOG(TS_ON, VLEVEL_L, "SEND REQUEST\r\n");
|
||||
APP_LOG(TS_ON, VLEVEL_H, "SEND REQUEST\r\n");
|
||||
}
|
||||
else if (LORAMAC_HANDLER_DUTYCYCLE_RESTRICTED == status)
|
||||
{
|
||||
nextTxIn = LmHandlerGetDutyCycleWaitTime();
|
||||
if (nextTxIn > 0)
|
||||
{
|
||||
APP_LOG(TS_ON, VLEVEL_L, "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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2048,7 +2046,7 @@ void STS_REBOOT_CONFIG_Init(void)
|
|||
#if defined(YUNHORN_STS_O6_ENABLED) || defined(YUNHORN_STS_R0_ENABLED) || defined(YUNHORN_STS_R5_ENABLED)
|
||||
if ((nvm_stored_value[NVM_MTM1] != sts_mtmcode1) || (nvm_stored_value[NVM_MTM2] != sts_mtmcode2) || (nvm_stored_value[NVM_VER] != sts_version))
|
||||
{
|
||||
APP_LOG(TS_OFF, VLEVEL_L, "\r\nInitial Boot with Empty Config, Flash with default config....\r\n");
|
||||
APP_LOG(TS_OFF, VLEVEL_H, "\r\nInitial Boot with Empty Config, Flash with default config....\r\n");
|
||||
OnStoreSTSCFGContextRequest();
|
||||
UTIL_MEM_set_8((void *)sts_ac_code, 0x00, YUNHORN_STS_AC_CODE_SIZE);
|
||||
HAL_Delay(1000);
|
||||
|
|
|
@ -28,6 +28,7 @@ Pre-defines
|
|||
TOF_3 , P6,P7,P10 out interface, XSHUT:PA-10,INT:PB-5
|
||||
SOAP_LEVEL_SENSOR, Switch/XSHUT: PB-3, INPUT-STATUS: PA-10
|
||||
ROCTEC_R5, for upload payload format with distance only, 2 bytes
|
||||
LED_ONBOARD, If LED soldered on board
|
||||
|
||||
|
||||
@par Description
|
||||
|
|
Loading…
Reference in New Issue