zd880105132 / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Log read issue #66

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. switch  to read log 

What is the expected output? What do you see instead?
display only the log file needed

What version of the product are you using? On what operating system?
current svn r778

Please provide any additional information below.
DataFlash.GetPage() gives -1 when arriving at the end of log.
When arriving at the end it start again from start and never ends

line 514 of Log.pde 
    while (DataFlash.GetPage() < end_page )

should be replace by 

      int page = DataFlash.GetPage();
    while (page < end_page && page != -1)

Original issue reported on code.google.com by mbada...@gmail.com on 1 Sep 2010 at 7:42

GoogleCodeExporter commented 8 years ago
sorry forgot to add you need to put
                  page = DataFlash.GetPage();
        }
at the end of the loop .. obviously 8)

Original comment by mbada...@gmail.com on 1 Sep 2010 at 7:44

GoogleCodeExporter commented 8 years ago
@mbadaire - I do not see that the DataFlash.GetPage() call will return -1 and 
have not been able to duplicate this problem.

Did you take the step of erasing the logs before using them the first time?  If 
not there will be erroneous data in the start and stop page memory locations.

If you did take this step can you give me some additional information that may 
help me duplicate this problem?

Thanks, 
Doug

Original comment by dewei...@gmail.com on 1 Sep 2010 at 11:01

GoogleCodeExporter commented 8 years ago
I had emptied the logs once but now my logs were full.If the logs are full then 
getPage will bring back -1 and not 4096 :
extract from DataFlash.cpp
http://code.google.com/p/arducopter/source/browse/trunk/libraries/DataFlash/Data
Flash.cpp
int DataFlash_Class::GetPage() 
{
  return(df_Read_PageAdr-1);
}

byte DataFlash_Class::ReadByte()
...
    if (df_Read_PageAdr>=4096)  // If we reach the end of the memory, start from the begining
      {
      df_Read_PageAdr = 0;
      df_Read_END = true;
      }
...

Original comment by mbada...@gmail.com on 2 Sep 2010 at 7:54

GoogleCodeExporter commented 8 years ago
@mbadaire - ah, thank you, missed that the first time.  

I will verify your suggested fix and implement it as soon as time permits.

Original comment by dewei...@gmail.com on 2 Sep 2010 at 11:06

GoogleCodeExporter commented 8 years ago
Fixed as recommended

Original comment by dewei...@gmail.com on 10 Sep 2010 at 5:39