Skip to content

Commit

Permalink
fix: battery print error interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouYixun committed Dec 16, 2022
1 parent d9f5bc7 commit c14dfc4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/entity/batteryInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ func (battery *Battery) AnalyzeBatteryData(batteryData map[string]interface{}) e
func (battery Battery) ToString() string {
var s strings.Builder
s.WriteString(fmt.Sprintf("Serial:%s\n", battery.Serial))
s.WriteString(fmt.Sprintf("Temperature:%d\n", battery.Temperature))
s.WriteString(fmt.Sprintf("CycleCount:%d\n", battery.CycleCount))
s.WriteString(fmt.Sprintf("Temperature:%v\n", battery.Temperature))
s.WriteString(fmt.Sprintf("CycleCount:%v\n", battery.CycleCount))

s.WriteString(fmt.Sprintf("NominalChargeCapacity:%dmAh\n", battery.NominalChargeCapacity))
s.WriteString(fmt.Sprintf("DesignCapacity:%dmAh\n", battery.DesignCapacity))
s.WriteString(fmt.Sprintf("AbsoluteCapacity:%dmAh\n", battery.AbsoluteCapacity))
s.WriteString(fmt.Sprintf("CurrentCapacity:%d\n", battery.CurrentCapacity))
s.WriteString(fmt.Sprintf("NominalChargeCapacity:%vmAh\n", battery.NominalChargeCapacity))
s.WriteString(fmt.Sprintf("DesignCapacity:%vmAh\n", battery.DesignCapacity))
s.WriteString(fmt.Sprintf("AbsoluteCapacity:%vmAh\n", battery.AbsoluteCapacity))
s.WriteString(fmt.Sprintf("CurrentCapacity:%v\n", battery.CurrentCapacity))

s.WriteString(fmt.Sprintf("Voltage:%dmV\nBootVoltage:%dmV\n", battery.Voltage, battery.BootVoltage))
s.WriteString(fmt.Sprintf("InstantAmperage:%dmA\nAdapterDetailsVoltage:%dmV\n", battery.InstantAmperage, battery.AdapterDetailsVoltage))
s.WriteString(fmt.Sprintf("AdapterDetailsWatts:%dW", battery.AdapterDetailsWatts))
s.WriteString(fmt.Sprintf("Voltage:%vmV\nBootVoltage:%vmV\n", battery.Voltage, battery.BootVoltage))
s.WriteString(fmt.Sprintf("InstantAmperage:%vmA\nAdapterDetailsVoltage:%vmV\n", battery.InstantAmperage, battery.AdapterDetailsVoltage))
s.WriteString(fmt.Sprintf("AdapterDetailsWatts:%vW", battery.AdapterDetailsWatts))
return s.String()
}

Expand Down

0 comments on commit c14dfc4

Please sign in to comment.