reduced the charge v2 debug message size

Remove redudant struct names. Replace 2 spaces with a tab char.
This reduces 128 bytes in flash size.

BUG=chromium:374575
BRANCH=tot,nyan
TEST=Built and verified on big
% grep hey build/big/ec.RO.map
  0x000000000000ef48
After shrink:
  0x000000000000eec8

The output still is easy to read.
> chg
state = charge
ac = 1
chg.*:
        voltage = 13040mV
        current = 256mA
        input_current = 2048mA
        status = 0x10
        option = 0xf912
        flags = 0x0
batt.*:
        temperature = 20C
        state_of_charge = 0%
        voltage = 8253mV
        current = 274mA
        desired_voltage = 13050mV
        desired_current = 256mA
        flags = 0x3
        remaining_capacity = 0mAh
        full_capacity = 4026mAh
        is_present = YES
requested_voltage = 13040mV
requested_current = 256mA
force_idle = 0
manual_mode = 0
user_current_limit = -1mA
battery_seems_to_be_dead = 0
debug output = off

Change-Id: I82a3a5cda3fa96e247355dc90431691015eece6c
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200470
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Louis Yung-Chieh Lo
2014-05-19 12:28:39 -07:00
committed by chrome-internal-fetch
parent 8b428e2936
commit b287e7b344

View File

@@ -220,33 +220,37 @@ static const char * const batt_pres[] = {
static void dump_charge_state(void)
{
#define DUMP(FLD, FMT) ccprintf(" " #FLD " = " FMT "\n", curr.FLD)
ccprintf(" state = %s\n", state_list[curr.state]);
#define DUMP(FLD, FMT) ccprintf(#FLD " = " FMT "\n", curr.FLD)
#define DUMP_CHG(FLD, FMT) ccprintf("\t" #FLD " = " FMT "\n", curr.chg. FLD)
#define DUMP_BATT(FLD, FMT) ccprintf("\t" #FLD " = " FMT "\n", curr.batt. FLD)
ccprintf("state = %s\n", state_list[curr.state]);
DUMP(ac, "%d");
DUMP(chg.voltage, "%dmV");
DUMP(chg.current, "%dmA");
DUMP(chg.input_current, "%dmA");
DUMP(chg.status, "0x%x");
DUMP(chg.option, "0x%x");
DUMP(chg.flags, "0x%x");
ccprintf(" batt.temperature = %dC\n",
ccprintf("chg.*:\n");
DUMP_CHG(voltage, "%dmV");
DUMP_CHG(current, "%dmA");
DUMP_CHG(input_current, "%dmA");
DUMP_CHG(status, "0x%x");
DUMP_CHG(option, "0x%x");
DUMP_CHG(flags, "0x%x");
ccprintf("batt.*:\n");
ccprintf("\ttemperature = %dC\n",
DECI_KELVIN_TO_CELSIUS(curr.batt.temperature));
DUMP(batt.state_of_charge, "%d%%");
DUMP(batt.voltage, "%dmV");
DUMP(batt.current, "%dmA");
DUMP(batt.desired_voltage, "%dmV");
DUMP(batt.desired_current, "%dmA");
DUMP(batt.flags, "0x%x");
DUMP(batt.remaining_capacity, "%dmAh");
DUMP(batt.full_capacity, "%dmAh");
ccprintf(" batt.is_present = %s\n", batt_pres[curr.batt.is_present]);
DUMP_BATT(state_of_charge, "%d%%");
DUMP_BATT(voltage, "%dmV");
DUMP_BATT(current, "%dmA");
DUMP_BATT(desired_voltage, "%dmV");
DUMP_BATT(desired_current, "%dmA");
DUMP_BATT(flags, "0x%x");
DUMP_BATT(remaining_capacity, "%dmAh");
DUMP_BATT(full_capacity, "%dmAh");
ccprintf("\tis_present = %s\n", batt_pres[curr.batt.is_present]);
DUMP(requested_voltage, "%dmV");
DUMP(requested_current, "%dmA");
ccprintf(" force_idle = %d\n", state_machine_force_idle);
ccprintf(" manual_mode = %d\n", manual_mode);
ccprintf(" user_current_limit = %dmA\n", user_current_limit);
ccprintf(" battery_seems_to_be_dead = %d\n", battery_seems_to_be_dead);
ccprintf(" debug output = %s\n", debugging ? "on" : "off");
ccprintf("force_idle = %d\n", state_machine_force_idle);
ccprintf("manual_mode = %d\n", manual_mode);
ccprintf("user_current_limit = %dmA\n", user_current_limit);
ccprintf("battery_seems_to_be_dead = %d\n", battery_seems_to_be_dead);
ccprintf("debug output = %s\n", debugging ? "on" : "off");
#undef DUMP
}