[Ovmsdev] Recommen

Michael Balzer dexter at expeedo.de
Sat Jun 17 15:01:35 HKT 2023


Solterra,

Am 17.06.23 um 01:37 schrieb Solterra:
> Is there a recommended method for adding a one-time CAN poll to the 
> queue with the response to be processed by IncomingPollReply?

For single-shot requests you can either use the synchronous 
`OvmsVehicle::PollSingleRequest()` method(s) or temporarily replace the 
PID list via `OvmsVehicle::PollSetPidList()`.

For the latter, you'd reinstall your standard PID list in the incoming 
handler once you've received the response.

> What is the recommended method for adding or modifying obdii_polls 
> after initialization?

In most situations you only need to switch polls partially or change the 
poll frequency. For this, use the up to four poll state timings per list 
entry, and call `OvmsVehicle::PollSetState()` to switch the current state.

If you need to fully replace a poll list:

 1. Lock the poller mutex
 2. Remove the current PID list
 3. Create / modify your PID list
 4. Install the new / modified PID list
 5. Unlock the poller mutex

For dynamically created PID lists and/or combining predefined with 
dynamic entries, use a C++ std::vector & std::initializer_list.

For a full example of this and also an example for how to do the PID 
list update, see the `vehicle_vweup` OBD module:

  * https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_vweup/src/vehicle_vweup.h#L83
  * https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/vehicle_vweup/src/vweup_obd.cpp#L217

Regards,
Michael

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20230617/566d8dee/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20230617/566d8dee/attachment.sig>


More information about the OvmsDev mailing list