VibTest: fixed sample count output on console

This commit is contained in:
Andrew Tridgell 2014-07-08 10:23:56 +10:00
parent c1d1406c59
commit d50d5b8f24

View File

@ -138,6 +138,7 @@ void loop(void)
}; };
DataFlash.WriteBlock(&pkt, sizeof(pkt)); DataFlash.WriteBlock(&pkt, sizeof(pkt));
got_sample = true; got_sample = true;
total_samples[i]++;
} }
if (gyro_fd[i] != -1 && ::read(gyro_fd[i], &gyro_report, sizeof(gyro_report)) == if (gyro_fd[i] != -1 && ::read(gyro_fd[i], &gyro_report, sizeof(gyro_report)) ==
sizeof(gyro_report) && sizeof(gyro_report) &&
@ -154,16 +155,16 @@ void loop(void)
}; };
DataFlash.WriteBlock(&pkt, sizeof(pkt)); DataFlash.WriteBlock(&pkt, sizeof(pkt));
got_sample = true; got_sample = true;
total_samples[i]++;
}
} }
if (got_sample) { if (got_sample) {
total_samples[i]++; if (total_samples[0] % 2000 == 0) {
if (total_samples[i] % 2000 == 0) {
hal.console->printf("t=%lu total_samples=%lu/%lu/%lu\n", hal.console->printf("t=%lu total_samples=%lu/%lu/%lu\n",
hal.scheduler->millis(), hal.scheduler->millis(),
total_samples[0], total_samples[1],total_samples[2]); total_samples[0], total_samples[1],total_samples[2]);
} }
} }
}
} while (got_sample); } while (got_sample);
hal.scheduler->delay_microseconds(200); hal.scheduler->delay_microseconds(200);
} }