Closed mestafin closed 1 year ago
I couldn't initially understand the use case for a constant value sensor but the tank volume example hit the spot!
The PR description with the usage examples is very good; ~it'd be shame if anything happened to it~ it'd be great to have it included in the project documentation. Could you copy-paste it to the doc comment of ConstantSensor
? Doxygen supports Markdown, so no additional formatting should be required.
It is already in the @brief comment of the constant_sensor.h source file.
Or am I missing something?
Johan
On 22 Jun 2023, at 10:52, Matti Airas @.***> wrote:
I couldn't initially understand the use case for a constant value sensor but the tank volume example hit the spot!
The PR description with the usage examples is very good; it'd be shame if anything happened to it it'd be great to have it included in the project documentation. Could you copy-paste it to the doc comment of ConstantSensor? Doxygen supports Markdown, so no additional formatting should be required.
https://www.doxygen.nl/manual/docblocks.html
— Reply to this email directly, view it on GitHub https://github.com/SignalK/SensESP/pull/661#issuecomment-1602261312, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP3DTP5L53EEXZIGBMWZLDXMQBVPANCNFSM6AAAAAAZPEDLPA. You are receiving this because you authored the thread.
It is already in the @brief comment of the constant_sensor.h source file.
Or am I missing something?
I was just thinking about the usage examples; they're really good to have.
Your template code was quite close. C++ has a lot of quirks and baggage accumulated over time. One such thing is that template method definitions need to be in the header file and not in the .cpp file. I changed that and did a bit of other cleanups. I'll need to test the code on an actual device before merging.
Oh, and there seems to be some build issue in CI, too.
There were some minor issues in the class implementation (changes I made) and the example had a few notable omissions. Fixed now, and the value is properly transmitted. Merging.
Thanks, @mestafin, for the PR!
Thanks for your help with the C++ quirks
constant_sensor Library for sensESP to add virtual sensors that emit a constant value
Overview This library add a virtual sensors that periodically emit a constant value.
The virtual sensors are typically used to send a constant value to SignalK. Typical example is the capacity of a tank.
The sensors can be connected to all the standar SKOutput consumers.
The value of the sensor can be se via the web configuration page of sensESP;
Sensor Types:
How to Use
Example: send the water tank capacity every 30 seconds to SignalK:
To set or get the the value of the virtual sensor for use in your code: