Tweaks to 2560 EEPROM burn during multi page writes

This commit is contained in:
Josh Stewart 2022-09-12 11:53:18 +10:00
parent 94152b2968
commit 56fde7c3fc
3 changed files with 11 additions and 6 deletions

View File

@ -238,7 +238,9 @@ void processSerialCommand()
break;
case 'b': // New EEPROM burn command to only burn a single page at a time
writeConfig(serialPayload[2]); //Read the table number and perform burn. Note that byte 1 in the array is unused
if( (micros() > deferEEPROMWritesUntil)) { writeConfig(serialPayload[2]); } //Read the table number and perform burn. Note that byte 1 in the array is unused
else { BIT_SET(currentStatus.status4, BIT_STATUS4_BURNPENDING); }
sendSerialReturnCode(SERIAL_RC_BURN_OK);
break;

View File

@ -180,8 +180,11 @@ void loop()
}
#endif
//Displays currently disabled
// if (configPage2.displayType && (mainLoopCount & 255) == 1) { updateDisplay();}
if(currentLoopTime > micros_safe())
{
//Occurs when micros() has overflowed
deferEEPROMWritesUntil = 0; //Required to ensure that EEPROM writes are not deferred indefinitely
}
currentLoopTime = micros_safe();
unsigned long timeToLastTooth = (currentLoopTime - toothLastToothTime);
@ -238,7 +241,7 @@ void loop()
//***Perform sensor reads***
//-----------------------------------------------------------------------------------------------------
readMAP();
readMAP();
if (BIT_CHECK(LOOP_TIMER, BIT_TIMER_15HZ)) //Every 32 loops
{

View File

@ -157,7 +157,7 @@ void writeConfig(uint8_t pageNum)
#if defined(CORE_STM32) || defined(CORE_TEENSY) & !defined(USE_SPI_EEPROM)
uint8_t EEPROM_MAX_WRITE_BLOCK = 64;
#else
uint8_t EEPROM_MAX_WRITE_BLOCK = 24;
uint8_t EEPROM_MAX_WRITE_BLOCK = 20;
#ifdef CORE_AVR
//In order to prevent missed pulses during EEPROM writes on AVR, scale the
@ -168,7 +168,7 @@ void writeConfig(uint8_t pageNum)
{
EEPROM_MAX_WRITE_BLOCK = (uint8_t)(15000U / currentStatus.RPM);
EEPROM_MAX_WRITE_BLOCK = max(EEPROM_MAX_WRITE_BLOCK, 1);
EEPROM_MAX_WRITE_BLOCK = min(EEPROM_MAX_WRITE_BLOCK, 24); //Any higher than this will cause comms timeouts on AVR
EEPROM_MAX_WRITE_BLOCK = min(EEPROM_MAX_WRITE_BLOCK, 20); //Any higher than this will cause comms timeouts on AVR
}
#endif