<div dir="ltr">Have tested the new 2.6.2 code since yesterday, and so far it's look good.<div><br></div><div>Needed to move some of the data converting out of the interrupt routine.</div><div>Have also added reading of VIN and corrected some error on cars using miles.</div>
<div><br></div><div>Regards, Thomas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/24 Mark Webb-Johnson <span dir="ltr"><<a href="mailto:mark@webb-johnson.net" target="_blank">mark@webb-johnson.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Matt,<div><br></div><div>From a developer's point of view?</div><div><br></div><div>
No, I haven't updated the developers guide yet. The best (and only) example code that uses it is in vehicle_obdii.c.</div><div><br></div><div>Rough description is:</div><div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>To use the new OBDII polling code, create a rom-based structure detailing what PIDs you want to poll. For the base obdii vehicle, it looks like this:</div><div><br></div></blockquote></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px">rom vehicle_pid_t vehicle_obdii_polls[]</span></font></div></div></blockquote></div><div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> =</span></font></div></div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div><font face="Andale Mono"><span style="font-size:14px"> {</span></font></div></div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x05, { 0, 30, 30 } }, // Engine coolant temp</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x0c, { 10, 10, 10 } }, // Engine RPM</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x0d, { 0, 10, 10 } }, // Speed</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x0f, { 0, 30, 30 } }, // Engine air intake temp</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x2f, { 0, 30, 30 } }, // Fuel level</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x46, { 0, 30, 30 } }, // Ambiant temp</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIICURRENT, 0x5c, { 0, 30, 30 } }, // Engine oil temp</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0x7df, VEHICLE_POLL_TYPE_OBDIIVEHICLE, 0x02, {999,999,999 } }, // VIN</span></font></div>
</div></blockquote></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> { 0, 0x00, 0x00, { 0, 0, 0 } }</span></font></div></div></blockquote>
</div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> };</span></font></div></div></blockquote></div></blockquote><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><br></div><div>It is an array of arrays. Each row is one PID to be polled, and the last row should be all zeros. The columns are:</div><div><ul><li>moduleid (CAN id of the request message)</li><li>type (see VEHICLE_POLL_TYPE_* in vehicle.h)</li>
<li>pid (the PID to be polled)</li><li>poll time (in seconds, three entries - one for each poll state)</li></ul></div><div><br></div><div>The system supports 3 poll states. You can use these how you want, but a typical example would be IDLE, CHARGING, DRIVING. These states are completely under your control, and allow you to set different poll times for different PIDs in different states. By setting poll time to 0, for a particular state, you can disable polling. You set the poll state in the global vehicle_poll_state variable via the vehicle_poll_setstate() call.</div>
<div><br></div><div>Once you've got everything setup, you need to start the polling, in your initialisation function:</div><div><br></div></blockquote></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="Andale Mono"><span style="font-size:14px">vehicle_fn_poll0 = &vehicle_obdii_poll0;</span></font></div><div><font face="Andale Mono"><span style="font-size:14px">vehicle_poll_setpidlist(vehicle_obdii_polls);</span></font></div>
<div><font face="Andale Mono"><span style="font-size:14px">vehicle_poll_setstate(0);</span></font></div></blockquote></blockquote><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><br></div><div>You tell the poller about you rom poll list with vehicle_poll_setpidlist(), and will be called back with poll results via the vehicle_fn_poll0() hook. </div>
<div><br></div><div>You will also need to 'tickle' the vehicle_poll_busactive global variable. The polling code will stop polling of vehicle_poll_busactive<=0. Normally, you would just set this to 60 (seconds) when you want polling to be active, and then decrement it in a ticker function (so it decrements to zero and stops polling automatically, unless the ticker is reset). Alternatively, you can just use it as an on/off switch (1 or 0).</div>
<div><br></div><div>The poll results will be delivered via the vehicle_fn_poll0() hook, in the normal way. It is your responsibility to extract the data from the can_databuffer as normal.</div><div><br></div><div>In the case of multi-message responses (for some poll types like VEHICLE_POLL_TYPE_OBDIIVEHICLE), the system will maintain a global vehicle_poll_ml_offset variable, recording the current offset and vehicle_poll_ml_remain recording the number of bytes remaining. See the example in vehicle_obdii.c for how to handle this:</div>
<div><br></div></blockquote></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Andale Mono"><span style="font-size:14px"> case 0x02: // VIN (multi-line response)</span></font></div>
<div><font face="Andale Mono"><span style="font-size:14px"> for (value1=0;value1<can_datalength;value1++)</span></font></div><div><font face="Andale Mono"><span style="font-size:14px"> {</span></font></div>
<div><font face="Andale Mono"><span style="font-size:14px"> car_vin[value1+(vehicle_poll_ml_offset-can_datalength)] = can_databuffer[value1];</span></font></div><div><font face="Andale Mono"><span style="font-size:14px"> }</span></font></div>
<div><font face="Andale Mono"><span style="font-size:14px"> if (vehicle_poll_ml_remain==0)</span></font></div><div><font face="Andale Mono"><span style="font-size:14px"> car_vin[value1+vehicle_poll_ml_offset] = 0;</span></font></div>
</div></blockquote></div></blockquote><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><br></div><div>This is a base framework, that can be extended over time (as different vehicles use different polling frameworks). It does remove the majority of the tedious polling work from </div>
</blockquote></div><div><br></div><div>Hope the above helps. I'll use it as the basis for the developer's guide update.</div><div><br></div><div>Regards, Mark.</div><div><div class="h5"><div><br><div><div>On 23 Jan, 2014, at 10:34 pm, Matt Beard OVMS <<a href="mailto:smvo@mxf.org.uk" target="_blank">smvo@mxf.org.uk</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr"><div>Is there an simple explanation somewhere of the change to the polling system?<br><br></div>Matt Beard<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 23 January 2014 12:11, Mark Webb-Johnson <span dir="ltr"><<a href="mailto:mark@webb-johnson.net" target="_blank">mark@webb-johnson.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Michael,<div><br></div><div>Yep, thats it.</div><div><br></div><div>Problem is OVMS_POLLER is a compile-time definition, so it must be shared by all cars in the configuration. Ive re-worked it slightly to call the poll0 function even there is no poll list defined:</div>
<div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>diff --git a/vehicle/OVMS.X/vehicle.c b/vehicle/OVMS.X/vehicle.c</div><div>index 9c1e9d9..a706bf1 100644</div><div>--- a/vehicle/OVMS.X/vehicle.c</div>
<div>+++ b/vehicle/OVMS.X/vehicle.c</div><div>@@ -295,15 +295,21 @@ void high_isr(void)</div><div><div> can_databuffer[7] = RXB0D7;</div><div> RXB0CONbits.RXFUL = 0; // All bytes read, Clear flag</div>
</div>
<div> #ifdef OVMS_POLLER</div><div>- if ((vehicle_poll_plist != NULL)&&</div><div>- (can_id >= vehicle_poll_moduleid_low)&&</div><div>- (can_id <= vehicle_poll_moduleid_high))</div>
<div>
+ if (vehicle_poll_plist != NULL)</div><div> {</div><div>- if (vehicle_poll_poll0())</div><div>+ if ((can_id >= vehicle_poll_moduleid_low)&&</div><div>+ (can_id <= vehicle_poll_moduleid_high))</div>
<div> {</div><div>- vehicle_fn_poll0();</div><div>+ if (vehicle_poll_poll0())</div><div>+ {</div><div>+ vehicle_fn_poll0();</div><div>+ }</div><div> }</div><div> }</div>
<div>+ else</div><div>+ {</div><div>+ vehicle_fn_poll0();</div><div>+ }</div><div> #else // #ifdef OVMS_POLLER</div><div> vehicle_fn_poll0();</div><div> #endif //#ifdef OVMS_POLLER</div></blockquote>
</div><div><br></div><div>I hope this fixes it.</div><div><br></div><div>Thomas: Can you try to build this version (it is in github master now).</div><div><br></div><div>Regards, Mark.</div><div><br><div><div><div>
<div>On 23 Jan, 2014, at 4:29 pm, Michael Balzer <<a href="mailto:dexter@expeedo.de" target="_blank">dexter@expeedo.de</a>> wrote:</div><br></div></div><blockquote type="cite"><div><div>
<div bgcolor="#FFFFFF" text="#000000">
Mark,<br>
<br>
if the Mitsubishi code does not use the new polling hooks, poll0()
will not be called if the polling code is compiled in.<br>
<br>
I had the same problem for the Twizy, that's why I introduced the
OVMS_POLLER compiler switch.<br>
<br>
Regards,<br>
Michael<br>
<br>
<br>
<div>Am 22.01.2014 02:18, schrieb Mark
Webb-Johnson:<br>
</div>
<blockquote type="cite">
Thomas,
<div><br>
</div>
<div>Strange. So far, I see 4 cars using 2.6.2, but only one
(presumably yours) is showing authentication errors.</div>
<div><br>
</div>
<div>I also can't see any changes to the vehicle_mitsubishi.c code
that would cause poll0 to stop working. It is certainly working
in other vehicle modules.<br>
<div><br>
</div>
<div>I'll keep looking, but would be grateful if you could try
to narrow down the poll0 problem.</div>
<div><br>
</div>
<div>Regards, Mark.</div>
<div><br>
<div>
<div>On 22 Jan, 2014, at 5:00 am, Thomas Bergo <<a href="mailto:thomas.bergo@gmail.com" target="_blank">thomas.bergo@gmail.com</a>>
wrote:</div>
<br>
<blockquote type="cite">
<div dir="ltr">Mark,
<div><br>
</div>
<div>Was testing the new 2.6.2 code on i-Miev today. </div>
<div><br>
</div>
<div>Two observations:</div>
<div>- Lots of restarts and "Vehicle authentication
failed" messages in the iOS app </div>
<div>- No CAN bus messages form PID in poll0, while
messages in poll1 is working OK.</div>
<div><br>
</div>
<div>Programmed the OVMS module with a version, and
verified that the module was OK.</div>
<div><br>
</div>
<div>Regards, Thomas</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2013/10/30 Thomas Bergo <span dir="ltr"><<a href="mailto:thomas.bergo@gmail.com" target="_blank">thomas.bergo@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Matt,
<div><br>
</div>
<div>Please report back when you have done some
testing on the QC.</div>
<div><br>
</div>
<div>If the car report 0A while QC, the current
code will not detect that we are charging. So
then we need to rely on the estimated range
reported as 255 to detecting that the car is QC.</div>
<div><br>
</div>
<div>Regards, Thomas </div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2013/10/30 Matt Beard
OVMS <span dir="ltr"><<a href="mailto:smvo@mxf.org.uk" target="_blank">smvo@mxf.org.uk</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>Hi Thomas,<br>
<br>
</div>
During QC you don't get valid values
reported in 0x389 - it seems to be
constant 255V, 0A during QC.<br>
<br>
</div>
My code is relying on the fact that
the estimated range only ever seems to
be reported as 255 during QC (except
for the first few messages at startup,
but those are easy to filter out). In
my testing so far this seems to work
for detecting the start and end of QC.
I am going to be doing 3 more tests
today with my latest code and will
report back later.<span><font color="#888888"><br>
<br>
</font></span></div>
<span><font color="#888888">Matt<br>
<br>
</font></span></div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>On 27 October 2013 20:13, Thomas
Bergo <span dir="ltr"><<a href="mailto:thomas.bergo@gmail.com" target="_blank">thomas.bergo@gmail.com</a>></span>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div dir="ltr">Hi Matt
<div><br>
</div>
<div>I have started to look into
the QC code. And i have one
concern. </div>
<div>
Have you seen if the voltage
and charging current (PID
0x389) is reported during QC? </div>
<div>If not, we are not able to
detect that the car is
charging during QC with
current code.</div>
<span><font color="#888888">
<div><br>
</div>
<div>Thomas</div>
<div class="gmail_extra"><br>
<br>
</div>
</font></span></div>
<br>
</div>
<div>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br>
</div>
</blockquote>
</div>
<br>
</div>
<br>
_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
OvmsDev mailing list
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
</div>
</div></div><span><dexter.vcf></span>_______________________________________________<div><br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></div></blockquote></div><br></div></div><br>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a><br><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
OvmsDev mailing list<br>
<a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br>
<br></blockquote></div><br></div>