-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windmeter: add measure interval setting #19542
Windmeter: add measure interval setting #19542
Conversation
Thanks @malbinola for coming back and bringing this improvement! Is it possible to compute by fractions of a second like 2.5s? Not just 1, 2, 3, ... seconds. You have 3 parameters here: Best regards! |
Ok, let me know.
Yes but it's not an immediate modification. Speed computation is based on FUNC_EVERY_SECOND callback, so logic needs to be migrated for instance to FUNC_EVERY_250_MSECOND and handle time fractions.
With this PR, i've tried to keep changes to a minimum. But of course it can be pre-computed into a single factor in order to improve internal calculations. Do yo mean internally? Right? |
I checked again, don't necessarily need fractions. I use a Davis windmeter and in the calculation they go with a measurement period of 2.5 seconds but I can convert the equation to 3 seconds, no issue. This is what i use currently anyway.
Yes, I meant a single factor for internal calculation.
I didn't think about backward compatibility, this would be a breaking change...
This was just what I had on my mind. Just leave it as it is. Perfect! |
I agree, it would be cool! This implementation was inspired by tx20/tx23 sensor (xsns_35_tx20) that have support for wind direction information; some code was ported as starting point for future implementations. @Ingenieur89 what kind of ESP device do you have? Can you confirm that modification also work on ESP32? |
PR needs to be tested with an ESP32. Without no merge. |
I use an ESP32 devkit c (not sure which model). |
I think that is enough. What do you think @Jason2866 ?
@Ingenieur89 This is the source branch of my PR: you can click on "Code" (green button) then "Download ZIP". |
I flashed your branch to the ESP32 devkit c and it is working fine for a few days. Thank you for the update! |
Great news @Ingenieur89 !! Thank you for the feedback! |
Description:
Original implementation was designed for a small cup anemometer (approx 6cm radius) where measuring speed every second was sufficient. As reported by @Ingenieur89 several months ago, when using an anemometer with a higher radius, is useful to delay speed computation, otherwise the speed may not get computed below a certain value.
New setting
windmeter_measure_intvl
, by default set to 1s (like before), allows to increase the resolution of the speed measurement. Using commandSensor68 6, X
(where is X from 1 to 255), you can specify to compute the speed everyX
seconds.Finally, now the computation is based on the real time-delta between measurements and not on the name of the timer function (***EverySecond) as happened before.
Compilation for ESP32 succeeded but unfortunately i do not have an ESP32 device to test it on the field.
Related issue (if applicable): fixes #9091
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass