<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div>I've fixed it, and should be ok now.<div><br></div><div>Regards, Mark.</div><div><br><div><div>On 21 Jan, 2014, at 2:29 am, Thomas Bergo <<a href="mailto:thomas.bergo@gmail.com">thomas.bergo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Mark.<div><br></div><div>it looks like you have forgot to change the car_tmotor to signed int?<br><div><br></div><div>From changes.txt:</div><div><pre class="" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"># Change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int</pre><pre class="" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"><br></pre><pre class="" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"><span style="font-family:arial;font-size:small;color:rgb(34,34,34)">From ovms.c</span>:</pre>
<pre class="" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"><span class="" style="color:rgb(68,85,136);font-weight:bold;line-height:18px">unsigned</span><span style="line-height:18px"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;line-height:18px">int</span><span style="line-height:18px"> </span><span class="" style="line-height:18px;background-color:rgb(255,255,255)">car_tmotor</span><span style="line-height:18px"> </span><span class="" style="font-weight:bold;line-height:18px">=</span><span style="line-height:18px"> </span><span class="" style="color:rgb(0,153,153);line-height:18px">0</span><span class="" style="line-height:18px">;</span><span style="line-height:18px"> </span><span class="" style="color:rgb(153,153,136);font-style:italic;line-height:18px">// Tmotor</span><br>
</pre><pre class="" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"><span class="" style="color:rgb(153,153,136);font-style:italic;line-height:18px"><br>
</span></pre><pre class="" style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51)"><span style="color:rgb(34,34,34);font-family:arial;font-size:small;white-space:normal">Regards, Thomas</span><br>
</pre></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014/1/14 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">Reviewing this, I find:<div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><font face="Andale Mono">extern signed char car_ambient_temp; // Ambient Temperature (celcius)</font></div><div><font face="Andale Mono">extern signed char car_tpem;         // Tpem</font></div><div class="im"><div><font face="Andale Mono">extern unsigned char car_tmotor;     // Tmotor</font></div>
</div><div><font face="Andale Mono">extern signed char car_tpms_t[4];    // TPMS temperature</font></div></blockquote></div><div><br></div><div>The car_tbattery and car_cooldown_tbattery are already signed int.</div><div>
<br></div><div>I propose to change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int. For the sake of 7 bytes I don't think it is worth the risk.</div><div><br></div><div>Code in vehicle_twizy.c is a good example of guarding for this:</div>
<div><br></div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="Andale Mono">      // MOTOR TEMPERATURE:</font></div><div><font face="Andale Mono">      if (CAN_BYTE(5) > 40 && CAN_BYTE(5) < 0xf0)</font></div>
<div><font face="Andale Mono">        car_tmotor = CAN_BYTE(5) - 40;</font></div><div><font face="Andale Mono">      else</font></div><div><font face="Andale Mono">        car_tmotor = 0; // unsigned, no negative temps allowed...</font></div>
</blockquote></div><div><br></div><div>Simplifying code like that will probably save as much flash as we lose in going from 8 to 16 bits.</div><div><br></div><div>Once we've got over the current compilation flags / space issue with the 1.6 firmware, I'll make this change.</div>
<div><br></div><div>Regards, Mark.</div><div><div class="h5"><br><div><div>On 13 Jan, 2014, at 10:46 pm, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" target="_blank">mark@webb-johnson.net</a>> wrote:</div>
<br><blockquote type="cite"><div dir="auto"><div>Sound advise.</div><div><br></div><div>Given just a handful of temperatures, it is probably least impacting to just change to 16 bit signed and put this one to rest. It keeps coming back, and it would be good to solve it once and for all. Impact is 1 byte extra ram per temperature, plus some flash for the 16 vs 8 bit.</div>
<div><br></div><div>Moving to a 40C offset is tricky to maintain backwards compatibility.</div><div><br></div><div>Regards, Mark</div><div><br>On 13 Jan, 2014, at 9:51 pm, Collin Kidder <<a href="mailto:collink@kkmfg.com" target="_blank">collink@kkmfg.com</a>> wrote:<br>
<br></div><blockquote type="cite"><div dir="ltr">I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.<br>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <span dir="ltr"><<a href="mailto:hakon.markussen@gmail.com" target="_blank">hakon.markussen@gmail.com</a>></span> wrote:<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 (Mark).<br><br></div>In ovms.h the motor temperature is defined as unsigned char (non-negative):<br>

extern unsigned char car_tmotor; // Tmotor<br><br></div>Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.<br>
<br></div><br><div><div><div>Is it possible to update the car_tmotor to<br>extern signed char car_tmotor; // Tmotor<br></div><div> in ovms.h?<br></div><div><br></div><div>Best regards<span><font color="#888888"><br>
</font></span></div><span><font color="#888888">Håkon<br></font></span></div>
</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></div>
</blockquote><blockquote type="cite"><span>_______________________________________________</span><br><span>OvmsDev mailing list</span><br><span><a href="mailto:OvmsDev@lists.teslaclub.hk" target="_blank">OvmsDev@lists.teslaclub.hk</a></span><br>
<span><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" target="_blank">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a></span><br></blockquote></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><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>
_______________________________________________<br>OvmsDev mailing list<br><a href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a><br>http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br></blockquote></div><br></div></body></html>