---other try for accurate bat level in mV

This commit is contained in:
Yunhorn 2024-07-08 20:05:15 +08:00
parent 390abd9943
commit 32c969265a
5 changed files with 25177 additions and 25201 deletions
Core/Src
LoRaWAN/App
STM32CubeIDE/Release

View File

@ -181,8 +181,8 @@ uint16_t STS_GetBatteryLevel(void)
uint16_t batteryLevelmV = 0;
uint32_t measuredLevel = 0;
//measuredLevel = ADC_ReadChannels(LL_ADC_CHANNEL_11); //VBAT_DETECT PA15 ADC VIN11
measuredLevel = ADC_ReadChannels(LL_ADC_CHANNEL_14); //LL_ADC_CHANNEL_14
//measuredLevel = ADC_ReadChannels(LL_ADC_CHANNEL_15); //VBAT_DETECT PA15 ADC VIN11
measuredLevel = ADC_ReadChannels(LL_ADC_CHANNEL_11); //LL_ADC_CHANNEL_14
//measuredLevel = ADC_ReadChannels(LL_ADC_CHANNEL_VBAT); fixed value of 3.6V
if (measuredLevel == 0)
{
@ -201,7 +201,7 @@ uint16_t STS_GetBatteryLevel(void)
{
/* Device with Reference voltage not calibrated in production:
use generic parameters */
batteryLevelmV = (uint16_t)(3*VREFINT_CAL_VREF * 1510) / measuredLevel;
batteryLevelmV = (uint16_t)(VREFINT_CAL_VREF * 1510) / measuredLevel;
}
}

View File

@ -554,7 +554,8 @@ static void SendTxData(void)
/* USER CODE BEGIN SendTxData_1 */
LmHandlerErrorStatus_t status = LORAMAC_HANDLER_ERROR;
uint8_t batteryLevel = GetBatteryLevel();
uint16_t batteryLevelmV = (uint16_t) STS_GetBatteryLevel();
//uint16_t batteryLevelmV = (uint16_t) STS_GetBatteryLevel();
uint16_t batteryLevelmV = (uint16_t) SYS_GetBatteryLevel();
sensor_t sensor_data;
UTIL_TIMER_Time_t nextTxIn = 0;
//HAL_GPIO_WritePin(GPIOB, GPIO_PIN_4, GPIO_PIN_RESET); /* PME OFF */

View File

@ -1,24 +1,24 @@
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:778:13:OnBeaconStatusChange 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:813:13:OnSysTimeUpdate 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:820:13:OnClassChange 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:861:13:OnTxFrameCtrlChanged 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:872:13:OnPingSlotPeriodicityChanged 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:706:13:OnRxTimerLedEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:701:13:OnTxTimerLedEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:827:13:OnMacProcessNotify 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:934:13:OnStopJoinTimerEvent 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:674:13:OnTxTimerEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:839:13:OnTxPeriodicityChanged 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:1005:13:OnRestoreContextRequest 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:897:13:StopJoin 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:950:13:StoreContext 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:779:13:OnBeaconStatusChange 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:814:13:OnSysTimeUpdate 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:821:13:OnClassChange 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:862:13:OnTxFrameCtrlChanged 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:873:13:OnPingSlotPeriodicityChanged 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:707:13:OnRxTimerLedEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:702:13:OnTxTimerLedEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:828:13:OnMacProcessNotify 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:935:13:OnStopJoinTimerEvent 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:675:13:OnTxTimerEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:840:13:OnTxPeriodicityChanged 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:1006:13:OnRestoreContextRequest 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:898:13:StopJoin 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:951:13:StoreContext 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:552:13:SendTxData 7
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:747:13:OnJoinRequest 3
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:711:13:OnJoinTimerLedEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:718:13:OnTxData 3
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:883:13:OnSystemReset 3
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:748:13:OnJoinRequest 3
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:712:13:OnJoinTimerLedEvent 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:719:13:OnTxData 3
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:884:13:OnSystemReset 3
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:472:13:OnRxData 13
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:990:13:OnStoreContextRequest 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:972:13:OnNvmDataChange 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:991:13:OnStoreContextRequest 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:973:13:OnNvmDataChange 1
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:348:6:LoRaWAN_Init 2
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node_E5CC/LoRaWAN/App/lora_app.c:443:6:HAL_GPIO_EXTI_Callback 3

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff