cmaglie / FlashStorage

A convenient way to store data into Flash memory on the ATSAMD21 and ATSAMD51 processor family
202 stars 69 forks source link

error: 'class EEPROMClass' has no member named 'get' or 'put' #25

Open StefanMeGit opened 6 years ago

StefanMeGit commented 6 years ago

Hi! I try to port some code form an Arduino Nano to an Feather M0 Cortex. I run into a problem with the get and put function. Is it not possible to use?

I run with #include <FlashAsEEPROM.h>

void loadEEPROMSettings() {
  // Load settings from EEPROM to custom struct
  EEPROM.get(0, txSettings);

  bool rewriteSettings = false;

  // Loop through all settings to check if everything is fine
  for (uint8_t i = 0; i < numOfSettings; i++) { 

    // If setting default value is -1, don't check if its valid
    if( rules[i][0] != -1 ){

      short val = getSettingValue(i);

      if (! inRange(val, rules[i][1], rules[i][2])) {
        // Setting is damaged or never written. Rewrite default.
        rewriteSettings = true;
        setSettingValue(i, rules[i][0] );
      }
    }
  }

  if(txSettings.firmVersion != VERSION){

    setDefaultEEPROMSettings();

  }
  else if (rewriteSettings == true) {
    updateEEPROMSettings();
  }

  // Calculate constants
  calculateRatios();

}

/* 
 * Write settings to the EEPROM then exiting settings menu.
 */
void updateEEPROMSettings() {
  EEPROM.put(0, txSettings);
  calculateRatios();
}
ZachAllenVisuals commented 5 years ago

I have no idea if this applies to you, but I had strange behaviors when I was using the Arduino IDE provided by the Synaptic Package Manager on Linux, and it was fixed by downloading and installing from arduino.cc.