mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Update config_flash.c
Adjusted interrupts being disabled and removed superfluous variable.
This commit is contained in:
parent
bb5a38d116
commit
3c9746fdac
1 changed files with 4 additions and 3 deletions
|
@ -30,8 +30,6 @@
|
|||
|
||||
#if defined(CONFIG_IN_FLASH)
|
||||
|
||||
static uint32_t interrupts;
|
||||
|
||||
void configUnlock(void)
|
||||
{
|
||||
// NOOP
|
||||
|
@ -49,6 +47,8 @@ void configFlashClearFlags(void)
|
|||
|
||||
configStreamerResult_e configWriteWord(uintptr_t address, config_streamer_buffer_type_t value)
|
||||
{
|
||||
uint32_t interrupts = save_and_disable_interrupts();
|
||||
|
||||
if (address == __config_start) {
|
||||
// Erase the flash sector before writing
|
||||
flash_range_erase(address, FLASH_PAGE_SIZE);
|
||||
|
@ -59,8 +59,9 @@ configStreamerResult_e configWriteWord(uintptr_t address, config_streamer_buffer
|
|||
// TODO: refactor to stream the entire buffer to flash also possibly avoid disabling interrupts.
|
||||
// Write data to flash
|
||||
// TODO: synchronise second core...
|
||||
uint32_t interrupts = save_and_disable_interrupts();
|
||||
|
||||
flash_range_program(address, (uint8_t*)&value, sizeof(uint32_t));
|
||||
|
||||
restore_interrupts(interrupts);
|
||||
return CONFIG_RESULT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue