Browse Source

Fix Creality EEPROM watchdog freq. (#20510)

Jason Smith 4 years ago
parent
commit
6dfcd491d0
No account linked to committer's email address
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp

+ 2
- 1
Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp View File

48
 bool PersistentStore::access_finish() { return true; }
48
 bool PersistentStore::access_finish() { return true; }
49
 
49
 
50
 bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
50
 bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
51
+  size_t written = 0;
51
   while (size--) {
52
   while (size--) {
52
     uint8_t v = *value;
53
     uint8_t v = *value;
53
     uint8_t * const p = (uint8_t * const)pos;
54
     uint8_t * const p = (uint8_t * const)pos;
55
     // so only write bytes that have changed!
56
     // so only write bytes that have changed!
56
     if (v != eeprom_read_byte(p)) {
57
     if (v != eeprom_read_byte(p)) {
57
       eeprom_write_byte(p, v);
58
       eeprom_write_byte(p, v);
58
-      if (size & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
59
+      if (++written & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
59
       if (eeprom_read_byte(p) != v) {
60
       if (eeprom_read_byte(p) != v) {
60
         SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
61
         SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
61
         return true;
62
         return true;

Loading…
Cancel
Save