<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Michael,<br>
<br>
Am 03.07.21 um 06:48 schrieb Michael Iimura:<br>
<blockquote type="cite"
cite="mid:CAF4Qz5He+0ConKuN3A3s0Uj-KVM0pgjUdFQ49j7R583kKWhcFQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">L:/OVMS/home/miimura/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle_toyotarav4ev/src/vehicle_toyotarav4ev.cpp:100:50:
error: invalid use of member
'OvmsVehicleToyotaRav4Ev::m_v_bat_cool_in_temp' in static
member function<br>
<div> c.printf("<p>Battery Coolant Inlet: %.1f
C</p>", m_v_bat_cool_in_temp->AsFloat());<br>
^<br>
In file included from
L:/OVMS/home/miimura/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle_toyotarav4ev/src/vehicle_toyotarav4ev.cpp:38:0:<br>
L:/OVMS/home/miimura/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/vehicle_toyotarav4ev/src/vehicle_toyotarav4ev.h:90:22:
note: declared here<br>
OvmsMetricFloat *m_v_bat_cool_in_temp;<br>
^<br>
</div>
</div>
Anybody have a clue what I'm doing wrong here?</div>
</blockquote>
<br>
as Steve already explained, if you want to access a member variable,
you need to get the object (vehicle) pointer. You could do so by
calling MyVehicleFactory.ActiveVehicle().<br>
<br>
But do you really want a static metric value in a web page? Why not
use a standard metric display so you can see the dynamic value
changes?<br>
<br>
To do so, you simply need to add class "receiver" to e.g. your main
panel div, then do:<br>
<br>
<font face="monospace"> c.printf("<p>Battery Coolant Inlet:
<span class=\"metric\"
data-metric=\"xr4.v.b.t.cltin\">?</span> C</p>");</font><br>
<br>
Or, using the metric number widget to get some default layout &
style:<br>
<pre id="codecell0" style="box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", Courier, monospace; font-size: 12px; white-space: pre; margin: 0px; padding: 12px; display: block; overflow: auto; line-height: 1.4; color: rgb(64, 64, 64); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <span class="p" style="box-sizing: border-box;"><</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">div</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">class</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"receiver"</span><span class="p" style="box-sizing: border-box;">></span>
...
<span class="p" style="box-sizing: border-box;"><</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">div</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">class</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"metric number"</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">data-metric</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);"><span style="color: rgb(3, 47, 98); font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(230, 255, 236); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">xr4.v.b.t.cltin</span>"</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">data-prec</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"1"</span><span class="p" style="box-sizing: border-box;">></span>
<span class="p" style="box-sizing: border-box;"><</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">span</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">class</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"label"</span><span class="p" style="box-sizing: border-box;">></span>Battery Coolant Inlet:<span class="p" style="box-sizing: border-box;"></</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">span</span><span class="p" style="box-sizing: border-box;">></span>
<span class="p" style="box-sizing: border-box;"><</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">span</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">class</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"value"</span><span class="p" style="box-sizing: border-box;">></span>?<span class="p" style="box-sizing: border-box;"></</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">span</span><span class="p" style="box-sizing: border-box;">></span>
<span class="p" style="box-sizing: border-box;"><</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">span</span> <span class="na" style="box-sizing: border-box; color: rgb(125, 144, 41);">class</span><span class="o" style="box-sizing: border-box; color: rgb(102, 102, 102);">=</span><span class="s" style="box-sizing: border-box; color: rgb(186, 33, 33);">"unit"</span><span class="p" style="box-sizing: border-box;">></span>°C<span class="p" style="box-sizing: border-box;"></</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">span</span><span class="p" style="box-sizing: border-box;">></span>
<span class="p" style="box-sizing: border-box;"></</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">div</span><span class="p" style="box-sizing: border-box;">></span>
...
<span class="p" style="box-sizing: border-box;"></</span><span class="nt" style="box-sizing: border-box; color: rgb(0, 128, 0); font-weight: bold;">div</span><span class="p" style="box-sizing: border-box;">></span>
</pre>
See
<a class="moz-txt-link-freetext" href="https://docs.openvehicles.com/en/latest/components/ovms_webserver/docs/metrics.html">https://docs.openvehicles.com/en/latest/components/ovms_webserver/docs/metrics.html</a>
for the full reference.<br>
<br>
Regards,<br>
Michael<br>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
</body>
</html>