---- workable STS-R4

This commit is contained in:
Yunhorn 2024-10-23 23:12:13 +08:00
parent 7b1863a2de
commit c7a05575cc
6 changed files with 17 additions and 19 deletions

View File

@ -47,12 +47,12 @@ extern "C" {
/**
* @brief Verbose level for all trace logs
*/
#define VERBOSE_LEVEL VLEVEL_OFF
#define VERBOSE_LEVEL VLEVEL_M
/**
* @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
@ -75,13 +75,13 @@ extern "C" {
* @brief Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power
*/
#define DEBUGGER_ENABLED 0
#define DEBUGGER_ENABLED 1
/**
* @brief Disable Low Power mode
* @note 0: LowPowerMode enabled. MCU enters stop2 mode, 1: LowPowerMode disabled. MCU enters sleep mode only
*/
#define LOW_POWER_DISABLE 0
#define LOW_POWER_DISABLE 1
/* USER CODE BEGIN EC */

View File

@ -165,7 +165,7 @@ void SystemClock_Config(void)
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
//RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
{

View File

@ -1446,7 +1446,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 */
}
@ -1479,6 +1479,6 @@ void OnYunhornSTSTxPeriodicityChanged(uint32_t periodicity)
UTIL_TIMER_Start(&TxTimer);
/* USER CODE BEGIN OnYunhornSTSTxPeriodicityChanged */
APP_LOG(TS_OFF, VLEVEL_H,"* STS TxPeriodicity = %u (sec)\r\n", TxPeriodicity/1000 );
APP_LOG(TS_OFF, VLEVEL_M,"\n* STS TxPeriodicity = %u (sec)\r\n", TxPeriodicity/1000 );
/* USER CODE END OnYunhornSTSTxPeriodicityChanged */
}

View File

@ -15,8 +15,6 @@ RM := rm -rf
-include Drivers/STM32WLxx_HAL_Driver/subdir.mk
-include Drivers/CMSIS/subdir.mk
-include Drivers/BSP/STM32WLxx_Nucleo/subdir.mk
-include Drivers/BSP/Components/subdir.mk
-include Drivers/BSP/53L8A1/subdir.mk
-include Application/User/Startup/subdir.mk
-include Application/User/STS/TOF/vl53l0x/subdir.mk
-include Application/User/STS/TOF/Target/subdir.mk

View File

@ -30,8 +30,6 @@ Application/User/STS/TOF/App \
Application/User/STS/TOF/Target \
Application/User/STS/TOF/vl53l0x \
Application/User/Startup \
Drivers/BSP/53L8A1 \
Drivers/BSP/Components \
Drivers/BSP/STM32WLxx_Nucleo \
Drivers/CMSIS \
Drivers/STM32WLxx_HAL_Driver \

View File

@ -1198,7 +1198,7 @@ void USER_APP_AUTO_RESPONDER_Parse(uint8_t *parse_buffer, uint8_t parse_buffer_s
STS_TxPeriod_sec = periodicity_length;
TxPeriodicity = periodicity_length*1000;
APP_LOG(TS_OFF,VLEVEL_M, "\nTx Periodicty changed to %u", TxPeriodicity);
APP_LOG(TS_OFF,VLEVEL_M, "\nSTS Tx Periodicty changed to %u sec\n\r", STS_TxPeriod_sec);
#ifdef STS_R4
OnYunhornSTSTxPeriodicityChanged(STS_TxPeriod_sec*1000);
#endif
@ -1555,7 +1555,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 */
@ -1573,7 +1573,7 @@ void OnRestoreSTSCFGContextProcess(void)
}
periodicity = (periodicity > 10)? periodicity : 10; // in seconds unit
APP_LOG(TS_OFF, VLEVEL_H, "\n\n Tx periodicity in NVM =%u sec\n",periodicity);
APP_LOG(TS_OFF, VLEVEL_M, "\n\n Tx periodicity in NVM =%u sec\n",periodicity);
TxPeriodicity= periodicity*1000; // to ms
STS_TxPeriod_sec = periodicity;
@ -1586,13 +1586,14 @@ void OnRestoreSTSCFGContextProcess(void)
} else if ((char) sts_cfg_nvm.s_unit =='S') {
sampling_heartbeat_periodicity *= 1;
}
STS_HeartBeatTimerPeriod_sec = sampling_heartbeat_periodicity;
APP_LOG(TS_OFF, VLEVEL_H, "\n\n sampling or heartbeat periodicity in NVM =%u sec\n",sampling_heartbeat_periodicity);
STS_HeartBeatTimerPeriod_sec = MAX(sampling_heartbeat_periodicity,5*periodicity);
APP_LOG(TS_OFF, VLEVEL_M, "\n\n sampling or heartbeat periodicity in NVM =%u sec\n",sampling_heartbeat_periodicity);
if ((sts_cfg_nvm.ac[0] ==0x0 )&& (sts_cfg_nvm.ac[19]==0x0))
{ // ensure it's not in production yet
//OnTxPeriodicityChanged(APP_TX_DUTYCYCLE); // in msec unit
//OnYunhornSTSHeartBeatPeriodicityChanged(HeartBeatPeriodicity); TODO XXXX
OnYunhornSTSTxPeriodicityChanged(APP_TX_DUTYCYCLE); // in msec unit
OnYunhornSTSHeartBeatPeriodicityChanged(APP_TX_DUTYCYCLE*5); //TODO XXXX
//OnTxPeriodicityChanged(10000); // APP_TX_DUTYCYCLE in msec unit
//TxPeriodicity = APP_TX_DUTYCYCLE;
@ -1611,7 +1612,8 @@ void OnRestoreSTSCFGContextProcess(void)
#endif
#if defined(YUNHORN_STS_R0_ENABLED)||defined(YUNHORN_STS_R5_ENABLED)||defined(YUNHORN_STS_R4_ENABLED)
OnYunhornSTSHeartBeatPeriodicityChanged(sampling_heartbeat_periodicity*1000);
//OnYunhornSTSHeartBeatPeriodicityChanged(sampling_heartbeat_periodicity*1000);
OnYunhornSTSHeartBeatPeriodicityChanged(STS_HeartBeatTimerPeriod_sec*1000);
#endif
}