Data not saved to EEPROM with the EDB library

Hi
I have a problem with the EDB library.
I’m trying to save some information , reset the system and then read it from memory. But every time I’m trying to read it I get zeroes in the read data!
In the “Save Mode” I activate the sketch below, save the data, read it in the same cycle, that’s step works ok.
But after restart when I activate only the “Read Mode” I get only zeroes.
Can’t understand what I’m doing wrong.
I’m using the arduino MEGA
Thanks
R.G

MYSKETCH

#include <Wire.h>
#include <L3G.h> //Gyro
#include “Arduino.h”
#include <EDB.h> //MEMORY
#include <LSM303.h> //Magnometer

// --------------Use the Internal Arduino EEPROM as storage-----------
#include <EEPROM.h>
#define TABLE_SIZE 4096
#define RECORDS_TO_CREATE 5

struct CallibratedValue
{
int motor_speed_A ;
int motor_speed_B ;
}
CallibratedValue;

// The read and write handlers for using the EEPROM Library
void writer(unsigned long address, byte data)
{
EEPROM.write(address, data);
}

byte reader(unsigned long address)
{
return EEPROM.read(address);
}

// Create an EDB object with the appropriate write and read handlers
EDB db(&writer, &reader);

void setup()
{
Creating Recrods
Serial.println(“Creating Records…”);
int recno;
for (recno = 1; recno <= RECORDS_TO_CREATE; recno++)
{
CallibratedValue.motor_speed_A = recno;
CallibratedValue.motor_speed_B = recno * 2;
db.appendRec(EDB_REC CallibratedValue);
}

Reading Records
Serial.print("Record Count: "); Serial.println(db.count());
for (int recno = 1; recno < RECORDS_TO_CREATE; recno++)
{
db.readRec(recno, EDB_REC CallibratedValue );
Serial.print("ID: "); Serial.println(CallibratedValue.motor_speed_A);
Serial.print("Temp: "); Serial.println(CallibratedValue.motor_speed_B);
}
}

Same problem. Did you fix it?

Hi,

I got the same problem and after a few hours of debugging I found a solution:
every time you use “db.create(0, TABLE_SIZE, sizeof(logEvent));” the table size is set to 0 so i figured out the “db.create” is meant to be used only once when you create the db, after that you have to use
the “db.open(0);” but there is another problem, when you open the db the “EDB_table_ptr” value is not set and it will not read any data correctly, so you have to open the EDB.cpp file and modify the “EDB::open” methos as the following:

EDB_Status EDB::open(unsigned long head_ptr)
{
EDB_head_ptr = head_ptr;
EDB_table_ptr = sizeof(EDB_Header) + EDB_head_ptr; // this line is added
readHead();
return EDB_OK;
}

hope it helps