formatting shit

This commit is contained in:
2026-05-11 10:26:30 +00:00
parent 5b8708ad0c
commit c26ccba813
13 changed files with 259 additions and 219 deletions

View File

@@ -1,16 +1,16 @@
#include <signal.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <stdatomic.h>
#include <stdio.h>
#include <sys/signalfd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/signalfd.h>
#include <unistd.h>
#include "lcd.h"
#include "log.h"
#include "cpu.h"
#include "gpu.h"
#include "lcd.h"
#include "log.h"
#include "sys.h"
#include "utils.h"
@@ -38,7 +38,7 @@ struct sensors_t {
static void *sensors_thread(void *arg) {
applog(LOG_START, "sensors thread started, refresh interval is %dms", refresh_interval_ms);
struct sensors_t* sensors = arg;
struct sensors_t *sensors = arg;
struct timespec next;
clock_gettime(CLOCK_REALTIME, &next);
@@ -76,7 +76,7 @@ static void *sensors_thread(void *arg) {
static void *display_thread(void *arg) {
applog(LOG_START, "display thread started");
struct sensors_t* sensors = arg;
struct sensors_t *sensors = arg;
struct lcd_t lcd = {
.port = "/dev/serial/by-id/usb-Raspberry_Pi_Pico_E6616407E37AA12F-if00",
@@ -88,11 +88,11 @@ static void *display_thread(void *arg) {
// basic lcd setup
lcd_set_backlight(&lcd, true);
lcd_set_contrast(&lcd, 206);
lcd_set_custom_char(&lcd, 0, &(lcd_glyph_t){16, 6, 9, 8, 8, 9, 6, 0}); // celcius
lcd_set_custom_char(&lcd, 1, &(lcd_glyph_t){0, 0, 4, 10, 10, 17, 31, 0}); // delta
lcd_set_custom_char(&lcd, 2, &(lcd_glyph_t){0, 0, 8, 21, 21, 2, 0, 0}); // home (tilde)
lcd_set_custom_char(&lcd, 3, &(lcd_glyph_t){4, 14, 21, 4, 4, 4, 0}); // up arrow
lcd_set_custom_char(&lcd, 4, &(lcd_glyph_t){4, 4, 4, 21, 14, 4, 0}); // down arrow
lcd_set_custom_char(&lcd, 0, &(lcd_glyph_t){16, 6, 9, 8, 8, 9, 6, 0}); // celcius
lcd_set_custom_char(&lcd, 1, &(lcd_glyph_t){0, 0, 4, 10, 10, 17, 31, 0}); // delta
lcd_set_custom_char(&lcd, 2, &(lcd_glyph_t){0, 0, 8, 21, 21, 2, 0, 0}); // home (tilde)
lcd_set_custom_char(&lcd, 3, &(lcd_glyph_t){4, 14, 21, 4, 4, 4, 0}); // up arrow
lcd_set_custom_char(&lcd, 4, &(lcd_glyph_t){4, 4, 4, 21, 14, 4, 0}); // down arrow
lcd_write_buf(&lcd, 1, 9, "Waiting for sensors..."); // need to center this still
lcd_flush_buf(&lcd);
@@ -103,7 +103,7 @@ static void *display_thread(void *arg) {
clock_gettime(CLOCK_REALTIME, &ts);
timespec_add_ms(&ts, (uint16_t)(refresh_interval_ms * 1.25));
pthread_mutex_lock(&control.sensors_mtx); // lock sensor struct
pthread_mutex_lock(&control.sensors_mtx); // lock sensor struct
pthread_cond_timedwait(&control.sensors_ready, &control.sensors_mtx, &ts); // wait until data ready
// prepare some tricky sensors
@@ -154,6 +154,7 @@ static void *display_thread(void *arg) {
int main(void) {
control.g_running = true;
applog(LOG_START, "linuxSmartie started");
applog(LOG_DBG, "Compiled on %s %s with %s", __DATE__, __TIME__, C_STD);
/* signal setup */
sigset_t sigset;