Factory reset and check_file progress bar

This commit is contained in:
Alex Voinea 2021-02-25 21:04:05 +02:00
parent 8821439878
commit 204da1cc3f
No known key found for this signature in database
GPG Key ID: F5034E7CFCF2F973
2 changed files with 10 additions and 32 deletions

View File

@ -710,7 +710,6 @@ void softReset()
// Factory reset function
// This function is used to erase parts or whole EEPROM memory which is used for storing calibration and and so on.
// Level input parameter sets depth of reset
int er_progress = 0;
static void factory_reset(char level)
{
lcd_clear();
@ -790,28 +789,15 @@ static void factory_reset(char level)
// Level 3: erase everything, whole EEPROM will be set to 0xFF
case 3:
lcd_puts_P(PSTR("Factory RESET"));
lcd_puts_at_P(1, 2, PSTR("ERASING all data"));
Sound_MakeCustom(100,0,false);
er_progress = 0;
lcd_puts_at_P(3, 3, PSTR(" "));
lcd_set_cursor(3, 3);
lcd_print(er_progress);
menu_progressbar_init(EEPROM_TOP, PSTR("ERASING all data"));
Sound_MakeCustom(100,0,false);
// Erase EEPROM
for (int i = 0; i < 4096; i++) {
for (uint16_t i = 0; i < EEPROM_TOP; i++) {
eeprom_update_byte((uint8_t*)i, 0xFF);
if (i % 41 == 0) {
er_progress++;
lcd_puts_at_P(3, 3, PSTR(" "));
lcd_set_cursor(3, 3);
lcd_print(er_progress);
lcd_puts_P(PSTR("%"));
}
menu_progressbar_update(i);
}
menu_progressbar_finish();
softReset();

View File

@ -8403,7 +8403,6 @@ static bool check_file(const char* filename) {
const uint32_t filesize = card.getFileSize();
uint32_t startPos = 0;
const uint16_t bytesToCheck = min(END_FILE_SECTION, filesize);
uint8_t blocksPrinted = 0;
if (filesize > END_FILE_SECTION) {
startPos = filesize - END_FILE_SECTION;
card.setIndex(startPos);
@ -8411,22 +8410,15 @@ static bool check_file(const char* filename) {
cmdqueue_reset();
cmdqueue_serial_disabled = true;
lcd_clear();
lcd_puts_at_P(0, 1, _i("Checking file"));////c=20 r=1
lcd_set_cursor(0, 2);
menu_progressbar_init(bytesToCheck, _i("Checking file"));
while (!card.eof() && !result) {
for (; blocksPrinted < (((card.get_sdpos() - startPos) * LCD_WIDTH) / bytesToCheck); blocksPrinted++)
lcd_print('\xFF'); //simple progress bar
menu_progressbar_update(card.get_sdpos() - startPos);
card.sdprinting = true;
get_command();
result = check_commands();
}
for (; blocksPrinted < LCD_WIDTH; blocksPrinted++)
lcd_print('\xFF'); //simple progress bar
_delay(100); //for the user to see the end of the progress bar.
menu_progressbar_finish();
cmdqueue_serial_disabled = false;
card.printingHasFinished();