jonny_jr9 ffac657199 Add abstracted functions for display - simplify code
Simple functions for printing a line normal, large or centered
using format string directly instead of having to use both
snprintf first and then display function all the time
This makes the code more readable and compact

Applied this optimization where applicable in manu.cpp and display.cpp
2024-02-15 23:24:41 +01:00

29 lines
968 B
C++

#pragma once
extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "ssd1306.h"
#include "font8x8_basic.h"
}
#include "config.hpp"
//task that inititialized the display, displays welcome message
//and releatedly updates the display with certain content
void display_task( void * pvParameters );
//abstracted function for printing one line on the display, using a format string directly
//and options: Large-font (3 lines, max 5 digits), or inverted color
void displayTextLine(SSD1306_t *display, int line, bool large, bool inverted, const char *format, ...);
//abstracted function for printing a string CENTERED on the display, using a format string
//adds spaces left and right to fill the line (if not too long already)
void displayTextLineCentered(SSD1306_t *display, int line, bool isLarge, bool inverted, const char *format, ...);