3483 Commits

Author SHA1 Message Date
fvanroie
f517f094d3 Downgrade ace.js to 1.43.3 2026-04-05 15:09:44 +02:00
fvanroie
bfc56dfa4a Merge branch 'master' of https://github.com/HASwitchPlate/openHASP 2026-03-20 18:00:07 +01:00
fvanroie
2d5ce46f78 Add Lanbon L9 v3.3 2026-03-20 17:59:58 +01:00
fvanroie
8234d1d440 Merge pull request #1006 from alvarolobato/fix/mqtt-paho-reconnect-loop
fix: prevent MQTT disconnect loop on PC builds by reusing Paho client
2026-03-13 15:30:35 +01:00
Alvaro Lobato
512086bdbb fix: prevent MQTT disconnect loop by reusing Paho client on reconnect
mqttStart() called MQTTAsync_create()/MQTTClient_create() on every
invocation, including reconnects from mqttEvery5Seconds(). This leaked
the old Paho client handle without destroying it. The old client's
internal threads would eventually reconnect using the same MQTT
clientID, causing the broker to disconnect the new client ("session
taken over"), creating a permanent connect/disconnect loop.

Fix: create the Paho client once (guarded by mqttClientCreated flag)
and reuse it on reconnect, matching the ESP32 implementation pattern.
Properly destroy the client in mqttStop().

Affects: hasp_mqtt_paho_async.cpp (Linux, macOS, Windows async builds)
         hasp_mqtt_paho_single.cpp (Windows synchronous builds)
Does not affect: ESP32/ESP8266/STM32 (different MQTT implementations)

Fixes HASwitchPlate/openHASP#1005

Made-with: Cursor
2026-03-13 00:22:15 +00:00
fvanroie
76bf6ca37d Merge pull request #1004 from lhag87/lines
change DynamicJsonDocument allocation in my_line_set_points
2026-03-11 18:58:49 +01:00
lhag87
fddb75b88e change Log level & comment 2026-03-11 18:02:41 +01:00
lhag87
2ad6932ad6 my_line_set_points: DynamicJsonDocument allocation based on the number of points. 2026-03-11 17:43:33 +01:00
fvanroie
f910da16fa Merge pull request #1002 from alvarolobato/fix-connect-loop-188
Fix segfault and connect loop - PC/SDL2: defer jsonl/json to main thread
2026-03-08 23:26:44 +01:00
Alvaro Lobato
ce3773c500 Revert platformio.ini: darwin/linux disabled by default; remove #endif comment
- platformio.ini: remove user_setups/darwin and user_setups/linux from extra_configs (use platformio_override.ini to enable)
- hasp_dispatch.cpp: remove unnecessary comment on #endif

Made-with: Cursor
2026-03-08 18:10:34 +01:00
Alvaro Lobato
c33fe4977a Fix preprocessor #endif; add -std=c++14 to Linux envs; include darwin/linux in main platformio.ini
- hasp_dispatch.cpp: remove extra #endif so #else correctly pairs with #if HASP_TARGET_PC
- linux_headless.ini, linux_fbdev.ini: add -std=c++14 for ArduinoJson build
- platformio.ini: add user_setups/darwin/*.ini and user_setups/linux/*.ini to extra_configs so envs are available without override (CI/Docker)

Made-with: Cursor
2026-03-08 11:40:56 +01:00
Alvaro Lobato
a54b1c2fa3 PC defer queue: cap at 64 (PC has plenty of memory)
Made-with: Cursor
2026-03-08 11:35:05 +01:00
Alvaro Lobato
e2332fa1ae darwin_headless: add -std=c++14 for ArduinoJson/native build
Made-with: Cursor
2026-03-08 11:34:22 +01:00
Alvaro Lobato
61c236809e PC/SDL2: defer jsonl/json MQTT commands to main thread (fix segfault on retained page-0)
On PC build the MQTT callback runs on Paho's async thread. dispatch_parse_jsonl
and dispatch_parse_json call hasp_new_object() which uses LVGL APIs; LVGL is
not thread-safe. Result: segfault when a retained page-0 label is delivered on
connect (e.g. 'MSGR: Jsonl fully parsed' then crash).

Fix: when topic is command/jsonl or command/json, queue (topic, payload) and
return from the callback. Main loop drains the queue and calls dispatch_topic_
payload on the LVGL thread. Queue capped at 4 items to bound memory.

Ref: home-automation#188 (connect loop / throttle workaround removal)
Made-with: Cursor
2026-03-08 09:33:17 +01:00
fvanroie
103e54cfeb Update ace.js to v1.43.6 2026-03-02 01:52:49 +01:00
fvanroie
c387627e95 Add linux_headless and linux_fbdev 2026-02-26 15:04:21 +01:00
fvanroie
53444dfffa Add linux_headless and linux_fbdev 2026-02-26 14:59:04 +01:00
fvanroie
47f8ad5592 Merge pull request #1001 from alvarolobato/fix-action-use-after-free
Fix use-after-free in my_obj_set_action() corrupting button actions on 64-bit platforms
2026-02-26 14:35:55 +01:00
Alvaro Lobato
621437784f Fix use-after-free in my_obj_set_action() on 64-bit platforms
When the backwards-compatibility path in my_obj_set_action() converts
simple action strings (e.g. "next", "prev", "back") into JSON objects,
it builds the JSON in a stack-local char json[64] inside an if-block,
then calls deserializeJson(doc, json). Because json is a mutable char*,
ArduinoJson performs zero-copy in-place parsing — storing pointers into
the buffer rather than copying the string data.

When the if-block ends, json goes out of scope and its stack memory is
freed. The subsequent serializeJson(doc, str, size) call (outside the
block) reads from those dangling pointers, producing corrupted action
strings like {"up":"page \"\u0000\u0000\u0000"} instead of the
expected {"up":"page next"}.

On 32-bit ESP32 the stack frame often gets reused in a way that
preserves the data, masking the bug. On 64-bit platforms (macOS/Linux
SDL2 builds) the different stack layout exposes the corruption, causing
"Invalid page 0" errors and broken button navigation.

The fix is to cast json to const char* before passing it to
deserializeJson, forcing ArduinoJson to copy the strings into the
document's memory pool. This is the same pattern already used throughout
hasp_dispatch.cpp, which has the comment:

  "Note: Deserialization needs to be (const char *) so the objects
   WILL be copied — this uses more memory but otherwise the mqtt
   receive buffer can get overwritten by the send buffer !!"

Made-with: Cursor
2026-02-26 06:25:40 +00:00
fvanroie
e0f360d166 Merge pull request #999 from alvarolobato/headless
Add headless build target with null display driver
2026-02-25 15:26:08 +01:00
Alvaro Lobato
e70c798ba5 Add darwin_headless build target for macOS headless operation
Mirrors linux_headless but uses clang/libc++ via osx_build_extra.py.
No SDL2 dependency — suitable for CI on macOS runners.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 10:34:42 +00:00
Alvaro Lobato
7e3fa4c61f Add headless build target with null display driver
Add a null display driver that uses an in-memory framebuffer with a
pthread-based tick thread — no SDL2 or display server required.
This enables running openHASP in CI/CD pipelines, Docker containers,
and headless servers.

New files:
- src/drv/tft/tft_driver_null.h / .cpp — null driver implementation
- user_setups/linux/linux_headless.ini — PlatformIO environment

The POSIX screenshot code (fopen/fwrite) works with the null driver
since it hooks the LVGL flush callback via lv_refr_now(). Tested:
MQTT screenshot command produces valid 307KB BMP in Docker.

Closes alvarolobato/home-automation#76

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 10:18:12 +00:00
Alvaro Lobato
fcf874ab98 Fix linux_sdl build: add missing limits.h include for PATH_MAX
The POSIX screenshot code added in #997 uses PATH_MAX and realpath(),
which require <limits.h> on Linux. macOS provides these implicitly
through system headers, so the darwin_sdl build passed but linux_sdl
failed with 'PATH_MAX was not declared in this scope'.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-25 08:30:47 +00:00
fvanroie
d3ac0c8f60 Merge pull request #997 from alvarolobato/mac_build
Add native screenshot capture for Mac (POSIX) build
2026-02-25 00:11:39 +01:00
Alvaro Lobato
f847dc0880 Add native screenshot capture for Mac (POSIX) build
Enable pixel-perfect screenshot capture on the Mac build by reading
directly from the LVGL framebuffer, matching the existing ESP32 behavior.

Changes:
- src/hasp_gui.cpp: Add POSIX file-based screenshot using fopen/fwrite/fclose,
  extend bitmap header guard to compile on POSIX, log full absolute path
- src/hasp/hasp_dispatch.cpp: Enable the screenshot command for POSIX builds
- src/drv/tft/tft_driver_sdl2.cpp: Add F12 keyboard shortcut via SDL event watch
  using a flag polled from guiLoop() for thread safety

Usage:
- MQTT: publish to hasp/<node>/command/screenshot
- Keyboard: press F12 in the simulator window
- Default output: screenshot.bmp in the working directory

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-24 22:01:20 +00:00
Alvaro Lobato
57d2ebfccd Fix mac build 2026-02-24 20:44:28 +00:00
fvanroie
26671370f5 Cleanup build.yaml and Update esp_merge_bin.py 2026-02-09 16:15:50 +01:00
fvanroie
779f2f3f94 Update tools\auto_firmware_version.py 2026-02-09 16:05:04 +01:00
fvanroie
58e3882834 Install Setuptools 2026-02-09 16:00:50 +01:00
fvanroie
659bd98033 python-version: "3.12" 2026-02-09 15:56:42 +01:00
fvanroie
18cf0ee2aa Merge pull request #993 from mikezs/master
Add Sunton ESP32-2432s024 build and add to github workflow for builds
2026-02-09 15:34:10 +01:00
Mike B
16dcce39d9 Add Sunton ESP32-2432s024 build and add to github workflow for builds 2026-02-09 13:57:27 +00:00
fvanroie
860a53b164 Merge pull request #949 from oradke/improve-variables
Refactor: improve variable usage in hasp_attribute_helper.h
2026-01-31 20:52:00 +01:00
fvanroie
6f6ab1bf82 Merge pull request #956 from stewartoallen/add-waveshare-s3-lcd7
Add Waveshare ESP32-S3 Touch LCD 7 configuration
2026-01-15 16:38:36 +01:00
fvanroie
85532fadc3 Merge branch 'master' of https://github.com/HASwitchPlate/openHASP 2026-01-15 16:26:22 +01:00
fvanroie
48de123802 Allow yaml to trigger builds 2026-01-15 16:25:59 +01:00
fvanroie
79fba5290c Merge pull request #984 from bensuffolk/master
Changed post TFT reset delay to work for BTT Panda Touch
Thank you!
2025-12-31 23:42:43 +01:00
Ben Suffolk
1b85530809 Changed post TFT reset delay to work for BTT Panda Touch 2025-12-31 18:25:30 +00:00
fvanroie
5bed150ad1 Merge pull request #978 from 2fast2fourier/update-pip-install-flag
Update script to replace deprecated global-option flag for pip >=23
2025-12-22 19:25:39 +01:00
Matt Shepard
c189f01c1e Update pip flags in esp_merge_bin script. 2025-12-21 15:58:10 -07:00
Matt Shepard
3b5a366683 Update auto-dependencies script to use new config flag in pip >23.1 2025-12-21 11:33:29 -07:00
fvanroie
3356abf8e2 Add installation of dulwich in build workflow 2025-11-16 22:46:06 +01:00
fvanroie
02956a9055 Merge pull request #972 from schabau/patch-1
Update TFT pin assignments in configuration file
2025-11-16 22:20:46 +01:00
Schabau
b2d2d9e740 Update TFT pin assignments in configuration file
JC8048W550 red/blue swap
2025-11-16 21:42:34 +01:00
fvanroie
fc25236f2a Allow yaml to trigger builds 2025-10-21 02:15:44 +02:00
fvanroie
29819fb1ec Add esp32-s3-pandatouch_8MB 2025-10-21 02:14:04 +02:00
fvanroie
c3b958d681 Merge pull request #960 from capull0/master
Add configuration for ESP32-S3 Pandatouch from BTT
2025-10-21 02:12:29 +02:00
stranGE
7920002aee Add configuration for ESP32-S3 Pandatouch from BTT 2025-10-20 22:54:32 +02:00
Stewart Allen
ae4e24a807 Add Waveshare ESP32-S3 Touch LCD 7 configuration 2025-10-09 22:54:22 -04:00
fvanroie
ef1ea1777b Fix cyd-2424s012 2025-10-06 14:12:30 +02:00