wip, no start after join
This commit is contained in:
parent
072c801ca3
commit
7e63a57a0a
|
@ -6,7 +6,7 @@
|
|||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
|
|
|
@ -108,9 +108,9 @@ void Error_Handler(void);
|
|||
#define MEMS_RESET_Pin GPIO_PIN_4
|
||||
#define MEMS_RESET_GPIO_Port GPIOB
|
||||
#endif
|
||||
#define PME_ON //HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET )
|
||||
#define PME_OFF //HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET )
|
||||
#define PME_TOGGLE //HAL_GPIO_TogglePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin)
|
||||
#define PME_ON HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET )
|
||||
#define PME_OFF HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET )
|
||||
#define PME_TOGGLE HAL_GPIO_TogglePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin)
|
||||
|
||||
#if (defined(TOF_1)||defined(TOF_2)||defined(STS_R1)||defined(STS_R5)||defined(STS_R1D))
|
||||
#define VL53L0 1U
|
||||
|
@ -221,7 +221,7 @@ void Error_Handler(void);
|
|||
#define I2C2_SDA_PORT GPIOA
|
||||
|
||||
// FOR STM32WLE5CCU6 UFQFPN48 PA12 PA11
|
||||
#ifndef STM32WLE5xx
|
||||
#ifdef STM32WLE5xx
|
||||
#define I2C2_STANDARD_100K 0x00000E14
|
||||
#define I2C2_FAST_400K 0x00000004
|
||||
#define I2C2_FAST_PLUS_1M 0x00000000
|
||||
|
@ -238,10 +238,11 @@ void Error_Handler(void);
|
|||
/*
|
||||
* FOR STM32WL55JCIX UFBGA73 PA12 PA11
|
||||
*/
|
||||
|
||||
#ifdef STM32WL55xx
|
||||
#define I2C2_STANDARD_100K 0x10805D88
|
||||
#define I2C2_FAST_400K 0x0090194B
|
||||
#define I2C2_FAST_PLUS_1M 0x00700814
|
||||
#endif
|
||||
|
||||
#if defined(STS_R4)
|
||||
/* IF_SOAP_IN, MEMS_IF_3, PA10 */
|
||||
|
|
|
@ -101,20 +101,23 @@ int main(void)
|
|||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
|
||||
#if 0
|
||||
if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB) != RESET)
|
||||
{
|
||||
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
MX_I2C2_Init();
|
||||
MX_DMA_Init();
|
||||
MX_LoRaWAN_Init();
|
||||
//MX_USART2_UART_Init();
|
||||
printf("Normal bootup\n");
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
MX_USART2_UART_Init();
|
||||
//MX_USART2_UART_Init();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
|
|
|
@ -125,6 +125,9 @@ void SystemApp_Init(void)
|
|||
#if defined(L8)
|
||||
MX_TOF_Init();
|
||||
#endif
|
||||
#if defined(STS_R1D)
|
||||
MX_TOF_Init();
|
||||
#endif
|
||||
#if defined(STS_P2)
|
||||
STS_TOF_VL53LX_PeopleCounting_Process_Init();
|
||||
#endif
|
||||
|
|
|
@ -803,8 +803,10 @@ static void SendTxData(void)
|
|||
#endif
|
||||
|
||||
#ifdef VL53L0
|
||||
//STS_YunhornSTSEventP4_Process();
|
||||
STS_YunhornSTSEventP4_Process();
|
||||
STS_RR_Sensor_Read(&sts_rr_sensor_data);
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\r\n VL53L0 sensor data read \r\n");
|
||||
|
||||
#ifdef STS_R1
|
||||
AppData.Port = YUNHORN_STS_R1_LORA_APP_DATA_PORT; /* STS-R1 Data Port */
|
||||
#elif defined(STS_R1D)
|
||||
|
@ -830,11 +832,11 @@ static void SendTxData(void)
|
|||
AppData.Buffer[i++] = (uint8_t) sts_hardware_ver;
|
||||
AppData.Buffer[i++] = (uint8_t) 99*batteryLevel/254;
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
APP_LOG(TS_ON, VLEVEL_M, "VDDA: %d\r\n", batteryLevel);
|
||||
APP_LOG(TS_ON, VLEVEL_M, "temp: %d\r\n", (int16_t)(sensor_data.temperature));
|
||||
|
||||
AppData.Port = LORAWAN_USER_APP_PORT;
|
||||
//AppData.Port = LORAWAN_USER_APP_PORT;
|
||||
#endif
|
||||
|
||||
#ifdef STS_P2
|
||||
|
@ -1023,6 +1025,7 @@ static void OnTxTimerEvent(void *context)
|
|||
#elif defined(STS_M1)
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP1), CFG_SEQ_Prio_0);
|
||||
#elif defined(STS_R1D)
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\nSET TASK P4\r\n");
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_YunhornSTSEventP4), CFG_SEQ_Prio_0);
|
||||
#endif
|
||||
|
||||
|
@ -1444,7 +1447,7 @@ static void OnYunhornSTSHeartBeatTimerEvent(void *context)
|
|||
appHeartBeatBufferSize = 2;
|
||||
appHeartBeatDataBuffer[0]=(uint8_t)(0x80|AppLedStateOn);
|
||||
appHeartBeatDataBuffer[1]=(uint8_t)(SYS_GetBatteryLevel()/100); //TODO XXX change to battery level in mV
|
||||
//APP_LOG(TS_OFF, VLEVEL_M, "\n\n HEART-BEAT TIMER = %d\n\n", rfac_timer);
|
||||
APP_LOG(TS_OFF, VLEVEL_M, "\n\n HEART-BEAT TIMER = %d\n\n", rfac_timer);
|
||||
STS_SENSOR_Upload_Message(appHeartBeatDataPort, appHeartBeatBufferSize, (uint8_t*)appHeartBeatDataBuffer);
|
||||
|
||||
#endif
|
||||
|
@ -1478,7 +1481,7 @@ void OnYunhornSTSHeartBeatPeriodicityChanged(uint32_t newperiodicity)
|
|||
UTIL_TIMER_Start(&YunhornSTSHeartBeatTimer);
|
||||
|
||||
/* USER CODE BEGIN OnYunhornSTSHeartBeatPeriodicityChanged_2 */
|
||||
APP_LOG(TS_OFF, VLEVEL_H,"* STS HeartBeatPeriodicity = %u (sec)\r\n", newperiodicity/1000 );
|
||||
APP_LOG(TS_OFF, VLEVEL_M,"* STS HeartBeatPeriodicity = %u (sec)\r\n", newperiodicity/1000 );
|
||||
/* USER CODE END OnYunhornSTSHeartBeatPeriodicityChanged_2 */
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -59,8 +59,13 @@ volatile sts_cfg_nvm_t sts_cfg_nvm = {
|
|||
sts_hardware_ver,
|
||||
0x05, //Regular TxPeriodicity interval
|
||||
'M', //Uplink data interval unit, for heart-beat uplink
|
||||
#if defined(STS_P2)||defined(STS_L8)
|
||||
0x01, //Heart-beat interval or Sampling interval
|
||||
'S', //Sampling sensor interval unit, for real-time sensing of MEMS
|
||||
#else
|
||||
0x3C, //Heart-beat interval or Sampling interval
|
||||
'M', //Sampling sensor interval unit, for real-time sensing of MEMS
|
||||
#endif
|
||||
0x04, // dual mode=4, uni_mode =5
|
||||
0x00, // sts service mask
|
||||
0x00, //sts_ioc_mask
|
||||
|
@ -114,7 +119,7 @@ volatile uint16_t sts_sensor_install_height=3000;
|
|||
volatile uint8_t sensor_data_ready=0;
|
||||
|
||||
#if defined(STS_R1)||defined(STS_R5)||defined(STS_R4)||defined(STS_R1D)
|
||||
volatile uint32_t STS_TOFScanPeriod_msec=50, STS_TxPeriod_sec=300, STS_HeartBeatTimerPeriod_sec=3600;
|
||||
volatile uint32_t STS_TOFScanPeriod_msec=50, STS_TxPeriod_sec=30, STS_HeartBeatTimerPeriod_sec=3600;
|
||||
#endif
|
||||
|
||||
#if defined(STS_L8)||defined(STS_P2)||defined(STS_O6T)||defined(STS_T6)
|
||||
|
@ -1583,7 +1588,7 @@ void STS_REBOOT_CONFIG_Init(void)
|
|||
}
|
||||
|
||||
}
|
||||
//STS_Show_STS_CFG_NVM((uint8_t*)nvm_store_value);
|
||||
STS_Show_STS_CFG_NVM((uint8_t*)nvm_store_value);
|
||||
OnRestoreSTSCFGContextProcess();
|
||||
|
||||
/* USER CODE END OnRestoreContextRequest_Last */
|
||||
|
@ -1624,7 +1629,7 @@ void OnRestoreSTSCFGContextProcess(void)
|
|||
//OnTxPeriodicityChanged(10000); // APP_TX_DUTYCYCLE in msec unit
|
||||
//TxPeriodicity = APP_TX_DUTYCYCLE;
|
||||
OnYunhornSTSTxPeriodicityChanged(TxPeriodicity); // in msec unit
|
||||
OnYunhornSTSHeartBeatPeriodicityChanged(sampling_heartbeat_periodicity*1000);
|
||||
OnYunhornSTSHeartBeatPeriodicityChanged(60*1000);
|
||||
|
||||
} else
|
||||
{
|
||||
|
|
|
@ -114,6 +114,8 @@ void MX_TOF_Init(void)
|
|||
#ifdef L8
|
||||
MX_53L8A1_ThresholdDetection_Init();
|
||||
MX_53L8A1_ThresholdDetection_Process();
|
||||
#elif defined(STS_R1D)
|
||||
XWL55_WLE5_53L0X_Init();
|
||||
#endif
|
||||
|
||||
/* USER CODE BEGIN TOF_Init_PostTreatment */
|
||||
|
|
Loading…
Reference in New Issue