OpenBLT: blink yellow LED faster if bad nBank status is detected https://github.com/rusefi/rusefi/issues/5921

This commit is contained in:
andreika-git 2024-02-07 23:08:10 +02:00 committed by rusefillc
parent eb26152655
commit f508d98288
3 changed files with 12 additions and 2 deletions

View File

@ -22,7 +22,8 @@ protected:
while (true) {
palTogglePad(yellowPort, yellowPin);
chThdSleepMilliseconds(250);
// blink 3 times faster if Dual Bank is not enabled
chThdSleepMilliseconds(isFlashDualBank() ? 250 : 80);
}
}
};

View File

@ -39,7 +39,7 @@ blt_bool FlashWriteChecksum(void);
blt_bool FlashVerifyChecksum(void);
blt_bool FlashDone(void);
blt_addr FlashGetUserProgBaseAddress(void);
bool isFlashDualBank(void);
#endif /* FLASH_H */
/*********************************** end of flash.h ************************************/

View File

@ -44,3 +44,12 @@ blt_bool FlashVerifyChecksum() {
// Naive check: if the first block is blank, there's no code there
return intFlashIsErased(FlashGetUserProgBaseAddress(), 4) ? BLT_FALSE : BLT_TRUE;
}
bool isFlashDualBank(void) {
#ifdef STM32F7XX
// cleared bit indicates dual bank
return (FLASH->OPTCR & FLASH_OPTCR_nDBANK) == 0;
#else
return true;
#endif
}