mirror of
https://github.com/joshr120/PD-Stepper.git
synced 2025-11-04 14:49:56 +08:00
Update PD-Stepper-Position-Control.yaml
suppress aggressive encoder polling
This commit is contained in:
parent
802cd5c2e8
commit
06f76f04a1
@ -178,9 +178,10 @@ sensor:
|
|||||||
name: Encoder
|
name: Encoder
|
||||||
id: encoder
|
id: encoder
|
||||||
update_interval: 0s # beware of the polling rate
|
update_interval: 0s # beware of the polling rate
|
||||||
|
internal: true # don't publish sensor data to Home Assistant or web server
|
||||||
filters:
|
filters:
|
||||||
- delta: 2
|
- delta: 2 # throttle the high polling rate to only act on value changes
|
||||||
# filter which computes absolute position from angle value
|
# compute absolute position from angle value
|
||||||
- lambda: |
|
- lambda: |
|
||||||
const uint16_t curr = x; //current encoder value 0-4095
|
const uint16_t curr = x; //current encoder value 0-4095
|
||||||
const uint16_t prev = id(encoder_tracking_)[0]; //previous encoder value 0-4095
|
const uint16_t prev = id(encoder_tracking_)[0]; //previous encoder value 0-4095
|
||||||
@ -193,6 +194,8 @@ sensor:
|
|||||||
}
|
}
|
||||||
id(encoder_tracking_)[0] = curr;
|
id(encoder_tracking_)[0] = curr;
|
||||||
return id(encoder_tracking_)[1];
|
return id(encoder_tracking_)[1];
|
||||||
|
- multiply: -1.0
|
||||||
|
- throttle: 100ms # limit the amount of new sensor states from this component
|
||||||
accuracy_decimals: 0
|
accuracy_decimals: 0
|
||||||
state_class: measurement
|
state_class: measurement
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user