Fix hostblock
This commit is contained in:
@@ -16,6 +16,11 @@ namespace display::ui::hostblock
|
||||
CPU_BAR_HEIGHT,
|
||||
display::ui::bar::Orientation::Vertical,
|
||||
display::ui::bar::Style{display::graphics::Color{40, 40, 40}, display::graphics::Color{0, 180, 0}, display::graphics::Color{80, 80, 80}, true}),
|
||||
cpuTempBar(
|
||||
CPU_BAR_TEMP_WIDTH,
|
||||
CPU_BAR_HEIGHT,
|
||||
display::ui::bar::Orientation::Vertical,
|
||||
display::ui::bar::Style{display::graphics::Color{40, 40, 40}, display::graphics::Color{0, 180, 0}, display::graphics::Color{80, 80, 80}, true}),
|
||||
memBar(
|
||||
BLOCK_WIDTH - PADDING * 2,
|
||||
MEM_BAR_HEIGHT,
|
||||
@@ -69,7 +74,7 @@ namespace display::ui::hostblock
|
||||
int col = i % CPU_MAX_PER_ROW;
|
||||
|
||||
int bx = x + PADDING +
|
||||
col * (CPU_BAR_WIDTH + CPU_BAR_GAP);
|
||||
col * (CPU_BAR_WIDTH + CPU_BAR_TEMP_WIDTH - 1 + CPU_BAR_GAP);
|
||||
|
||||
int by = cursorY +
|
||||
row * (CPU_BAR_HEIGHT + CPU_BAR_GAP);
|
||||
@@ -77,6 +82,10 @@ namespace display::ui::hostblock
|
||||
float value = std::clamp(metrics.cpu.coreLoads[i] / 100.0f, 0.0f, 1.0f);
|
||||
|
||||
cpuBar.draw(fb, bx, by, value);
|
||||
|
||||
value = std::clamp(metrics.cpu.coreTemps[i].current / metrics.cpu.coreTemps[i].max, 0.0f, 1.0f);
|
||||
|
||||
cpuTempBar.draw(fb, bx + CPU_BAR_WIDTH - 1, by, value);
|
||||
}
|
||||
|
||||
cursorY += CPU_ROWS * CPU_BAR_HEIGHT +
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace display::ui::hostblock
|
||||
constexpr int SECTION_GAP = 4; // 4
|
||||
|
||||
// ===== CPU bars =====
|
||||
constexpr int CPU_BAR_WIDTH = 10; // 10
|
||||
constexpr int CPU_BAR_WIDTH = 8; // 10
|
||||
constexpr int CPU_BAR_TEMP_WIDTH = 3;
|
||||
constexpr int CPU_BAR_GAP = 4; // 4
|
||||
constexpr int CPU_BAR_HEIGHT = 16; // 16
|
||||
constexpr int CPU_MAX_PER_ROW = 8; // 8
|
||||
@@ -49,6 +50,7 @@ namespace display::ui::hostblock
|
||||
|
||||
private:
|
||||
display::ui::bar::Bar cpuBar;
|
||||
display::ui::bar::Bar cpuTempBar;
|
||||
display::ui::bar::Bar memBar;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user