summaryrefslogtreecommitdiff
path: root/board/poppy/board.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-10-05 16:55:49 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-12-21 20:33:02 -0800
commit6040852eb7df499b7d5c239b916e353e5c8a894e (patch)
treee73f3157ef28bf7bbba614b6712704337c90a854 /board/poppy/board.c
parent24018711127b64f97844e98dfbe6860f7f7cdb0a (diff)
downloadchrome-ec-6040852eb7df499b7d5c239b916e353e5c8a894e.tar.gz
poppy: Do not print base detection value if base stays connected
Reduces amount of spam during EC-EC communication. BRANCH=none BUG=b:65697962 TEST=Flash lux and wand, less spam on console Change-Id: Ie66a3d0f4711741bf3d605f13e7595373c5246f5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/725124 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/poppy/board.c')
-rw-r--r--board/poppy/board.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 8ce3c3a4b6..ce54be5e97 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -237,6 +237,11 @@ static int command_detach_base(int argc, char **argv)
DECLARE_CONSOLE_COMMAND(detachbase, command_detach_base,
NULL, "Simulate detach base");
+static void print_base_detect_value(int v, int tmp_pulse_width)
+{
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
+ v, tmp_pulse_width);
+}
static void base_detect_deferred(void)
{
@@ -253,14 +258,14 @@ static void base_detect_deferred(void)
v = adc_read_channel(ADC_BASE_DET);
if (v == ADC_READ_ERROR)
return;
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
if (v >= BASE_DETECT_MIN_MV && v <= BASE_DETECT_MAX_MV) {
if (current_base_status != BASE_CONNECTED) {
+ print_base_detect_value(v, tmp_pulse_width);
base_detect_change(BASE_CONNECTED);
} else if (tmp_pulse_width >= BASE_DETECT_PULSE_MIN_US &&
tmp_pulse_width <= BASE_DETECT_PULSE_MAX_US) {
+ print_base_detect_value(v, tmp_pulse_width);
CPRINTS("Sending event to AP");
host_set_single_event(EC_HOST_EVENT_KEY_PRESSED);
}
@@ -268,6 +273,9 @@ static void base_detect_deferred(void)
v <= BASE_DETECT_REVERSE_MAX_MV) ||
v >= BASE_DETECT_DISCONNECT_MIN_MV) {
/* TODO(b/35585396): Handle reverse connection separately. */
+
+ print_base_detect_value(v, tmp_pulse_width);
+
base_detect_change(BASE_DISCONNECTED);
} else {
/* Unclear base status, schedule again in a while. */