17 standardMessage(
"🧪 Starting EEPROM diagnostic", __FILE__, __FUNCTION__, __DATE__, __TIME__);
24 byte readValue = EEPROM.read(address);
25 Serial.print(
"📥 Value read from EEPROM[");
26 Serial.print(address);
28 Serial.println(readValue);
32 Serial.print(
"📊 Estimated free memory: ");
33 Serial.print(freeMem);
34 Serial.println(
" bytes");
36 Serial.print(
"📦 Estimated used memory: ");
37 Serial.print(RAMEND - freeMem);
38 Serial.println(
" bytes");
42 Serial.println(
"✅ EEPROM is responding correctly.");
44 standardHeaderFull(
"EEPROM diagnostic completed", __FILE__, __FUNCTION__, __DATE__, __TIME__);
47 Serial.println(
"❌ EEPROM error: value mismatch.");
49 standardHeaderFull(
"EEPROM diagnostic failed", __FILE__, __FUNCTION__, __DATE__, __TIME__);
63 EEPROM.write(address, 0xFF);
66 byte clearedValue = EEPROM.read(address);
67 Serial.print(
"🧹 EEPROM cleared. New value at [");
68 Serial.print(address);
70 Serial.println(clearedValue);
83 extern unsigned int __heap_start;
84 extern void *__brkval;
87 if ((
int)__brkval == 0) {
88 freeMemory = ((int)&freeMemory) - ((
int)&__heap_start);
90 freeMemory = ((int)&freeMemory) - ((
int)__brkval);
static int getFreeMemory()
Estimates the amount of free RAM available on the system. Works on AVR-based boards like Arduino Mega...
static const byte testValue
Value used for EEPROM testing.
static void clearEEPROM(int address)
Clears the EEPROM at the specified address by writing 0xFF.
static bool runTest(int address=0)
Runs a diagnostic test on the EEPROM at the specified address. Writes a test value,...
void standardMessage(const char *message, const char *file, const char *function, const char *date, const char *time)
Prints an enriched log message to the serial monitor.
void standardHeaderFull(const char *message, const char *file, const char *function, const char *date, const char *time, uint16_t width=120, char deco='-')
Prints a decorated header with centered text and padding on both sides.