From 7b0bf78309491593f142809c94b433f40c2c49b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=90=AA?= Date: Tue, 28 Jul 2026 17:51:50 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BF=AE=E5=A4=8DAPP=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E8=AE=B0=E5=BF=86=E7=AD=96=E7=95=A5=E6=97=B6=E9=97=AA?= =?UTF-8?q?=E7=83=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 550d0987eaf4c6557907018f189f8407ed138284. --- .../example/ble/ble_peripheral/app/src/PWM.h | 2 -- .../ble/ble_peripheral/app/src/bridge_pwm.c | 22 ------------------- .../app/src/ota_flash_interface.c | 17 +------------- 3 files changed, 1 insertion(+), 40 deletions(-) diff --git a/project/example/ble/ble_peripheral/app/src/PWM.h b/project/example/ble/ble_peripheral/app/src/PWM.h index 6db13bd..272ba68 100644 --- a/project/example/ble/ble_peripheral/app/src/PWM.h +++ b/project/example/ble/ble_peripheral/app/src/PWM.h @@ -147,8 +147,6 @@ void Bridge_Init(void); void Bridge_Off(void); void Bridge_Service_1ms(void); void Bridge_Deadtime_Expired(void); -uint8_t Bridge_PauseForFlash(void); -void Bridge_ResumeAfterFlash(uint8_t paused); #ifdef __cplusplus } #endif diff --git a/project/example/ble/ble_peripheral/app/src/bridge_pwm.c b/project/example/ble/ble_peripheral/app/src/bridge_pwm.c index 0b3a82c..2faf280 100644 --- a/project/example/ble/ble_peripheral/app/src/bridge_pwm.c +++ b/project/example/ble/ble_peripheral/app/src/bridge_pwm.c @@ -246,28 +246,6 @@ void Bridge_Off(void) output_mode = BRIDGE_MODE_OFF; } -uint8_t Bridge_PauseForFlash(void) -{ - /* - * Single-color output is hardware PWM and remains stable while flash - * masks interrupts. Dual-color output is Timer3-driven, so force both - * bridge inputs low before flash can stretch an active direction pulse. - */ - if (!bridge_ready || output_mode != BRIDGE_MODE_DUAL) { - return 0U; - } - - Bridge_Off(); - return 1U; -} - -void Bridge_ResumeAfterFlash(uint8_t paused) -{ - if (paused) { - Bridge_Service_1ms(); - } -} - __RAM_CODE void Bridge_Deadtime_Expired(void) { uint32_t w_step; diff --git a/project/example/ble/ble_peripheral/app/src/ota_flash_interface.c b/project/example/ble/ble_peripheral/app/src/ota_flash_interface.c index 2a7f87c..84eeeff 100644 --- a/project/example/ble/ble_peripheral/app/src/ota_flash_interface.c +++ b/project/example/ble/ble_peripheral/app/src/ota_flash_interface.c @@ -1,11 +1,9 @@ #include "ota_flash_interface.h" -#include "xc_drv_fmc_spi.h" #include "arch.h" #include "dbg.h" // extern uint8_t ble_flash_operation_can_check(void); #include "ota_protocol.h" #include "fmc_spi.h" -#include "pwm.h" op_flash_t op_flash = { OP_IDEL, }; @@ -99,23 +97,10 @@ uint8_t app_data[FLASH_PAGE_SIZE] = {0}; //uint16_t app_op_flash_start = 10000; void app_op_flash(void) { - uint8_t bridge_paused; if(op_flash.op_state == OP_IDEL&&app_op_flash_flag ==0) { - /* - * Commit user data as one transaction. Timer3 cannot advance - * dual-color PWM while flash masks interrupts, so hold the - * H-bridge at 00 and resume from a fresh complete frame. - * Hardware PWM single-color output does not need pausing. - */ - GLOBAL_INT_DISABLE(); - bridge_paused = Bridge_PauseForFlash(); - FMC_SPI_Flash_Erase_Page(0x1E000); - FMC_SPI_Flash_WritePage(0x1E000, app_data, FLASH_PAGE_SIZE); - GLOBAL_INT_RESTORE(); - app_op_flash_flag = 2; - Bridge_ResumeAfterFlash(bridge_paused); + ble_flash_later_page_erase(0x1E000); } else if(op_flash.op_state == OP_IDEL &&app_op_flash_flag ==1) {