Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: tools/battor_agent/battor_sample_converter.cc

Issue 1586173002: tools/battor_agent: Prints real BattOr samples instead of raw ones (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_eeprom
Patch Set: Fixed size_t build error Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/battor_agent/battor_sample_converter.cc
diff --git a/tools/battor_agent/battor_sample_converter.cc b/tools/battor_agent/battor_sample_converter.cc
index 499097a5ccd910f50547e01fcc9d6186a1898ce4..1de150829985af8b5101c3021f659d7df453fd72 100644
--- a/tools/battor_agent/battor_sample_converter.cc
+++ b/tools/battor_agent/battor_sample_converter.cc
@@ -51,8 +51,8 @@ BattOrSampleConverter::BattOrSampleConverter(
BattOrSampleConverter::~BattOrSampleConverter() {}
-BattOrSample BattOrSampleConverter::ToSample(
- const RawBattOrSample& sample) const {
+BattOrSample BattOrSampleConverter::ToSample(const RawBattOrSample& sample,
+ size_t sample_number) const {
// Subtract out the baseline current and voltage that the BattOr reads even
// when it's not attached to anything.
double current = ToUnitfulVoltage(sample.current_raw) - baseline_current_;
@@ -86,7 +86,9 @@ BattOrSample BattOrSampleConverter::ToSample(
current -= eeprom_.low_gain_correction_offset;
current /= eeprom_.low_gain_correction_factor;
- return BattOrSample{voltage, current};
+ double time_ms = double(sample_number) / eeprom_.sd_sample_rate * 1000;
+
+ return BattOrSample{time_ms, voltage, current};
}
} // namespace battor
« no previous file with comments | « tools/battor_agent/battor_sample_converter.h ('k') | tools/battor_agent/battor_sample_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698