void Memory::profilesToStringArray(String* s) { int i = 0; Profiles* iterator = profileContainerStart; while(iterator!=NULL) { s[i] = iterator->getName(); iterator = iterator->getNextProfile(); i++; } const static PROGMEM String backString("Back"); s[i] = backString; }
void Memory::initProfileContainer() { profileContainerStart = new Profiles(NULL); PROFILE_CONTAINER_SIZE = EEPROM.read(MEMORY_SLOTS_BYTE); int i,j,k; Profiles* iterator = profileContainerStart; for(i=0;i<PROFILE_CONTAINER_SIZE;i++) { char tempProfileCharacterArray[9]; //profile names for(j=0;j<8;j++) { tempProfileCharacterArray[j] = (char)EEPROM.read(addressByteCounter++); } tempProfileCharacterArray[j]='\0'; String tempProfileName(tempProfileCharacterArray); iterator->setName(tempProfileName); //temperature iterator->setTemperature(EEPROM.read(addressByteCounter++)); //humidity iterator->setHumidity(EEPROM.read(addressByteCounter++)); iterator->setNextProfile(); iterator = iterator->getNextProfile(); } iterator->getPrevProfile()->setNextProfileToNULL(); }