clangify includes

This commit is contained in:
Drath
2025-10-29 01:26:47 +01:00
parent 33f343fa0a
commit 68cd4b0bfe
12 changed files with 63 additions and 53 deletions

View File

@@ -4,16 +4,8 @@
#define LCD_LINES 4
#define LCD_COLS 40
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include <array>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <log.hpp>
#include <sstream>
#include <string>
class LCDDisplay {
@@ -23,8 +15,7 @@ class LCDDisplay {
char writebuf[LCD_LINES * LCD_COLS + 8]; // 4x40 chars + 2x4 setcursor commands
static constexpr bool dualDisp = (LCD_LINES * LCD_COLS > 80); // is it dual display device or not, evauluated from the size at compile time
void writeLines(std::array<std::string, 4> lines); // do not use
public:
LCDDisplay(std::string dev, uint32_t baud = 0010002); // from termios-baud.h, B115200
~LCDDisplay();

View File

@@ -1,12 +1,8 @@
#ifndef CPU_HPP
#define CPU_HPP
#include <chrono>
#include <cstdint>
#include <filesystem>
#include <log.hpp>
#include <string>
#include <utils.hpp>
#define N_CPU 16

View File

@@ -2,11 +2,8 @@
#define GPU_HPP
#include <cstdint>
#include <fstream>
#include <gpu_metrics.hpp>
#include <log.hpp>
#include <string>
#include <utils.hpp>
#define REL_METRICS_PATH "/../../gpu_metrics" // gpu_metrics path relative to hwmon path
#define MAX_METRICS_LENGTH 512 // length of the metrics buffer

View File

@@ -3,9 +3,7 @@
#include <libwebsockets.h>
#include <ArduinoJson.hpp>
#include <iostream>
#include <log.hpp>
#include <cstdint>
#include <string>
#define HASS_TOKEN "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0MzUxMTZiY2VjNTg0MTI3OGI4YmU0NTY4ZGQ5MzIyYiIsImlhdCI6MTc1NzQzMDI0MCwiZXhwIjoyMDcyNzkwMjQwfQ.6wKTlxEA0FLWfv-qW35vewUSvTxdVrZWqFwHT5Khu6E"
@@ -16,10 +14,10 @@ class HomeAssistant {
std::string entity;
uint16_t id = 2;
std::string tx;
struct lws_context *context = NULL;
lws *websock = NULL;
void event_handler(struct lws *wsi, enum lws_callback_reasons reason, char *in);
static int callback(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len);
struct lws_context* context = NULL;
lws* websock = NULL;
void event_handler(struct lws* wsi, enum lws_callback_reasons reason, char* in);
static int callback(struct lws* wsi, enum lws_callback_reasons reason, void* user, void* in, size_t len);
public:
HomeAssistant(std::string addr, std::string ent);

View File

@@ -11,8 +11,8 @@ const char wdays[][4] = {"Nie", "Pon", "Wto", "Sro", "Czw", "Pia", "Sob"};
struct sysSensors {
std::string hwmon = "";
uint16_t fan_speed[2] = {0}; // left and right cpu fans
uint8_t t_sensor = 0; // ntc temp sensor
uint16_t fan_speed[2] = {0}; // left and right cpu fans
uint8_t t_sensor = 0; // ntc temp sensor
};
struct Memory {

View File

@@ -1,17 +1,9 @@
#ifndef UTILS_HPP
#define UTILS_HPP
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <cstdint>
#include <cstdlib>
#include <filesystem>
#include <format>
#include <log.hpp>
#include <string>
#include <string_view>
#define FILL_CHAR ' '
@@ -22,8 +14,8 @@ std::string pad(std::string s, uint8_t len, bool ljust = false);
std::string center(std::string str, uint8_t len);
std::string pBytes(double bytes, bool isKbytes = false);
std::string readFile(std::string path, size_t trim = 4096);
ssize_t readFile2(std::string path, char *buffer, size_t maxlen);
ssize_t readFile2(const char *path, char *buffer, size_t maxlen);
ssize_t readFile2(std::string path, char* buffer, size_t maxlen);
ssize_t readFile2(const char* path, char* buffer, size_t maxlen);
int get_val(std::string_view target, std::string_view content);
std::string getFirstDir(std::string_view path);