fix to power display
This commit is contained in:
+5
-10
@@ -6,12 +6,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func RenderCPU(console *strings.Builder) {
|
||||
proc, err := proc.GetProc()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
func RenderCPU(console *strings.Builder, proc *proc.Proc) {
|
||||
// Move cursor to top-left (0,0) without clearing full buffer (flicker-free)
|
||||
console.WriteString("\033[H")
|
||||
console.WriteString(fmt.Sprintf("=== %s ===\n", proc.Model()))
|
||||
@@ -20,9 +15,9 @@ func RenderCPU(console *strings.Builder) {
|
||||
RenderPowerSensors(console, proc)
|
||||
}
|
||||
|
||||
func RenderTemperatureSensors(console *strings.Builder, proc proc.Proc) {
|
||||
func RenderTemperatureSensors(console *strings.Builder, proc *proc.Proc) {
|
||||
temps, _ := proc.SensorReader.ReadTemperatureSensors()
|
||||
console.WriteString("=== Temperature ===\n")
|
||||
console.WriteString("--- Temperature ---\n")
|
||||
for _, sensor := range temps {
|
||||
tempC := sensor.TempC
|
||||
tempF := (tempC * 9 / 5) + 32
|
||||
@@ -31,8 +26,8 @@ func RenderTemperatureSensors(console *strings.Builder, proc proc.Proc) {
|
||||
}
|
||||
}
|
||||
|
||||
func RenderPowerSensors(console *strings.Builder, proc proc.Proc) {
|
||||
console.WriteString("=== Power ===\n")
|
||||
func RenderPowerSensors(console *strings.Builder, proc *proc.Proc) {
|
||||
console.WriteString("--- Power ---\n")
|
||||
power, _ := proc.SensorReader.ReadPowerSensors()
|
||||
for _, sensor := range power {
|
||||
// \033[K clears from cursor to end of line (prevents lingering chars)
|
||||
|
||||
Reference in New Issue
Block a user