minor improve, low power, send one message after join, report after

class change
This commit is contained in:
Yunhorn 2024-03-26 11:16:11 +08:00
parent 9f20a97381
commit 55d5463b3d
7 changed files with 11573 additions and 11537 deletions

View File

@ -59,8 +59,8 @@
#ifdef YUNHORN_STS_M7_ENABLED
#define MajorVer 24U
#define MinorVer 02U
#define SubMinorVer 23U
#define MinorVer 03U
#define SubMinorVer 26U
#define FirmwareVersion 3U
/*
#define YUNHORN_STS_M7_NVM_CFG_SIZE 3U

View File

@ -49,29 +49,43 @@ void MX_GPIO_Init(void)
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_All;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin
|LED3_Pin, GPIO_PIN_RESET);
#if 0
/*Configure GPIO pins : PBPin PBPin PBPin */
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
#endif
/*Configure GPIO pins : PAPin PAPin */
GPIO_InitStruct.Pin = BUT2_Pin; //GPIO_InitStruct.Pin = BUT1_Pin|BUT2_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
#if 0
/*Configure GPIO pins : PBPin PBPin */
GPIO_InitStruct.Pin = PROB2_Pin|PROB1_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
#endif
#if defined(USE_STM32WL55)
/*Configure GPIO pins : PAPin PAPin */

View File

@ -95,6 +95,8 @@ void PWR_EnterStopMode(void)
/* USER CODE BEGIN EnterStopMode_1 */
/* USER CODE END EnterStopMode_1 */
HAL_GPIO_WritePin(GPIOB,GPIO_PIN_All, GPIO_PIN_RESET);
HAL_GPIO_WritePin(GPIOC,GPIO_PIN_All, GPIO_PIN_RESET);
HAL_SuspendTick();
/* Clear Status Flag before entering STOP/STANDBY Mode */
LL_PWR_ClearFlag_C1STOP_C1STB();

View File

@ -121,8 +121,8 @@ void SystemApp_Init(void)
/*Init low power manager*/
UTIL_LPM_Init();
/* Disable Stand-by mode */
//UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE);
UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_ENABLE);
UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_DISABLE);
//UTIL_LPM_SetOffMode((1 << CFG_LPM_APPLI_Id), UTIL_LPM_ENABLE);
#if defined (LOW_POWER_DISABLE) && (LOW_POWER_DISABLE == 1)
/* Disable Stop Mode */

View File

@ -100,13 +100,18 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
PA3 ------> USART2_RX
PA2 ------> USART2_TX
*/
GPIO_InitStruct.Pin = USARTx_RX_Pin|USARTx_TX_Pin;
GPIO_InitStruct.Pin = USARTx_TX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = USARTx_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USART2 DMA Init */
/* USART2_TX Init */
hdma_usart2_tx.Instance = DMA1_Channel5;

View File

@ -600,6 +600,15 @@ static void OnRxData(LmHandlerAppData_t *appData, LmHandlerRxParams_t *params)
default:
break;
}
DeviceClass_t deviceClass = CLASS_A;
LmHandlerGetCurrentClass( &deviceClass );
uint8_t i=0;
outbuf[i++] = (uint8_t) 'L';
outbuf[i++] = (uint8_t) sts_mtmcode1;
outbuf[i++] = (uint8_t) sts_mtmcode2;
outbuf[i++] = (uint8_t) sts_version;
outbuf[i++] = (uint8_t) (0x41+ deviceClass); //translate to 'A','B','C'
STS_SENSOR_Upload_Message(LORAWAN_USER_APP_CTRL_REPLY_PORT, i, outbuf);
}
break;
case LORAWAN_USER_APP_PORT:
@ -1279,6 +1288,7 @@ static void OnJoinRequest(LmHandlerJoinParams_t *joinParams)
APP_LOG(TS_OFF, VLEVEL_M, "\r\n###### = JOIN FAILED\r\n");
}
}
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
/* USER CODE END OnJoinRequest_1 */
}

File diff suppressed because it is too large Load Diff