[Ovmsdev] Adding Pollers object to Duktape
Michael Geddes
frog at bunyip.wheelycreek.net
Wed Jul 3 14:24:00 HKT 2024
I figured I may as well add an OvmsPoller object to DukTape for Ovms. I'm
waiting to get back to my OVMS so that I can test it.. but this is the
documentation I have for the stuff I have coded. Thoughts on this?
What do people think of OvmsPoller.Times sub-object? I've added a general
mechanism for this.
Also should I have OvmsPoller.Pause() or OvmsPoller.SetUserPaused(true) ?
//.
OvmsPoller
^^^^^^^^^^
The Ovms Poller object represents the poller sub-system. It contains the
following methods:
- ``ispaused = OvmsPoller.GetPaused()``: Return true if the poller is
paused by the system/user.
- ``ispaused = OvmsPoller.GetUserPaused()``: Return true if the poller is
paused by the user.
- ``OvmsPoller.Pause()``: Pause the poller (adds User poller pause)
- ``OvmsPoller.Resume()``: Remove the User poller pause.
- ``tracemode = OvmsPoller.GetTrace()``: Return the current trace mode.
- ``OvmsPoller.SetTrace(tracemode)``: Set the current trace mode.
The Traces still require that 'Verbose' and 'Debug' levels (depending)
for the 'vehicle-poll'
debug tag are set.
Trace modes for verbose logging can be one of:
- ``on``: On for poller loop
- ``txrx``: On for txrx queue (this can be hazardous for some cars)
- ``all``: On for both poller loop and txrx queuing
- ``off``: Logging Off
Note that only ``on`` and ``off`` are recommended.
The poller object also contains a ``Times`` property for the OBD Poll-Time
tracing
which contains the following methods:
- ``isrunning = OvmsPoller.Times.GetEnabled()``: Returns true if the
time-tracing is enabled
- ``OvmsPoller.Times.SetEnabled(isrunning)``: Sets the enabled status of
the timer-tracing
- ``OvmsPoller.Times.Reset()``: Reset the timers (doesn't affect their
current state).
- ``OvmsPoller.Times.GetStatus()``: Gets the status of the various times.
This returns an object
of this format:
.. code-block:: javascript
return_value = {
"items": {
"Poll:PRI" : {
"count_hz": 1,
"avg_util_pm": 0.529,
"peak_util_pm":0.652,
"avg_time_ms": 0.052,
"peak_time_ms":1.516
},
"Poll:SRX": {
"count_hz": 1.47,
"avg_util_pm": 0.302,
"peak_util_pm":0.44,
"avg_time_ms": 0.02,
"peak_time_ms":0.573
},
"RxCan1[778]": {
"count_hz": 0.74,
"avg_util_pm": 0.427,
"peak_util_pm":0.826,
"avg_time_ms": 0.063,
"peak_time_ms":1.872
},
"RxCan1[7a8]": {
"count_hz": 0.35,
"avg_util_pm": 0.183,
"peak_util_pm":0.355,
"avg_time_ms": 0.052,
"peak_time_ms":1.382
},
"TxCan1[7b3]": {
"count_hz": 0.07,
"avg_util_pm": 0.005,
"peak_util_pm":0.01,
"avg_time_ms": 0.007,
"peak_time_ms":0.099
},
"TxCan1[7c6]": {
"count_hz": 0,
"avg_util_pm": 0,
"peak_util_pm":0.009,
"avg_time_ms": 0.004,
"peak_time_ms":0.098
},
"Cmd:State": {
"count_hz": 0,
"avg_util_pm": 0,
"peak_util_pm":0,
"avg_time_ms": 0.011,
"peak_time_ms":0.109
}
},
"tot_count_hz": 11.76,
"tot_util_pm": 6.247,
"tot_time_ms": 4.628
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20240703/0cfd7375/attachment.htm>
More information about the OvmsDev
mailing list