修复中性光上电瞬时闪烁
This commit is contained in:
@@ -79,7 +79,7 @@ unsigned char get_checksum(unsigned char *ptrdata, unsigned char length)
|
|||||||
#define FLASH_POWER_CYCLE_INDEX 29U
|
#define FLASH_POWER_CYCLE_INDEX 29U
|
||||||
#define FLASH_POWER_MODE_MARK 0xA7U
|
#define FLASH_POWER_MODE_MARK 0xA7U
|
||||||
#define POWER_POLICY_SAVE_DELAY_MS 100U
|
#define POWER_POLICY_SAVE_DELAY_MS 100U
|
||||||
#define POWER_CYCLE_SAVE_DELAY_MS 100U
|
#define USER_DATA_FLASH_ADDR 0x1E000UL
|
||||||
|
|
||||||
uint8_t power_restore_policy = POWER_RESTORE_CYCLE_STATIC;
|
uint8_t power_restore_policy = POWER_RESTORE_CYCLE_STATIC;
|
||||||
static uint8_t power_cycle_next_mode;
|
static uint8_t power_cycle_next_mode;
|
||||||
@@ -288,6 +288,15 @@ void power_restore_apply_on_boot(void)
|
|||||||
|
|
||||||
power_cycle_next_mode = (uint8_t)((mode_index + 1U) % 3U);
|
power_cycle_next_mode = (uint8_t)((mode_index + 1U) % 3U);
|
||||||
|
|
||||||
/* Save the next startup mode while power is stable. */
|
/*
|
||||||
set_TaskComps_timer(2U, POWER_CYCLE_SAVE_DELAY_MS);
|
* Save the next startup mode before timers, BLE and the H-bridge start.
|
||||||
|
* A deferred flash erase/write masks interrupts long enough to stretch
|
||||||
|
* one Timer3-controlled dual-color pulse and causes a visible flash.
|
||||||
|
*/
|
||||||
|
wright_user_data();
|
||||||
|
GLOBAL_INT_DISABLE();
|
||||||
|
xc_fmc_spi_flash_erase_page(USER_DATA_FLASH_ADDR);
|
||||||
|
xc_fmc_spi_flash_write_page(USER_DATA_FLASH_ADDR,
|
||||||
|
app_data, FLASH_PAGE_SIZE);
|
||||||
|
GLOBAL_INT_RESTORE();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void ble_flash_handle(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t app_data[128] = {0};
|
uint8_t app_data[FLASH_PAGE_SIZE] = {0};
|
||||||
|
|
||||||
//uint16_t app_op_flash_start = 10000;
|
//uint16_t app_op_flash_start = 10000;
|
||||||
void app_op_flash(void)
|
void app_op_flash(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user