summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorkrolyxon <me@krolyxon.com>2026-05-14 23:14:31 +0530
committerkrolyxon <me@krolyxon.com>2026-05-14 23:14:31 +0530
commit206ed229198be252a9ae94342b39618aaab55925 (patch)
tree06d2ad100372c595974f1c6dcb1cd23ccdd26207 /src/utils
parent3672abc8b44c50ab344aeaf3c720c8502ccc128d (diff)
apply code formatting
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/buttons.cpp17
-rw-r--r--src/utils/sysinfo.cpp119
2 files changed, 66 insertions, 70 deletions
diff --git a/src/utils/buttons.cpp b/src/utils/buttons.cpp
index d3d1020..1e93150 100644
--- a/src/utils/buttons.cpp
+++ b/src/utils/buttons.cpp
@@ -1,15 +1,14 @@
#include "buttons.h"
-#include <Arduino.h>
#include "../config.h"
+#include <Arduino.h>
-void buttonsInit()
-{
- pinMode(BTN_UP, INPUT_PULLUP);
- pinMode(BTN_DOWN, INPUT_PULLUP);
- pinMode(BTN_SELECT, INPUT_PULLUP);
- pinMode(BTN_BACK, INPUT_PULLUP);
- pinMode(BTN_RIGHT, INPUT_PULLUP);
- pinMode(BTN_LEFT, INPUT_PULLUP);
+void buttonsInit() {
+ pinMode(BTN_UP, INPUT_PULLUP);
+ pinMode(BTN_DOWN, INPUT_PULLUP);
+ pinMode(BTN_SELECT, INPUT_PULLUP);
+ pinMode(BTN_BACK, INPUT_PULLUP);
+ pinMode(BTN_RIGHT, INPUT_PULLUP);
+ pinMode(BTN_LEFT, INPUT_PULLUP);
}
bool btnUp() { return !digitalRead(BTN_UP); }
diff --git a/src/utils/sysinfo.cpp b/src/utils/sysinfo.cpp
index aad170d..a852aad 100644
--- a/src/utils/sysinfo.cpp
+++ b/src/utils/sysinfo.cpp
@@ -1,87 +1,84 @@
-#include <Arduino.h>
#include "../ui/display.h"
#include "buttons.h"
+#include <Arduino.h>
#include <esp_chip_info.h>
#include <esp_heap_caps.h>
-void runSystemInfoFeature()
-{
- esp_chip_info_t chip_info;
-
- esp_chip_info(&chip_info);
+void runSystemInfoFeature() {
+ esp_chip_info_t chip_info;
- while (true)
- {
- //u8g2.clearBuffer();
+ esp_chip_info(&chip_info);
- //char buf[32];
+ while (true) {
+ // u8g2.clearBuffer();
- //sprintf(buf, "Cores: %d", chip_info.cores);
- //u8g2.drawStr(0, 14, buf);
+ // char buf[32];
- //sprintf(buf, "Heap: %d",
- // heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
- //u8g2.drawStr(0, 28, buf);
+ // sprintf(buf, "Cores: %d", chip_info.cores);
+ // u8g2.drawStr(0, 14, buf);
+ // sprintf(buf, "Heap: %d",
+ // heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
+ // u8g2.drawStr(0, 28, buf);
- //u8g2.drawStr(0, 60, "BACK to exit");
+ // u8g2.drawStr(0, 60, "BACK to exit");
- // Get RAM info
- size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT);
- size_t totalHeap = heap_caps_get_total_size(MALLOC_CAP_DEFAULT);
- int ramUsage = 100 - ((freeHeap * 100) / totalHeap);
+ // Get RAM info
+ size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT);
+ size_t totalHeap = heap_caps_get_total_size(MALLOC_CAP_DEFAULT);
+ int ramUsage = 100 - ((freeHeap * 100) / totalHeap);
- // Get Flash info
- //uint32_t flashSize = spi_flash_get_chip_size();
- uint32_t flashSize = ESP.getFlashChipSize();
- uint32_t flashUsed = ESP.getSketchSize();
- int flashUsage = (flashUsed * 100) / flashSize;
+ // Get Flash info
+ // uint32_t flashSize = spi_flash_get_chip_size();
+ uint32_t flashSize = ESP.getFlashChipSize();
+ uint32_t flashUsed = ESP.getSketchSize();
+ int flashUsage = (flashUsed * 100) / flashSize;
- // Temperature (approx)
- uint8_t temperature = temperatureRead();
+ // Temperature (approx)
+ uint8_t temperature = temperatureRead();
- // Chip info
- esp_chip_info_t chip_info;
- esp_chip_info(&chip_info);
-
- u8g2.clearBuffer();
- u8g2.setFont(u8g2_font_6x12_tr);
+ // Chip info
+ esp_chip_info_t chip_info;
+ esp_chip_info(&chip_info);
- char buf[32];
+ u8g2.clearBuffer();
+ u8g2.setFont(u8g2_font_6x12_tr);
- // Box 1 - RAM
- u8g2.drawFrame(0, 0, 128, 12);
- sprintf(buf, "RAM: %d%% used", ramUsage);
- u8g2.drawStr(4, 9, buf);
+ char buf[32];
- // Box 2 - Flash
- u8g2.drawFrame(0, 12, 128, 12);
- sprintf(buf, "Flash: %d%% used", flashUsage);
- u8g2.drawStr(4, 21, buf);
+ // Box 1 - RAM
+ u8g2.drawFrame(0, 0, 128, 12);
+ sprintf(buf, "RAM: %d%% used", ramUsage);
+ u8g2.drawStr(4, 9, buf);
- // Box 3 - Temp (FULL WIDTH now)
- u8g2.drawFrame(0, 24, 128, 12);
- sprintf(buf, "Temp: %d C", temperature);
- u8g2.drawStr(4, 33, buf);
+ // Box 2 - Flash
+ u8g2.drawFrame(0, 12, 128, 12);
+ sprintf(buf, "Flash: %d%% used", flashUsage);
+ u8g2.drawStr(4, 21, buf);
- // Box 4 - Chip info (FULL WIDTH)
- u8g2.drawFrame(0, 36, 128, 12);
- sprintf(buf, "Cores: %d Rev: %d", chip_info.cores, chip_info.revision);
- u8g2.drawStr(4, 45, buf);
+ // Box 3 - Temp (FULL WIDTH now)
+ u8g2.drawFrame(0, 24, 128, 12);
+ sprintf(buf, "Temp: %d C", temperature);
+ u8g2.drawStr(4, 33, buf);
- // Box 5 - PSRAM (KB)
- u8g2.drawFrame(0, 48, 128, 12);
- sprintf(buf, "PSRAM: %lu KB", heap_caps_get_free_size(MALLOC_CAP_SPIRAM) / 1024);
- u8g2.drawStr(4, 57, buf);
+ // Box 4 - Chip info (FULL WIDTH)
+ u8g2.drawFrame(0, 36, 128, 12);
+ sprintf(buf, "Cores: %d Rev: %d", chip_info.cores, chip_info.revision);
+ u8g2.drawStr(4, 45, buf);
- u8g2.sendBuffer();
+ // Box 5 - PSRAM (KB)
+ u8g2.drawFrame(0, 48, 128, 12);
+ sprintf(buf, "PSRAM: %lu KB",
+ heap_caps_get_free_size(MALLOC_CAP_SPIRAM) / 1024);
+ u8g2.drawStr(4, 57, buf);
- if (btnBack())
- {
- delay(200);
- return;
- }
+ u8g2.sendBuffer();
- delay(100);
+ if (btnBack()) {
+ delay(200);
+ return;
}
+
+ delay(100);
+ }
}