Files
party-cam/include/printer_service.h
Gabriel Kaszewski 4ec723ef40 fix bugs, harden server, strip-based dithering, update docs
Firmware:
- fix 90° rotation (was transpose)
- fix Adafruit_Thermal constructor (spurious DTR pin arg)
- wire up uploadImage; heatInterval now applied
- PSRAM-free strip dithering: 2-row buffers (~1KB) replace 153KB PSRAM alloc
- consolidate all pins into config.h; BUTTON_PIN → Config::PIN_BUTTON
- constrain contrast/brightness/heat in settings save handler
- uploadImage size param int → size_t

Server:
- canonicalize upload_dir at startup (fixes path traversal guard)
- path traversal guard in serve_image
- replace unwrap in gallery_data with error handling
- IMAGE_WIDTH/IMAGE_HEIGHT named constants

Gallery:
- innerHTML → createElement (XSS-safe)
- encodeURIComponent on image URLs
- replace("_"," ") → regex /_/g

Docs: rewrite README, clarify GUEST_MANUAL placeholders
2026-06-18 11:23:05 +02:00

31 lines
660 B
C++

#pragma once
#include <Arduino.h>
#include <Adafruit_Thermal.h>
#include "config.h"
class PrinterService
{
private:
HardwareSerial *printerSerial;
Adafruit_Thermal *printer;
static PrinterService *instance;
PrinterService();
public:
PrinterService(const PrinterService &) = delete;
PrinterService &operator=(const PrinterService &) = delete;
static void init();
static PrinterService &getInstance();
void wake();
void sleep();
void feed(int lines);
void setHeat(uint8_t heatTime, uint8_t heatInterval);
void printBitmap(int w, int h, const uint8_t *bitmap);
void printText(const String &text);
};