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

Side by Side Diff: tools/battor_agent/battor_agent.cc

Issue 1675503002: tools/battor_agent: Increases the time given for BattOr reset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improves comment Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/battor_agent/battor_agent.h" 5 #include "tools/battor_agent/battor_agent.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 void BattOrAgent::OnBytesSent(bool success) { 163 void BattOrAgent::OnBytesSent(bool success) {
164 DCHECK(thread_checker_.CalledOnValidThread()); 164 DCHECK(thread_checker_.CalledOnValidThread());
165 165
166 if (!success) { 166 if (!success) {
167 CompleteCommand(BATTOR_ERROR_SEND_ERROR); 167 CompleteCommand(BATTOR_ERROR_SEND_ERROR);
168 return; 168 return;
169 } 169 }
170 170
171 switch (last_action_) { 171 switch (last_action_) {
172 case Action::SEND_RESET: 172 case Action::SEND_RESET:
173 // TODO(charliea): Ideally, we'd just like to send an init, and the BattOr
174 // firmware can handle whether a reset is necessary or not, sending an
175 // init ack regardless. This reset can be removed once this is true.
176 // https://github.com/aschulm/battor/issues/30 tracks this.
177
173 // Wait for the reset to happen before sending the init message. 178 // Wait for the reset to happen before sending the init message.
174 PerformDelayedAction(Action::SEND_INIT, base::TimeDelta::FromSeconds( 179 PerformDelayedAction(Action::SEND_INIT, base::TimeDelta::FromSeconds(
175 kBattOrResetTimeSeconds)); 180 kBattOrResetTimeSeconds));
176 return; 181 return;
177 case Action::SEND_INIT: 182 case Action::SEND_INIT:
178 PerformAction(Action::READ_INIT_ACK); 183 PerformAction(Action::READ_INIT_ACK);
179 return; 184 return;
180 case Action::SEND_SET_GAIN: 185 case Action::SEND_SET_GAIN:
181 PerformAction(Action::READ_SET_GAIN_ACK); 186 PerformAction(Action::READ_SET_GAIN_ACK);
182 return; 187 return;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 BattOrSample sample = converter.ToSample(samples_[i], i); 459 BattOrSample sample = converter.ToSample(samples_[i], i);
455 trace_stream << std::setprecision(2) << sample.time_ms << " " 460 trace_stream << std::setprecision(2) << sample.time_ms << " "
456 << std::setprecision(1) << sample.current_mA << " " 461 << std::setprecision(1) << sample.current_mA << " "
457 << sample.voltage_mV << std::endl; 462 << sample.voltage_mV << std::endl;
458 } 463 }
459 464
460 return trace_stream.str(); 465 return trace_stream.str();
461 } 466 }
462 467
463 } // namespace battor 468 } // namespace battor
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698