prettier screen
This commit is contained in:
37
main.cpp
37
main.cpp
@@ -94,40 +94,40 @@ void displayThread(std::stop_token st, Sensors* s) {
|
||||
|
||||
lcd.setContrast(LCD_CONTRAST);
|
||||
lcd.setBacklight(true);
|
||||
lcd.setCustomChar(0, {16, 6, 9, 8, 8, 9, 6, 0}); // celcius
|
||||
lcd.writeStr(2, 0, center("Waiting for sensors...", 40));
|
||||
|
||||
lcd.setCustomChar(0, {16, 6, 9, 8, 8, 9, 6, 0}); // celcius
|
||||
lcd.setCustomChar(1, {0, 0, 4, 10, 10, 17, 31, 0}); // delta
|
||||
lcd.setCustomChar(2, {0, 0, 8, 21, 2, 0, 0, 0}); // home (tilde)
|
||||
|
||||
while (!st.stop_requested()) {
|
||||
sem::display.acquire(); // holds the loop until sensor data is ready
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s->mtx);
|
||||
|
||||
std::string gpu_temps;
|
||||
// gpu_temps += pad("d" + std::to_string(s->gpu.temp_hotspot - s->gpu.temp_edge), 3, true) + lcd.cc[0];
|
||||
gpu_temps += std::to_string(s->gpu.temp_edge);
|
||||
gpu_temps += (s->gpu.temp_hotspot) ? "/" + std::to_string(s->gpu.temp_hotspot) : "";
|
||||
// gpu_temps += (s->gpu.temp_mem) ? "/" + std::to_string(s->gpu.temp_mem) : "";
|
||||
std::string gpu_temps = std::to_string(s->gpu.temp_edge);
|
||||
if (s->gpu.temp_hotspot)
|
||||
gpu_temps = pad(lcd.cc(1) + std::to_string(s->gpu.temp_hotspot - s->gpu.temp_edge) + lcd.cc(0), 4) + pad(gpu_temps + "/" + std::to_string(s->gpu.temp_hotspot), 6);
|
||||
|
||||
lcd.writeBuf(0, 0, pad(s->td.date, 11, true) + " " + s->td.time + lcd.bar(1, s->gpu.usage_core / 100.0) /* + pad(s->loadavg, 17)*/);
|
||||
lcd.writeBuf(0, 0, pad(s->td.date, 11, true) + " " + s->td.time + lcd.bar(7, s->gpu.usage_core / 100.0) /* + pad(s->loadavg, 17)*/);
|
||||
lcd.writeBuf(0, 26, pNum(s->avg[0], s->avg[0] > 10 ? 1 : 2));
|
||||
lcd.writeBuf(0, 31, pNum(s->avg[1], s->avg[1] > 10 ? 1 : 2));
|
||||
lcd.writeBuf(0, 36, pNum(s->avg[2], s->avg[2] > 10 ? 1 : 2));
|
||||
|
||||
lcd.writeBuf(1, 0, pad(std::to_string(s->cpu.tctl) + "/" + std::to_string(s->cpu.tccd1) + lcd.cc[0], 8, true));
|
||||
lcd.writeBuf(1, 0, pad(std::to_string(s->cpu.tctl) + "/" + std::to_string(s->cpu.tccd1) + lcd.cc(0), 8, true));
|
||||
lcd.writeBuf(1, 8, pad(pBytes(s->ram.used, true) + "B", 7, true));
|
||||
lcd.writeBuf(1, 20, pad(pBytes(s->gpu.vram_used) + "B", 7));
|
||||
if (s->gpu.temp_hotspot) lcd.writeBuf(1, 28, "d" + std::to_string(s->gpu.temp_hotspot - s->gpu.temp_edge) + lcd.cc[0] + " ");
|
||||
lcd.writeBuf(1, 32, pad(gpu_temps + lcd.cc[0], 8));
|
||||
lcd.writeBuf(1, 30 - gpu_temps.size(), pad(pBytes(s->gpu.vram_used) + "B", 7));
|
||||
lcd.writeBuf(1, 39 - gpu_temps.size(), gpu_temps + lcd.cc(0));
|
||||
|
||||
lcd.writeBuf(2, 0, pad(pNum(s->cpu.ptotal, 1) + "W", 8, true));
|
||||
lcd.writeBuf(2, 8, "home:" + pad(pBytes(s->home.free), 5));
|
||||
|
||||
lcd.writeBuf(2, 20, pad(std::to_string(s->gpu.fan_pwm) + "%", 4));
|
||||
lcd.writeBuf(2, 25, pad(std::to_string(s->gpu.fan_speed), 4) + "R");
|
||||
lcd.writeBuf(2, 7, lcd.cc(2) + pad(pBytes(s->home.free), 5));
|
||||
lcd.writeBuf(2, 16, pad(pNum(s->hass_state) + "W", 4));
|
||||
lcd.writeBuf(2, 21, pad(std::to_string(s->gpu.fan_pwm) + "%", 4));
|
||||
lcd.writeBuf(2, 26, pad(std::to_string(s->gpu.fan_speed) + "R", 5));
|
||||
lcd.writeBuf(2, 31, pad(std::to_string(s->gpu.power_avg) + "/" + std::to_string(s->gpu.power_cap) + "W", 9));
|
||||
|
||||
lcd.writeBuf(3, 0, pad(pNum(s->cpu.vcore, 3) + "V", 7, true));
|
||||
lcd.writeBuf(3, 7, std::to_string(s->cpu.avg_freq) + "MHz");
|
||||
lcd.writeBuf(3, 16, pad(pNum(s->hass_state) + "W", 4));
|
||||
lcd.writeBuf(3, 21, pad(std::to_string(s->gpu.clock_core) + "/" + std::to_string(s->gpu.clock_mem) + "MHz ", 13));
|
||||
lcd.writeBuf(3, 34, pad(pNum(s->gpu.vcore, 3) + "V", 5));
|
||||
}
|
||||
@@ -135,9 +135,8 @@ void displayThread(std::stop_token st, Sensors* s) {
|
||||
lcd.flushBuf();
|
||||
}
|
||||
|
||||
lcd.clearBuf();
|
||||
lcd.writeBuf(1, 10, "linuxSmartie closed");
|
||||
lcd.flushBuf();
|
||||
lcd.clear();
|
||||
lcd.writeStr(2, 0, center("linuxSmartie closed", 40));
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
Reference in New Issue
Block a user