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
This commit is contained in:
2026-06-18 11:23:05 +02:00
parent 2f827c168d
commit 4ec723ef40
12 changed files with 263 additions and 219 deletions

View File

@@ -2,16 +2,32 @@
#include <Arduino.h>
namespace Config {
// Hardware Pins (ESP32-CAM AI-Thinker)
constexpr int PIN_CAM_PWDN = 32;
constexpr int PIN_CAM_RESET = -1;
// ... (Add standard camera pins here to keep main clean) ...
// Camera Pins (ESP32-CAM AI-Thinker)
constexpr int PIN_CAM_PWDN = 32;
constexpr int PIN_CAM_RESET = -1;
constexpr int PIN_CAM_XCLK = 0;
constexpr int PIN_CAM_SIOD = 26;
constexpr int PIN_CAM_SIOC = 27;
constexpr int PIN_CAM_Y9 = 35;
constexpr int PIN_CAM_Y8 = 34;
constexpr int PIN_CAM_Y7 = 39;
constexpr int PIN_CAM_Y6 = 36;
constexpr int PIN_CAM_Y5 = 21;
constexpr int PIN_CAM_Y4 = 19;
constexpr int PIN_CAM_Y3 = 18;
constexpr int PIN_CAM_Y2 = 5;
constexpr int PIN_CAM_VSYNC = 25;
constexpr int PIN_CAM_HREF = 23;
constexpr int PIN_CAM_PCLK = 22;
// Printer Pins
constexpr int PIN_PRINTER_RX = 14;
constexpr int PIN_PRINTER_RX = 14;
constexpr int PIN_PRINTER_TX = 15;
// Button
constexpr int PIN_BUTTON = 12;
// Settings
constexpr int PRINTER_WIDTH = 384;
constexpr int BAUD_RATE = 9600; // Check your printer specs (some are 19200)
constexpr int PRINTER_SERIAL = 1;
}