Add a touch input type to YAML nodes #131

Merged
Claude merged 2 commits from feat/yaml-touch into feat/yaml-nodes 2026-10-16 08:22:32 +00:00
Collaborator

YN-13. New input type touch (sensors::TouchInput, lib/touch) with pin and an optional threshold (z-score). It reports every 10 s like a switch, and binds treat it as a switch source, so toggle works; latching is not accepted. The generator emits the GPIO number, not the D-name, since touchRead takes a GPIO.

The board table gains touch data. The S3 allows GPIO 1 to 14 (so D0 to D5, with the CAN pins still reserved) and takes the kitchen node's bench tuning: threshold 8.0 and setTouchCycles(1000, 30). The LOLIN32 allows GPIO 0, 2, 4, 12, 13, 14, 15, 27, 32 and 33 on the library defaults. The C3 has no touch peripheral, so touch is rejected there with a message naming the board. Tuning calls are emitted only where they differ from the library defaults, and <touch_input.h> is included only when a touch endpoint exists, so C3 builds never pull the touch library. Touch pins get the usual strapping warning.

Schema regenerated: per-board touch pin lists, touch refused on the C3, and a threshold field. README gains the type, a tuning note and touch as a bind source. The S3 and LOLIN32 fixtures each gain a touch endpoint with a toggle bind (LOLIN32 with a threshold override), so CI compiles both tunings.

No runtime change was needed.

Tested: Python 55 (was 44), none skipped locally. Tests cover C3 rejection, non-touch pins, the S3 defaults, the LOLIN32 no-calls case, the threshold override, the strapping warning, and the schema; disabling the threshold call fails them. All three fixtures build, including touch_input.h on the S3 and LOLIN32.

YN-13. New input type `touch` (`sensors::TouchInput`, lib/touch) with `pin` and an optional `threshold` (z-score). It reports every 10 s like a switch, and binds treat it as a switch source, so `toggle` works; `latching` is not accepted. The generator emits the GPIO number, not the D-name, since `touchRead` takes a GPIO. The board table gains touch data. The S3 allows GPIO 1 to 14 (so `D0` to `D5`, with the CAN pins still reserved) and takes the kitchen node's bench tuning: threshold 8.0 and `setTouchCycles(1000, 30)`. The LOLIN32 allows GPIO 0, 2, 4, 12, 13, 14, 15, 27, 32 and 33 on the library defaults. The C3 has no touch peripheral, so `touch` is rejected there with a message naming the board. Tuning calls are emitted only where they differ from the library defaults, and `<touch_input.h>` is included only when a touch endpoint exists, so C3 builds never pull the touch library. Touch pins get the usual strapping warning. Schema regenerated: per-board touch pin lists, `touch` refused on the C3, and a `threshold` field. README gains the type, a tuning note and touch as a bind source. The S3 and LOLIN32 fixtures each gain a touch endpoint with a toggle bind (LOLIN32 with a threshold override), so CI compiles both tunings. No runtime change was needed. Tested: Python 55 (was 44), none skipped locally. Tests cover C3 rejection, non-touch pins, the S3 defaults, the LOLIN32 no-calls case, the threshold override, the strapping warning, and the schema; disabling the threshold call fails them. All three fixtures build, including `touch_input.h` on the S3 and LOLIN32.
Add a touch input type to YAML nodes
Some checks failed
Build and test / release (pull_request) Has been cancelled
Build and test / build (pull_request) Has been cancelled
709a0a64a5
Claude left a comment

Two minor points, nothing blocking.

  • scripts/yaml_node.py (threshold check): a YAML .nan passes <= 0 and renders setZScoreThreshold(nanf), which won't compile. Use not threshold > 0 (and reject .inf) so it fails in the generator.
  • scripts/yaml_node.py: touchReportIntervalDs duplicates occupancyReportIntervalDs (both 100). Reuse one constant.
Two minor points, nothing blocking. - scripts/yaml_node.py (threshold check): a YAML `.nan` passes `<= 0` and renders `setZScoreThreshold(nanf)`, which won't compile. Use `not threshold > 0` (and reject `.inf`) so it fails in the generator. - scripts/yaml_node.py: `touchReportIntervalDs` duplicates `occupancyReportIntervalDs` (both 100). Reuse one constant.
Reject non-finite touch thresholds and share the report interval
All checks were successful
Build and test / build (pull_request) Successful in 5m13s
Build and test / release (pull_request) Has been skipped
aabea8fba6
Claude merged commit dd6c2076d0 into feat/yaml-nodes 2026-10-16 08:22:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/CampervanControlSystems!131
No description provided.