1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-16 14:55:50 +00:00

[core] Add helper functions for clamp_at_... (#10387)

This commit is contained in:
Clyde Stubbs
2025-11-06 12:48:02 +10:00
committed by GitHub
parent 83f30a64ed
commit ab5d8f67ae
7 changed files with 84 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
logger:
level: VERBOSE
esphome:
on_boot:
- lambda: |-
int x = 100;
x = clamp(x, 50, 90);
assert(x == 90);
x = clamp_at_least(x, 95);
assert(x == 95);
x = clamp_at_most(x, 40);
assert(x == 40);