Skip to content
Snippets Groups Projects
Commit 6598f201 authored by dawehr's avatar dawehr
Browse files

Fixed bug with logging. Was accidentally writing rows by 4 rather than by 1,...

Fixed bug with logging. Was accidentally writing rows by 4 rather than by 1, and would write beyond the limits.
Also properly initializing the initial value of the hw_unix_timer so Valgrind doesn't complain.
parent 404dd2bd
No related branches found
No related tags found
No related merge requests found
......@@ -138,7 +138,7 @@ int log_data(log_t* log_struct, parameter_t* ps)
{
return 1;
}
float* thisRow = &logArray[arrayIndex * row_size * sizeof(float)];
float* thisRow = &logArray[arrayIndex * row_size];
int offset = 0;
thisRow[offset++] = log_struct->time_stamp;
thisRow[offset++] = log_struct->gam.accel_x;
......@@ -234,7 +234,7 @@ void format_log(int idx, log_t* log_struct, struct str* buf) {
int i;
buf->size = 0;
float* row = &logArray[idx * row_size * sizeof(float)];\
float* row = &logArray[idx * row_size];\
safe_sprintf_cat(buf, "%f", row[0]);
for (i = 1; i < row_size; i++) {
......
......@@ -4,6 +4,9 @@ int unix_global_timer_reset(struct TimerDriver *self) {
if (self->state == NULL) {
self->state = malloc(sizeof(struct timeval));
}
struct timezone tz;
struct timeval *start = self->state;
gettimeofday(start, &tz);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment