Commit Graph

33 Commits

Author SHA1 Message Date
MaPaLo76
c4d03bf1b7 fix(stability): Heap-Leak durch String/JsonDocument-Objekte behoben
- web_server.cpp: static String _logBuf -> char[6001] im BSS-Segment
  Jeder LOG_I/E/D-Aufruf loeste String-Reallokation aus (~280 Bytes/min Drift)
  Fix: memmove-basierter Ring-Puffer, kein malloc/free mehr
- mqtt_client.cpp: JsonDocument in publishHeartbeat() und _doPublishSession()
  durch snprintf-JSON ersetzt (kein ArduinoJson-Heap-Pool alle 60 s)
- config.h: LOG-Puffer von 200 auf 320 Bytes erhoeht (Truncation fix)
- platformio.ini: CORE_DEBUG_LEVEL wieder auf 1 (war 3 fuer Heap-Diagnose)
2026-03-01 12:11:00 +01:00
MaPaLo76
7935dfbba4 feat(mqtt): reset_reason im Heartbeat-JSON hinzugefuegt
- esp_reset_reason() einmalig in begin() gespeichert (_resetReason[32])
- reset_reason-Feld in publishHeartbeat() JSON-Payload
- Moegliche Werte: POWERON, SOFTWARE, PANIC, TASK_WDT, INT_WDT, WDT, BROWNOUT, EXT_PIN, DEEPSLEEP, SDIO, UNKNOWN
- README.md: Status-JSON-Beispiel und Werteliste dokumentiert
2026-03-01 12:10:07 +01:00
MaPaLo76
c40668f216 feat(FR-007): session_id in MQTT Session-Payload; Reset bei reset/reset_session; Version 1.2.0 2026-03-01 00:04:17 +01:00
MaPaLo76
aae34fe84a fix(FR-009): startTime in SessionPayload speichern – session_start_time bei Queue-Nachlieferung korrekt 2026-02-28 23:56:11 +01:00
MaPaLo76
96508910b0 fix(FR-006): MQTT Session-Queue (128 Slots) statt volatile Einzelslot; Dequeue erst nach erfolgreichem Publish 2026-02-28 23:49:29 +01:00
MaPaLo76
b91b3ca96f fix(mqtt): Netzwerk-Objekte per new auf Core 0 anlegen - Heap-Korruption behoben
- WiFiClient, WiFiClientSecure, PubSubClient als Pointer deklariert (nullptr init)
- Objekte werden erst in _taskLoop() auf Core 0 per 'new' erstellt
- mbedtls bindet Heap-Allokationen an den erstellenden Core/Task
  -> Anlegen auf Core 1 (globaler Konstruktor) + Nutzung auf Core 0 = Heap-Korruption
  -> Fix: Anlegen UND Nutzung ausschliesslich auf Core 0
- isConnected(), printToSerial(): Null-Checks ergaenzt
2026-02-28 19:05:09 +01:00
MaPaLo76
a7c6edb458 fix(mqtt): MQTT-Task auf Core 0 auslagern - TLS-Blocking behebt WDT-Crash und Display-Freeze
- WiFiClientSecure/mbedtls ausschliesslich auf Core 0 initialisiert und verwendet
  (Cross-Core-Heap-Korruption durch mbedtls vermieden)
- xTaskCreatePinnedToCore('mqtt_task', Core 0, 16 KB Stack)
- begin() startet nur Task, kein Netzwerk-Zugriff auf Core 1
- mqttClient.loop() in main.cpp ist No-Op
- publishSession() von Core 1 via volatile-Flags an Core-0-Task uebergeben
- Version: 1.1.0 -> 1.1.1
2026-02-28 18:07:27 +01:00
MaPaLo76
4dd4ce0620 feat(FR-002): Web Console via HTTP-Polling (/log + /log-data) -- v1.1.0
- Ring-Buffer _logBuf in web_server.cpp: webLogForward() schreibt auf Core 1
- GET /log-data liefert Puffer als Plain-Text (kein WebSocket, kein Core-Konflikt)
- Browser pollt alle 2 s, Auto-Scroll, dunkles Terminal-Theme
- LOG_I/LOG_E/LOG_D: Timestamp (HH:MM:SS nach NTP, sonst +Xs), webLogForward()
- Alle Serial.* in laser_tracker.cpp, mqtt_client.cpp, web_server.cpp auf LOG_I/LOG_E
- main.cpp: esp_reset_reason() beim Booten loggen (POWER_ON / WATCHDOG / PANIC...)
- telnet_logger.h entfernt (war nur noch Deprecated-Stub)
- Feature-Requests.md: FR-002 abgeschlossen
2026-02-28 17:24:56 +01:00
MaPaLo76
75f5b7a576 feat(web,mqtt): Firmware-Version auf Webseite und MQTT-Status
- platformio.ini: -DFIRMWARE_VERSION='1.0.0' als build_flag (Single Source of Truth)
- config.h: #ifndef FIRMWARE_VERSION Fallback fuer Arduino IDE
- web_server.cpp: config.h eingebunden; Firmware-Zeile in Statustabelle (/);
  Footer 'v1.0.0 (Feb 26 2026)' auf /config
- mqtt_client.cpp: firmware_version im lasercutter/status Payload;
  buf von 160 auf 220 Bytes vergroessert
- Feature-Requests.md: FR-001 dokumentiert
2026-02-26 21:53:05 +01:00
MaPaLo76
6bef93210e feat(ota): ArduinoOTA integration + platformio.ini refactor
- ArduinoOTA in web_server.cpp integriert (Hostname: lasercutter-display)
- WebServerManager::loop() hinzugefuegt -> ArduinoOTA.handle()
- webServer.loop() in main.cpp aufgerufen
- platformio.ini: gemeinsamer [env]-Basisblock (lib_deps einmalig)
- Neues env az-delivery-devkit-v4-ota (espota, upload_flags --auth Anleitung)
- Neues env az-delivery-devkit-v4-ota-http (ElegantOTA HTTP Fallback)
- upload_ota.py: HTTP-Multipart-Upload Script fuer ElegantOTA
- README.md: Abschnitt Via WiFi (OTA) mit Passwort-Anleitung
- Implementation-Plan.md: Task 9.9 dokumentiert
2026-02-26 21:35:55 +01:00
MaPaLo76
974616aee2 refactor(wifi): non-blocking WiFi-Architektur (Proposal B+D)
- WiFiManager als Pointer, lazy new in begin() verhindert Crash durch
  globale Konstruktoren vor Arduino-Framework-Init
- WiFi.mode(WIFI_STA) vor Credentials-Pruefung; getWiFiSSID(true) statt
  WiFi.SSID() (erfordert gestarteten Stack)
- Credentials vorhanden: WiFi.begin() non-blocking, Ergebnis in loop()
- Keine Credentials: setConfigPortalBlocking(false) + process() in loop()
- Nach 3 Fehlversuchen: startConfigPortal() automatisch
- onConnect(): stopWebPortal() vor AsyncWebServer-Start (Port-80-Konflikt)
- main.cpp: LaserTracker startet vor WiFi (Prioritaet 1)
- MQTT + WebServer: Lazy-Init beim ersten WiFi-Connect
- Display rate-limited: W 500ms-Blinker, Minuten 60s, Sekunden 1s, M bei Aenderung
- Manuell getestet: LaserTracker laeuft sofort, WiFi non-blocking verifiziert
2026-02-26 21:05:22 +01:00
MaPaLo76
7fb14307ea Vor Architektur Änderung 2026-02-26 18:50:45 +01:00
MaPaLo76
99b5c25e37 feat(tracker): resetSessionSum + MQTT reset_session + UI-Verbesserungen
- resetSession() umbenannt in resetSessionSum() (klarere Semantik)
- Bug fix: resetSessionSum() setzt laufende Session-Timer korrekt zurueck
  (vorher: getAllSessionsSumMinutes() blieb > 0 nach Reset)
- consumeSessionReset() nach consumeSessionEnd()-Muster (consume-Semantik)
- Vor Reset: akkumulierte Netto-Sekunden sichern -> publishSession() wie Session-Ende
- MQTT: payload {reset_session:true} via lasercutter/reset loest resetSessionSum() aus
- MQTT: Session-Reset publiziert identisches JSON wie normales Session-Ende
- Web: Button-Layout ueberarbeitet (alle 3 Buttons blau, uebereinander, gleich breit)
- Docs: README.md + Implementation-Plan.md aktualisiert
2026-02-23 22:49:30 +01:00
MaPaLo76
fde1f12315 fix(auth): HTTP Basic Auth funktioniert korrekt
- requestAuthentication() auf Basic Auth umgestellt (false = kein Digest)
- webPassword/webUser Buffer von 32 auf 64 Byte vergroessert
- POST /config: leeres Passwortfeld laesst bestehendes Passwort unveraendert
- Checkbox 'clear_auth' zum expliziten Deaktivieren des Schutzes
- Temporaere Debug-Ausgaben entfernt
2026-02-23 22:09:28 +01:00
MaPaLo76
07c99dc7d8 feat(web): HTTP-Basic-Auth fuer alle Routen; webUser/webPassword in NVS; ElegantOTA.setAuth() 2026-02-23 21:32:47 +01:00
MaPaLo76
18a1f67f64 feat(mqtt): session_start_time ISO-8601 UTC; NTP waitForNtp nach WLAN-Connect; docs: README + Plan Phase 9 abgeschlossen 2026-02-23 21:23:45 +01:00
MaPaLo76
2073c3678c feat(main): Phase 9 - LOG_D, getFreeHeap-Monitor; fix: PIMPL web_server loest ESPAsyncWebServer/WiFiManager HTTP-Enum-Konflikt 2026-02-23 21:06:59 +01:00
MaPaLo76
530d2f4670 feat(main): Phase 8 - WebServer, Watchdog, WLAN/MQTT-Fehlerstatus, Initialisierungsreihenfolge, Ceiling-Minuten pro Session 2026-02-23 20:50:04 +01:00
MaPaLo76
e273f1ea6c feat(display): showSessionRing - Sekunden-Kreisanzeige auf Modulen 5-7, 12-Uhr-Start (Phase 5b / 5.7 abgeschlossen) 2026-02-23 20:19:33 +01:00
MaPaLo76
e98002db7b refactor(laser,web): getSessionMinutes->getAllSessionsSumMinutes, Platzhalter SESSION->ALLSESSIONS, BURST->LASTSESSION 2026-02-23 19:50:47 +01:00
MaPaLo76
d644ff4986 refactor(laser): Burst-Begriff durch Session ersetzt (BurstState->SessionState, getLastBurstSeconds->getLastSessionSeconds, consumeBurstEnd->consumeSessionEnd) 2026-02-23 19:33:40 +01:00
MaPaLo76
d0d4666cf7 refactor(mqtt,web): Terminologie Session/Maschinenlaufzeit, JSON-Felder aktualisiert 2026-02-23 19:17:29 +01:00
MaPaLo76
16838fa265 feat(web): Phase 7 WebServer (ESPAsyncWebServer, Config, Reset, ElegantOTA) 2026-02-22 20:43:08 +01:00
MaPaLo76
0dbfa07744 feat(mqtt): TLS-Unterstuetzung (WiFiClientSecure, Port 8883), Secrets-Datei gitignoriert 2026-02-22 20:06:53 +01:00
MaPaLo76
71ef2c7ad0 feat(mqtt): Phase 6 - MqttClient implementiert (PubSubClient, publishSession, Heartbeat, Reset-Subscribe) 2026-02-22 19:36:29 +01:00
MaPaLo76
d114a58de6 fix(phase5): LaserTracker neu - Session/Burst-Logik korrigiert
- BurstState-Maschine: INACTIVE -> GRATIS -> NET_COUNTING
- _sessionNetSec (RAM): Netto-Sekunden der Betriebssitzung, reset beim Start
- _totalMinutesBase (NVS via settings.saveTotalMinutes): persistierte Gesamtzeit
- Gratis-Countdown startet bei JEDEM Laser-AN-Ereignis neu
- Netto-Zeit wird erst nach Ablauf der Gratiszeit gezaehlt
- getSessionMinutes(): sessionNetSec / 60 (ganzzahlig, hart)
- getCountdownRemaining(): nur 0 wenn INACTIVE oder NET_COUNTING
- Display Module 1-3: Session-Minuten (nicht Gesamtzeit)
- Display Module 5-7: Countdown waehrend GRATIS, sonst Idle
- settings.saveTotalMinutes() statt direkter Preferences-Calls
- main.cpp + test_laser_tracker.cpp auf neue API umgestellt
2026-02-22 18:48:35 +01:00
MaPaLo76
3827342c0c feat(laser): implement LaserTracker with debounce, gratis time and NVS save
- Add include/laser_tracker.h: LaserTracker class declaration
  - Software debounce (LASER_DEBOUNCE_MS = 50ms from config.h)
  - Polarity-aware GPIO read (LOW_ACTIVE / HIGH_ACTIVE from settings)
  - Session lifecycle: onSessionStart / onSessionEnd
  - Gratis time countdown, net seconds accumulation
  - Getters: isActive, getTotalMinutes, getSessionSeconds,
    getCountdownRemaining, getLastSessionSeconds, resetTotal

- Add src/laser_tracker.cpp: full implementation
  - readRaw() applies signal polarity
  - loop() handles debounce state machine and edge detection
  - onSessionEnd() saves updated totalMinutes to NVS
  - getTotalMinutes() returns live value (base + current net session)

- Add test_sketches/test_laser_tracker.cpp: interactive test sketch
  - Button on GPIO 4 simulates laser signal
  - BOOT button (GPIO 0, 3s hold) resets total
  - Display: modules 1-3 = total minutes, modules 5-7 = countdown/net

- Add test-laser-tracker env to platformio.ini
- Update src/main.cpp: integrate laserTracker.begin/loop + live display
- Update Implementation-Plan.md: mark Phase 5 tasks 5.1-5.6 complete
2026-02-22 14:30:14 +01:00
MaPaLo76
26a4e9b95c fix(display): redesign module layout - integer minutes, dedicated error slots
New module assignment:
  Module 0       : WiFi error indicator (showWifiError) - 'W' / blank
  Module 1-3     : laser time in full minutes, 3-digit right-aligned
  Module 4       : MQTT error indicator (showMqttError) - 'M' / blank
  Module 5-7     : countdown seconds / idle / status, 3-digit right-aligned

Changes in display_manager.h:
- Update zone layout comments
- showLaserTime: integer minutes only, writes modules 1-3 (module 0 untouched)
- showCountdown: writes modules 5-7 only (module 4 untouched)
- showIdle: ' --' on modules 5-7
- showStatus: 3-char string on modules 5-7
- Add showWifiError(bool): module 0
- Add showMqttError(bool): module 4

Changes in display_manager.cpp:
- Add BMP_M character bitmap
- Add 'M' case in charBitmap()
- Rewrite showLaserTime() - round to int, 3 chars, modules 1-3
- Rewrite showCountdown() - 3 chars, modules 5-7
- Rewrite showIdle() - ' --' on modules 5-7
- Rewrite showStatus() - 3 chars, modules 5-7
- Add showWifiError() / showMqttError() implementations
- Update printToSerial() log output

Changes in test_sketch:
- 9 test steps covering all new methods incl. combination test
- Tested on hardware: all steps passed
2026-02-22 14:15:18 +01:00
MaPaLo76
4349b37f05 feat(display): implement DisplayManager with raw MD_MAX72XX
- Add include/display_manager.h: DisplayManager class declaration
  - Two-zone layout: Zone 0 (top, laser time), Zone 1 (bottom, countdown/status)
  - showLaserTime(), showCountdown(), showIdle(), showStatus(), setBrightness()
  - rotateCCW() bitmap transformation for 90 deg physical module rotation
  - charBitmap() for 17-character set (0-9, space, dash, dot, special chars)

- Add src/display_manager.cpp: full implementation
  - Double-init pattern for SPI power stability
  - showLaserTime() format: <10 -> ' x.x', <100 -> 'xx.x', <1000 -> ' xxx', else 'xxxx'
  - showCountdown() right-aligned 4-char format
  - All methods use writeZone() -> writeChar() -> rotateCCW() -> MD_MAX72XX

- Add test_sketches/test_display_manager.cpp: 6-step verification test
  - allLedsOn/Off, showLaserTime (12 boundary values), showCountdown 5->0
  - showIdle, showStatus (Err/AP/WiFi/oF), live simulation loop

- Update platformio.ini: add test-display-mgr environment
- Update src/main.cpp: integrate display.begin/showIdle/update
- Update Implementation-Plan.md: mark Phase 4 tasks 4.1-4.3 complete

Tested on hardware: all 6 test steps passed
2026-02-22 14:00:54 +01:00
MaPaLo76
c63cace1ae feat(wifi): implement WiFiManager connection handling
- include/wifi_connector.h: WifiConnector class with WifiStatus enum,
  onStatusChange callback, begin/loop/reset methods
- src/wifi_connector.cpp: autoConnect with AP timeout and restart,
  reconnect logic on connection loss, printToSerial diagnostics
- src/main.cpp: call wifiConnector.begin() and loop()
- test_sketches/test_wifi.cpp: first-connect via captive portal,
  auto-reconnect after reboot, BOOT-button (3s) resets credentials
- platformio.ini: add test-wifi environment
- Implementation-Plan.md: mark tasks 3.1-3.3 complete
2026-02-22 13:50:07 +01:00
MaPaLo76
68c3ce54b3 feat(settings): implement NVS persistence via Preferences
- include/settings.h: Settings struct + SettingsManager class with
  begin/load/save/reset and atomic save methods per value
- src/settings.cpp: input validation, clamping, default fallbacks;
  password masked in printToSerial()
- src/main.cpp: call settings.begin() and printToSerial() on startup
- test_sketches/test_nvs.cpp: two-phase NVS persistence test;
  write known values, reboot, verify all 7 values survive (PASS)
- platformio.ini: add test-nvs environment with settings.cpp in filter
- Implementation-Plan.md: mark tasks 1.4 and 2.1/2.2 complete
2026-02-22 13:35:44 +01:00
MaPaLo76
6ac33f459d feat(phase1): complete hardware setup, display and button test sketches
- platformio.ini: add all 8 libraries via Git URLs, add test-display and
  test-button environments, reduce SPI clock to 1 MHz for stability
- include/config.h: add pin definitions, DISPLAY_HW_TYPE=GENERIC_HW,
  MQTT topics, NVS keys and logging macros
- src/main.cpp: add minimal startup skeleton with config.h include
- test_sketches/test_display.cpp: diagnostic sketch showing 0-based module
  index; GENERIC_HW verified with 90 deg CCW software rotation
- test_sketches/test_button.cpp: GPIO INPUT_PULLUP test; LOW_ACTIVE confirmed
- test_sketches/README.md: add wiring tables, flash commands, results table
- README.md: update HW type to GENERIC_HW, add power supply note (0.5A /
  2.5W measured, external 5V PSU required), add Conventional Commits section
- Implementation-Plan.md: mark tasks 1.1-1.5 as complete

BREAKING CHANGE: none
2026-02-22 13:20:52 +01:00
MaPaLo76
5a3a4e40bd Initial Version of README.md 2026-02-22 10:34:37 +01:00