Skip to content

Conversation

labamichnetvoll
Copy link

@labamichnetvoll labamichnetvoll commented Sep 7, 2025

This pull request is using EEPROM.update() instead of EEPROM.write()

This change can save writing cycles to the EEPROM.

this is better because of:

Note: An EEPROM write takes 3.3 ms to complete. The EEPROM memory has a specified life of 100,000 write/erase cycles, so using this function instead of write() can save cycles if the written data does not change often

EEPROM Library -> update

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request improves EEPROM usage by replacing EEPROM.write() calls with EEPROM.update() to extend the EEPROM's lifespan by only writing when values actually change.

  • Replaces all EEPROM.write() calls with EEPROM.update() throughout the codebase
  • Preserves existing functionality while reducing unnecessary write cycles
  • Applies the optimization to configuration settings, state management, and user preference storage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

EEPROM.update(ADR_NM_END_H, DEFAULT_NM_END_HOUR);
EEPROM.update(ADR_NM_END_M, DEFAULT_NM_END_MIN);
EEPROM.update(ADR_BRIGHTNESS, DEFAULT_BRIGHTNESS);
setMainColor(DEFAULT_MC_RED, DEFAULT_MC_GREEN, DEFAULT_MC_BLUE);
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setMainColor function still uses EEPROM.put() instead of EEPROM.update(). For consistency with this PR's goal of optimizing EEPROM writes, consider updating setMainColor to use EEPROM.update() as well.

Copilot uses AI. Check for mistakes.

@labamichnetvoll
Copy link
Author

labamichnetvoll commented Sep 7, 2025

The PR actually looks unnecessary, since the library used already contains a built-in check.
this library doesn't use the EEPROM.update() function for this

Sorry for the ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant