mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
race
This commit is contained in:
@@ -38,13 +38,24 @@ button:
|
||||
on_press:
|
||||
- lambda: |-
|
||||
// Publish 10 values with NaN mixed in: 10, NaN, 5, NaN, 15, 8, NaN, 12, 3, NaN
|
||||
// Small delay to ensure API can process each state update
|
||||
id(source_nan_sensor).publish_state(10.0);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(NAN);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(5.0);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(NAN);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(15.0);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(8.0);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(NAN);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(12.0);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(3.0);
|
||||
delay(10);
|
||||
id(source_nan_sensor).publish_state(NAN);
|
||||
delay(10);
|
||||
|
||||
@@ -70,6 +70,8 @@ button:
|
||||
// - Output at position 5: window=[1,2,3,4,5], min=1, max=5, median=3, avg=3
|
||||
// - Output at position 7: window=[3,4,5,6,7], min=3, max=7, median=5, avg=5
|
||||
// - Output at position 9: window=[5,6,7,8,9], min=5, max=9, median=7, avg=7
|
||||
// Small delay to ensure API can process each state update
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
id(source_sensor).publish_state(float(i));
|
||||
delay(10);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,9 @@ button:
|
||||
- lambda: |-
|
||||
// Publish 9 values to test ring buffer wraparound
|
||||
// Values: 10, 20, 30, 5, 25, 15, 40, 35, 20
|
||||
// Small delay to ensure API can process each state update
|
||||
float values[] = {10.0, 20.0, 30.0, 5.0, 25.0, 15.0, 40.0, 35.0, 20.0};
|
||||
for (int i = 0; i < 9; i++) {
|
||||
id(source_wraparound).publish_state(values[i]);
|
||||
delay(10);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,8 @@ button:
|
||||
on_press:
|
||||
- lambda: |-
|
||||
// Publish 10 values: 1.0, 2.0, ..., 10.0
|
||||
// Small delay to ensure API can process each state update
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
id(source_sensor).publish_state(float(i));
|
||||
delay(10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user