refactor(vd960Loop): 算法回退到 DLD154V4B,四通道适配
- 用 DLD154V4B vd1_task/per_channel 替换 vds_task 复杂算法
- 移除 FUNCTION_B/二次判断/快速变化/多重确认等增强特性
- 保留平坦性离开算法 (CN200910309382),每通道独立状态
- 灵敏度表改为 DLD154V4B 4级: {216,108,36,10} / {108,72,18,9}
- 清理废弃类型: FltHistoryManager, Loop_ACS_Info, StageRangeConfig 等
- 首次添加 vd960DBN 完整源码
This commit is contained in:
122
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/peripheral_main.c
Normal file
122
vd960DBN/BLE/OnlyUpdateApp_IAP/APP/peripheral_main.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/********************************** (C) COPYRIGHT *******************************
|
||||
* File Name : main.c
|
||||
* Author : WCH
|
||||
* Version : V1.1
|
||||
* Date : 2019/11/05
|
||||
* Description : Upgrade slave application main function and task system initialization
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Header file contains */
|
||||
#include "CONFIG.h"
|
||||
#include "HAL.h"
|
||||
#include "Peripheral.h"
|
||||
#include "OTA.h"
|
||||
#include "OTAprofile.h"
|
||||
|
||||
/* ¼Ç¼µ±Ç°µÄImage */
|
||||
unsigned char CurrImageFlag = 0xff;
|
||||
|
||||
/*********************************************************************
|
||||
* GLOBAL TYPEDEFS
|
||||
*/
|
||||
__attribute__((aligned(4))) uint32_t MEM_BUF[BLE_MEMHEAP_SIZE / 4];
|
||||
|
||||
#if(defined(BLE_MAC)) && (BLE_MAC == TRUE)
|
||||
const uint8_t MacAddr[6] = {0x84, 0xC2, 0xE4, 0x03, 0x02, 0x02};
|
||||
#endif
|
||||
|
||||
/* Note: The operation of Flash after the program is upgraded must be performed first
|
||||
* without turning on any interruption to prevent operation interruption and failure
|
||||
*/
|
||||
/*********************************************************************
|
||||
* @fn ReadImageFlag
|
||||
*
|
||||
* @brief Read the iMage logo of the current program.
|
||||
* If the DataFlash is empty, it will be Imagea by default.
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
void ReadImageFlag(void)
|
||||
{
|
||||
OTADataFlashInfo_t p_image_flash;
|
||||
|
||||
FLASH_read(OTA_DATAFLASH_ADD, (uint8_t *)&p_image_flash, 4);
|
||||
CurrImageFlag = p_image_flash.ImageFlag;
|
||||
|
||||
/* The program is executed for the first time, or it has not been updated,
|
||||
* and the DataFLASH is erased after being updated in the future
|
||||
*/
|
||||
if((p_image_flash.flag[0] != 0x5A) || (p_image_flash.flag[1] != 0x5A) || (p_image_flash.flag[2] != 0x5A))
|
||||
{
|
||||
CurrImageFlag = IMAGE_A_FLAG;
|
||||
}
|
||||
|
||||
PRINT("Image Flag %02x\n", CurrImageFlag);
|
||||
|
||||
if(CurrImageFlag == IMAGE_A_FLAG)
|
||||
{
|
||||
PRINT("jump App \n");
|
||||
Delay_Ms(5);
|
||||
jumpApp();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn Main_Circulation
|
||||
*
|
||||
* @brief Main loop
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
__attribute__((section(".highcode")))
|
||||
__attribute__((noinline))
|
||||
void Main_Circulation(void)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
TMOS_SystemProcess();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* @fn main
|
||||
*
|
||||
* @brief Main function
|
||||
*
|
||||
* @return none
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
SystemCoreClockUpdate();
|
||||
Delay_Init();
|
||||
#ifdef DEBUG
|
||||
USART_Printf_Init(115200);
|
||||
#endif
|
||||
PRINT("%s\n", VER_LIB);
|
||||
ReadImageFlag();
|
||||
if(RCC_GetFlagStatus(RCC_FLAG_SFTRST) == SET)
|
||||
{
|
||||
// Soft reset does not jump app app
|
||||
}
|
||||
else
|
||||
{
|
||||
if(CurrImageFlag == IMAGE_OTA_FLAG)
|
||||
{
|
||||
PRINT("jump App \n");
|
||||
Delay_Ms(5);
|
||||
jumpApp();
|
||||
}
|
||||
}
|
||||
WCHBLE_Init();
|
||||
HAL_Init();
|
||||
GAPRole_PeripheralInit();
|
||||
Peripheral_Init();
|
||||
Main_Circulation();
|
||||
}
|
||||
|
||||
/******************************** endfile @ main ******************************/
|
||||
Reference in New Issue
Block a user