[Ovmsdev] OBDII vehicle chicken-n-egg issue

Michael Balzer dexter at expeedo.de
Sun Oct 2 16:27:50 HKT 2022


the initial poll state is set by the constructor to 0. Poll state 0 
enables polling of the VIN (every 999 seconds) and the engine RPM (every 
10 seconds) entry of the polls list.

PollSetState(0) does not disable the polling, it just sets the state to 
0. You can currently use up to four states.

I wrote some documenting comments on the poller in vehicle_poller.cpp 
and vehicle.h. A developer manual page is still todo.

You can also hook into the CAN error reporting or query the error state 
from PollerStateTicker() to detect when the bus goes offline. See the 
Hyundai code for an example on this.


Am 02.10.22 um 04:17 schrieb Craig Leres:
> I cloned the OBDII module when I started work on the C6 Corvette and 
> 2nd gen CTS modules. Trying to debug my C6 Corvette canbus issues I'm 
> not understanding how OBD polling works.
> What I see when I look at vehicle_obdii.cpp is that there is a list of 
> pids that are polled. However, OvmsVehicleOBDII::IncomingPollReply() 
> is the only place that *enables* polling:
>     case 0x0c:  // Engine RPM
>       if (value2 == 0)
>         { // Car engine is OFF
>         PollSetState(0);
>         StandardMetrics.ms_v_env_handbrake->SetValue(true);
>         StandardMetrics.ms_v_env_on->SetValue(false);
>         StandardMetrics.ms_v_pos_speed->SetValue(0);
>         StandardMetrics.ms_v_env_charging12v->SetValue(false);
>         }
>       else
>         { // Car engine is ON
>         PollSetState(1);
>         StandardMetrics.ms_v_env_handbrake->SetValue(false);
>         StandardMetrics.ms_v_env_on->SetValue(true);
>         StandardMetrics.ms_v_env_charging12v->SetValue(true);
>         }
>       break;
> I can only assume "engine RPM" canbus frames are always sent by the 
> vehicle (not unreasonable); but then I don't understand why we are 
> polling for it? I guess I would expect ms_v_env_on state changes to 
> happen in SOvmsVehicleOBDII::IncomingFrameCan1(). But maybe 
> OvmsVehicleOBDII::IncomingPollReply() gets engine RPM frames since 
> they are on the list of things we're polling for? So if we didn't 
> handle them in IncomingPollReply() we'd have to add a 
> IncomingFrameCan1() routine?
> Playing around with savvycan I find it's possible to have the C6 
> Corvette, with engine running, to not be "on" but still send canbus 
> frames to savvycan (at least until *it* gives up and disconnects). 
> This makes me think I'm getting into a situation where ovms does not 
> detect that the car is on but not because the canbus is not working 
> due to logic errors on my part. Certainly "can can1 status" reports a 
> similar number of tx fails when compared to my working vehicle (2nd 
> gen Cadillac).
>         Craig
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev

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

-------------- 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/20221002/df9ead8f/attachment.sig>

More information about the OvmsDev mailing list