led and rc

This commit is contained in:
2024-09-30 00:26:00 +03:00
parent 7095a09a1d
commit 6c3af6fbb5
15 changed files with 634 additions and 221 deletions

View File

@ -3,6 +3,7 @@
#include "usbd_cdc_if.h"
#include "Print.h"
#include "RobotFunctions.h"
#include "Indicator.h"
InfoBlock infoBlock;
extern IWDG_HandleTypeDef hiwdg;
@ -265,16 +266,23 @@ MemoryStatus delMacro(unsigned char number) {
MemoryStatus EEPROM_EARSE() {
uint16_t addr = 0;
const uint16_t EEPROM_MAX_ADDR = 1024*32;
led_PingPong_start(7, 12);
do {
uint8_t Buf[64];
HAL_IWDG_Refresh(&hiwdg);
memset(Buf, 0x00, sizeof(Buf));
HAL_IWDG_Refresh(&hiwdg);
FLASH_WriteBlock(addr, 0, Buf, sizeof(Buf), sizeof(Buf));
HAL_IWDG_Refresh(&hiwdg);
led_PingPong_next();
uint8_t progress = (addr * 100) / EEPROM_MAX_ADDR;
led_progressbar(00, 06, progress<50 ? 100 : 100-(progress-50)*2);
led_progressbar(13, 19, progress<50 ? 100-progress*2 : 0);
addr += sizeof(Buf);
} while (addr < EEPROM_MAX_ADDR);
led_clear();
return EEPROM_OK;
}