1
0
Fork 0
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:
Jay Blackman 2025-01-03 22:43:40 +11:00 committed by GitHub
parent bb5a38d116
commit 3c9746fdac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}