<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Mark,<br>
<br>
Thanks for forwarding, and Yay! Glad the facility is providing some
value.<br>
<br>
Sorry about the coding error on the example. I've not done much
with coding in Javascript, and was leveraging some other random
example. Newbie mistake. <br>
<br>
To his comment about the 1.6 correction factor for speed, that's
apparently a metric conversion, i.e. his car is recording miles/hr
in the vehicle metrics table, and his display is (correctly)
expecting an input of kilometers (even though it may be displaying
in miles). Do you know what sort of vehicle he's using? Aren't all
metrics standardized in metric units?<br>
<br>
The MAF "high byte" thing is a puzzle. I checked the code, and it
looks correct in terms of forwarding both bytes. But as I noted in
the source, the conversion factor used in a car display is a bit of
a mystery. As used with my test HUD, the display has a range of
0-19.9, and I had to apply a multiplier of 3.0 to get it to display
correctly (should not be applied in his case, since he's scripted),
so I would not be surprised if his display has its own quirks. I
was only able to map the metric to something small for testing,
hence the default mapping of MAF to v.b.12v.voltage.<br>
<br>
Sanity check... In the MAF code, I test to be sure that the metric
is not being run through a script, and only apply my 3.0 fudge
factor if it is not. The test is:<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<blockquote><tt><span class="pl-k">if</span></tt><tt>(m_pidmap[mapped_pid]-></tt><tt><span
class="pl-c1">GetType</span></tt><tt>() != obd2pid::Script)
metric = metric*</tt><tt><span class="pl-c1">3.0</span></tt><tt>;</tt><br>
</blockquote>
I presume this is correct, and that in his case (running through a
script) my fudge factor will not be applied. Yes? Otherwise, his
dividing by 2.56 might simply be un-doing my multiplying by 3.0, or
nearly so.<br>
<br>
Greg<br>
<br>
<br>
<div class="moz-cite-prefix">Mark Webb-Johnson wrote:<br>
</div>
<blockquote type="cite"
cite="mid:48506D0D-915C-4E28-8833-B4832BEC7070@webb-johnson.net">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div class=""><br class="">
</div>
<div class="">I got this feedback today from one of our users, and
thought it worthwhile to share. Good to see this facility
getting some use.</div>
<div class=""><br class="">
</div>
<div class="">Regards, Mark.</div>
<div class=""><br class="">
</div>
<div class="">P.S. I have made the documentation change he pointed
out.</div>
<br class="">
<div>
<blockquote type="cite" class="">
<table valign="middle" class="bodyStyle" style="padding: 10px;
caret-color: rgb(2, 2, 2); font-family: Helvetica;
letter-spacing: normal; orphans: auto; text-indent: 0px;
text-transform: none; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; background-color: rgb(255, 255, 255); text-decoration:
none;" cellspacing="0" cellpadding="0" border="0">
<tbody class="">
<tr class="">
<td class="wrapperStyle" style="direction: ltr;
background-color: rgb(254, 254, 254); margin: 0px 0px
15px; border-style: solid none none; border-top-width:
2px; border-top-color: rgb(204, 0, 0);
border-top-left-radius: 1px; border-top-right-radius:
1px; border-bottom-right-radius: 1px;
border-bottom-left-radius: 1px; box-shadow: rgba(0, 0,
0, 0.1) 1px 2px 3px;" valign="top" bgcolor="#FEFEFE">
<table dir="LTR" class="innerWrapperStyle"
style="background-image: none; margin: 0px; padding:
0px; border: none; direction: ltr;
background-position: initial initial;
background-repeat: initial initial;" cellspacing="0"
cellpadding="0" border="0">
<tbody class="">
<tr class="">
<td class="contentStyle" style="padding: 1em;
font-size: 14px; font-family: Roboto,
sans-serif; line-height: 1.28; color: rgb(2,
2, 2);">
<p class="replyNoticeStyle" style="margin-top:
0px;"><a
href="http://email.teslamotorsclub.com/c/eJxtTkFuxCAQe01yIwISyHLgsJf-YxgmDW1gVkC23y-9V7Is2bItR48qOPOYkwdtLAVLWsk1BtLmALevdOxgHQBZK8FIGXHaZKd2QebOteF1hwU5z6ffFVpFmwtSGWPsakdVITo80CBomC9_9v5q0_qc9MfAPzN_bsbByOVNtUFPXNrQ_M5NREbRsKZXT-VTHFwFh5iSILwXvSm9P0byLpUgztVnqN_j7A-FIL74LI3LUqj_AobJT-E"
class="linkStyle" style="font-family:
"Roboto Slab", serif; font-size:
18pt; color: rgb(98, 98, 98);
text-decoration: none;"
moz-do-not-send="true">OVMS doc -
Scripting for OBDII ECU</a></p>
<hr class="hrStyle" style="height: 1px;
margin: 10px 0px; border: 0px; color:
rgb(254, 254, 254); background-color:
rgb(254, 254, 254);">
<table style="margin: 10px 0px 20px;" class=""
width="100%" cellspacing="0" cellpadding="0"
border="0">
<tbody class="">
<tr class="" valign="top">
<td class="profileBlockStyle"
style="font-size: 13px; line-height:
1.231; padding-right: 20px;"
valign="top">
<div class="profileWrapperStyle"
style="display: block;
text-decoration: none;
background-color: rgb(254, 254,
254); margin-bottom: 10px;"><br
class="">
<span class="profileSpacerStyle"
style="padding: 3px 5px; display:
block;"> </span></div>
</td>
<td class="messageBlockStyle"
style="color: rgb(2, 2, 2);
font-family: Georgia, "Times New
Roman", Times, serif; font-size:
11pt; line-height: 1.4;" width="100%">I
finally got around to playing a bit
with the OBDII ECU scripting facility
- it's a great tool.<br class="">
<br class="">
I came across a minor error in the doc
that had me tripped up for a while and
I hope you could channel this to the
right person to get it updated.<br
class="">
<br class="">
I am referring to the Google doc "OVMS
v3 Advanced User Guide"<br class="">
<br class="">
In the "Metrics scripts" section is
the following example:<br class="">
<div class="codeWrapperStyle"
style="background-color: rgb(242,
242, 242); overflow: auto; margin:
1em auto;">
<pre class="codeStyle" title="Code" style="margin: 0px; padding: 0px 15px; font-size: 10pt; font-family: Consolas, "Courier New", Courier, monospace; background-color: rgb(242, 242, 242); word-wrap: normal; overflow: auto; line-height: 26px; direction: ltr; background-position: center top; background-repeat: repeat no-repeat;">ret1=OvmsMetricFloat("v.p.speed");
ret2=OvmsMetricFloat("v.b.power");
out=0.0;
if (ret1 > 0) { out=ret2/ret1; }
out;
</pre>
</div>
This fails since OvmsMetricFloat is
undefined - it should say
"OvmsMetrics.AsFloat" in the first two
rows.<br class="">
<br class="">
I managed to get my Pioneer NEX radio
to show a speedometer on the home
screen at last - it turns out it can
only show a subset of gauges on the
home screen, and the speedometer is
not one of them (it offers a tach and
MAF). the MAF can be tweaked to show
the correct range: by setting it to
metric (g/s) the range can be adjusted
to 0-120. Somehow I need to multiply
v.p.speed by 1.6 to get the correct
mph output (which doesn't make sense
to me) and then divide it by 2.56
since the OBDII ECU only sends the
hibyte of the MAF response, and this
is parsed as (256 * A + B)/100.<br
class="">
<br class="">
Thank you again for all the help (and
the great work on OVMS!),<br class="">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.openvehicles.com">OvmsDev@lists.openvehicles.com</a>
<a class="moz-txt-link-freetext" href="http://lists.openvehicles.com/mailman/listinfo/ovmsdev">http://lists.openvehicles.com/mailman/listinfo/ovmsdev</a>
</pre>
</blockquote>
<br>
</body>
</html>