Commit Graph
2 Commits
Author SHA1 Message Date
Konrad Rieck c742e92e7f Fix memory leak in lis2dw_monitor_face settings array
state->settings was malloc'd in lis2dw_monitor_face_setup() outside
the guard that only runs on first allocation of the face's context.
setup() is called again every time the watch wakes from deep sleep
(movement.c's app_setup() re-runs watch_faces[i].setup() for every
face on wake), so each wake cycle allocated a new settings array and
abandoned the previous pointer with no matching free.

Since NUM_SETTINGS is a compile-time constant, make settings a
fixed-size array embedded directly in lis2dw_monitor_state_t instead
of a separately malloc'd pointer, so it's allocated exactly once
along with the rest of the state and never leaks.
2026-07-27 22:11:52 +02:00
Konrad RieckandGitHub 22b11de6ae Monitor for LIS2DW accelerometer (#61)
This watch face displays the current reading of the LIS2DW12 accelerometer.
The axis (x,y,z) can be selected using the alarm button. A long press on the
light button allows to configure the sensor, including its mode, data rate,
low power mode, bandwidth filtering, range, filter type, and low noise mode.

The watch face is mainly designed for experimenting with the sensor and
configuring it for other developing other watch faces.
2025-08-03 13:12:43 -04:00