123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- void getEEPROMContent() {
- int eeprom_address = 0;
- byte eeprom_value;
- Serial.println(F("EEPROM-Data:"));
- Serial.println(F("ADDR\t0\t1\t2\t3\t4\t5\t6\t7"));
- int col = 0;
- for (int i = 0; i < EEPROM.length(); i++) {
- eeprom_value = EEPROM.read(eeprom_address);
- if (col == 0) {
- Serial.print(eeprom_address);
- Serial.print("\t");
- }
- Serial.print(eeprom_value, DEC);
- Serial.print("\t");
- eeprom_address = eeprom_address + 1;
- if (col >= 7) {
- col = 0;
- Serial.println();
- }
- else col++;
- }
- }
- void formatEEPROMArea(int _from, int _len) {
- int _to;
- _to = _from + _len - 1;
- Serial.print(F("EEPROM - formatting area from "));
- Serial.print(_from);
- Serial.print(F(" to "));
- Serial.println(_to);
- for (int i = _from; i <= _to; i++) {
- Serial.print(".");
- EEPROM.update(i, 0);
- }
- Serial.println("DONE");
- }
- void formatEEPROM_AllData() {
- for (byte i = 0; i < COUNTERS_COUNT; i++) {
- formatEEPROMArea(eeprom_addr_area_start_currentReadingImpulses[i], eeprom_addr_area_length_currentReadingImpulses[i]);
- formatEEPROMArea(eeprom_addr_currentReading[i], 4);
- formatEEPROMArea(eeprom_addr_currentReading_backup1[i], 4);
- formatEEPROMArea(eeprom_addr_currentReading_backup2[i], 4);
- }
- }
- void formatEEPROMAreaOfCounter(byte _cNum) {
- if (_cNum >= 0 && _cNum < COUNTERS_COUNT) {
- formatEEPROMArea(eeprom_addr_currentReading[_cNum], 4);
- formatEEPROMArea(eeprom_addr_currentReading_backup1[_cNum], 4);
- formatEEPROMArea(eeprom_addr_currentReading_backup2[_cNum], 4);
- formatEEPROMArea(eeprom_addr_area_start_currentReadingImpulses[_cNum], eeprom_addr_area_length_currentReadingImpulses[_cNum]);
- eeprom_nextoffset_currentReadingImpulses[_cNum] = 0;
- eeprom_writecounter_currentReadingImpulses[_cNum] = 1;
- }
- }
|