[Ovmsdev] Recommen

Michael Geddes frog at bunyip.wheelycreek.net
Sat Jun 17 09:40:05 HKT 2023


Currently, Not really, however I have some stuff in the pipeline that
permits exactly this kind of thing.

IF you would like, I could push it up to my own branch to my  github
account.  (I've been pushing up bits and pieces and working with the main
devs on the feedback).

One way you _could_ do it, I guess, is to make a copy of your poll struct,
include the one-off poll you wanted, and just temporarily modify the values
to a 1 (you'd want to lock the poll mutex) and change it back to 0 after
receiving the result.

The below example actually calls back on Incoming_Full with the full data
after receiving all the frames.. but you can also make a OnceOffPoll that
just allows it to go into the normal Incoming functions.

This one will even retry 3 times in the case it gets a failure the first
time.

//.ichael


----8<------------------- example --------------------[

bool OvmsHyundaiIoniqEv::PollRequestVIN()
{
  if (!StdMetrics.ms_v_env_awake->AsBool()) {
    ESP_LOGV(TAG, "PollRequestVIN: Not Awake Request not sent");
    return false;
  }
  auto poll_entry = std::shared_ptr<OvmsPoller::OnceOffPoll>(
      new OvmsPoller::OnceOffPoll(
        std::bind(&OvmsHyundaiIoniqEv::Incoming_Full, this, _1, _2, _3, _4,
_5),
        std::bind(&OvmsHyundaiIoniqEv::Incoming_Fail, this, _1, _2, _3, _4,
_5),
        VEHICLE_OBD_BROADCAST_MODULE_TX, VEHICLE_OBD_BROADCAST_MODULE_RX,
        VEHICLE_POLL_TYPE_OBDIIVEHICLE,  2,
        ISOTP_STD, 0, 3/*retries*/ ));
  PollRequest(m_can1, "!xiq.vin", poll_entry);
  return true;
}


On Sat, 17 Jun 2023 at 07:37, Solterra <solterra at kezarnet.com> wrote:

> Hello,
>
> I have a couple of questions on the CAN poll TX framework.
>
> Is there a recommended method for adding a one-time CAN poll to the
> queue with the response to be processed by IncomingPollReply?
>
> What is the recommended method for adding or modifying obdii_polls after
> initialization?
>
> Thank you
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20230617/6f837dfc/attachment.htm>


More information about the OvmsDev mailing list