<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div>In general, I try to minimise stack and ram usage on the small PICs.<div><br></div><div>Early on in OVMS, we had a bunch of local variables, and some were quite large. We were getting all sorts of random weird behavior (reboots, corrupt messages, etc). Since we changed to global variables, and very limited use of stacked function calls and local variables, things have been much better.</div><div><br></div><div>I agree that a large sprintf may be the cause of your problems. Can you try to change to itoa() and strcat(), to see if it makes an impact?</div><div><br></div><div>Regards, Mark.</div><div><br><div><div>On 18 Dec, 2012, at 8:05 AM, Michael Balzer wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div bgcolor="#FFFFFF" text="#000000">
    Mark,<br>
    <br>
    the client_app.pl hint was good, I had not recognized that as a
    server query utility yet.<br>
    <br>
    I removed the comma (misread the draft) and can now see my H
    entries. However, that lead me back to my assumed connectivity
    issue:<br>
    <br>
    MP-0 c31,0,2,6,RTPWR-BattCell,1,1,76,2012-12-17 23:18:43,2012-12-17
    23:18:43<br>
    MP-0 c31,0,3,6,RT-PWR-BattCell,14,16,1215,2012-12-17
    23:13:11,2012-12-17 23:18:43<br>
    MP-0 c31,0,4,6,RT-PWR-BattC�ll,1,1,65,2012-12-17 23:18:43,2012-12-17
    23:18:43<br>
    MP-0 c31,0,5,6,RT-PWR-BattPack,1,2,202,2012-12-17
    23:13:11,2012-12-17 23:18:43<br>
    MP-0 c31,0,6,6,RT-PWR-Usag,1,1,45,2012-12-17 23:13:11,2012-12-17
    23:13:11<br>
    <br>
    This C31 result shows all kinds of garbled chars in my module's
    messages, and even a truncation on "RT-PWR-UsageStats" (also missing
    parts on the data blob on that one).<br>
    <br>
    Now that's a bit odd and most probably cannot be connected to a GPRS
    link failure -- as that would not garble single bytes in a TCP
    connection.<br>
    <br>
    I could fix some similar output problems in DIAG mode more than once
    by reducing complex sprintf() calls, so I searched for C18 sprintf()
    stack usage and found nothing concrete, but many warnings about very
    high stack usage of the whole printf family, plus advice not to use
    them at all on small embedded systems. One source mentioned
    sprintf() will need 70+ bytes stack for a simple integer template.<br>
    <br>
    I also have read a bit into the C18 software stack management and
    found my previous assumption to be correct: it's currently fixed to
    bank 12 (0xC00), so provides 256 bytes for any kind of parameter +
    local vars combination. I think sprintf() on a 256 byte stack could
    well be a source of problems... and stack overruns can produce weird
    effects, as those above. I think about rewriting all my sprintf
    calls to itoa/ltoa/ultoa, but find it strange they did no harm up to
    now, even with complex templates as in net_msgp_environment(). Or
    maybe they did, unrecognized?<br>
    <br>
    Do you have some other info on C18 sprintf()? I'd rather avoid
    recoding every output without sprintf(), but that's my best bet
    currently...<br>
    <br>
    Regards,<br>
    Michael<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">Am 17.12.2012 07:37, schrieb Mark
      Webb-Johnson:<br>
    </div>
    <blockquote cite="mid:EB202381-4262-4192-B3D5-BFA158DC67B5@webb-johnson.net" type="cite">
      <div><br>
      </div>
      This has been completed, and is now live on both tmc and
      development OVMS servers.
      <div><br>
      </div>
      <div>Server identifies itself as 2.1.1-20121216.</div>
      <div><br>
      </div>
      <div>It was implemented in three places:</div>
      <div><br>
      </div>
      <div>
        <ol class="MailOutline">
          <li>A new "H" record type - not stored in the carmessages
            table, but inserted with a timestamp into
            historicalmessages.</li>
          <li>A new command 31 - retrieving a summary of what historical
            data the server has for the vehicle.</li>
          <li>A new command 32 - retrieving detailed historical data
            records of the specified type.</li>
        </ol>
      </div>
      <div><br>
      </div>
      <div>I haven't implement data expunging yet. It is actually a
        one-liner, but I've left it out on purpose, since I want to see
        what data is added to make sure everything works correctly.</div>
      <div><br>
      </div>
      <div>Michael: Can you try to send your battery data with this new
        "H" type, and let me know when done so I can check server
        storage.</div>
      <div><br>
      </div>
      <div>It is a pretty simple change to the sample client_app.pl code
        to retrieve the summary and/or detailed historical records, if
        you want to see for yourself.</div>
      <div><br>
      </div>
      <div>Regards, Mark.</div>
      <div><br>
      </div>
      <div>
        <div>
          <div>On 16 Dec, 2012, at 10:28 AM, Mark Webb-Johnson wrote:</div>
          <br class="Apple-interchange-newline">
          <blockquote type="cite">
            <meta http-equiv="content-type" content="text/html;
              charset=ISO-8859-1">
            <div dir="auto">
              <div>Ok.</div>
              <div><br>
              </div>
              <div>But, lets keep the *- prefix for generic. Easier to
                split the fields later in the database, and only 2 bytes
                extra per record.</div>
              <div><br>
              </div>
              <div>I'll try to get the server side of this done today.</div>
              <div><br>
              </div>
              <div>Regards, Mark<br>
                <br>
                On 15 Dec, 2012, at 7:19 PM, Michael Balzer <<a moz-do-not-send="true" href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>>
                wrote:<br>
                <br>
              </div>
              <blockquote type="cite">
                <div>
                  <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
                  Too fast... regarding the class definitions, to
                  achieve readability here as well I would then suggest
                  using a 3 letter abbreviation.<br>
                  <br>
                  ...main classes:<br>
                      <br>
                      Power                PWR<br>
                      Engine                ENG<br>
                      Transmission        TRX<br>
                      Chassis                CHS<br>
                      Body                BDY<br>
                      Electrics            ELC<br>
                      <br>
                  ...auxiliary classes?<br>
                      <br>
                      Safety                SAF        (Chassis, Body,
                  Electrics)<br>
                      Security            SEC        (Power?, Body,
                  Electrics)<br>
                      Comfort                CMF        (Chassis, Body,
                  Electrics)<br>
                      Entertainment        ENT        (Body, Electrics)<br>
                      Communication        COM        (Body, Electrics)<br>
                      <br>
                  <br>
                  Also I would prefer "-" as a separator over ".".<br>
                  <br>
                  For my current application (battery pack + cell data),
                  that would result in type codes...<br>
                  <br>
                      RT-PWR-BattPack<br>
                      RT-PWR-BattCell<br>
                  <br>
                  ...or general form<br>
                  <br>
                      *-PWR-BattPack<br>
                      *-PWR-BattCell<br>
                  <br>
                  Btw: general purpose codes could be written without
                  "*-" prefix as well? That would be...<br>
                  <br>
                      PWR-BattPack<br>
                      PWR-BattCell<br>
                  <br>
                  Regards,<br>
                  Michael<br>
                  <br>
                  <br>
                  <div class="moz-cite-prefix">Am 15.12.2012 12:01,
                    schrieb Michael Balzer:<br>
                  </div>
                  <blockquote cite="mid:50CC58A2.7010305@expeedo.de" type="cite">
                    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
                    Silly me just assumed you'd prefer integer... I'm
                    using text codes in my own DB designs whenever
                    possible due to readability.<br>
                    <br>
                    In other words: of course! :-)<br>
                    <br>
                    I'll modify my code now accordingly.<br>
                    <br>
                    <br>
                    <div class="moz-cite-prefix">Am 15.12.2012 11:48,
                      schrieb Mark Webb-Johnson:<br>
                    </div>
                    <blockquote cite="mid:3C91BB57-D70C-4A15-8A5A-893A893D2582@webb-johnson.net" type="cite">
                      <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
                      <div>The coding looks good, and sensible.</div>
                      <div><br>
                      </div>
                      <div>How about we just make it a text string,
                        rather than integer. Much clearer to read, and
                        almost no impact on size.</div>
                      <div><br>
                      </div>
                      <div>VV.C.P</div>
                      <div><br>
                      </div>
                      <div>VV the normal vehicle types, or '*' for
                        generic.</div>
                      <div>C your class</div>
                      <div>P your property<br>
                        <br>
                        On 15 Dec, 2012, at 6:53 AM, Michael Balzer <<a moz-do-not-send="true" href="mailto:dexter@expeedo.de">dexter@expeedo.de</a>>


                        wrote:<br>
                        <br>
                      </div>
                      <blockquote type="cite">
                        <div>
                          <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
                          Mark, List,<br>
                          <br>
                          <div class="moz-cite-prefix">Am 04.12.2012
                            20:43, schrieb Michael Balzer:<br>
                          </div>
                          <blockquote cite="mid:50BE5251.5080700@expeedo.de" type="cite">
                            <div>
                              <ul class="MailOutline">
                                <ul>
                                  <li>type (integer type code)</li>
                                </ul>
                              </ul>
                            </div>
                            For general purpose type codes, maybe some
                            classification scheme would make sense?
                            Maybe adopt some standard scheme already
                            defined for automotive data? ...if there is
                            one...<br>
                          </blockquote>
                          <br>
                          It seems there is none suitable, so here's my
                          attempt at defining one. Please comment.<br>
                          <br>
                          Regards,<br>
                          Michael<br>
                          <br>
                          <br>
                          Type classification scheme:<br>
                              id size: 32 bit integer<br>
                          <br>
                          Generic / standard props:<br>
                          <br>
                              0x 0000 C PPP<br>
                          <br>
                          Vehicle specific props:<br>
                          <br>
                              0x VVVV C PPP<br>
                          <br>
                              VVVV = Vehicle ID<br>
                                  0001 = Tesla Roadster<br>
                                  0002 = Tesla Model S<br>
                                  0003 = GM Volt / Opel Ampera<br>
                                  0004 = Renault Twizy<br>
                                  ...<br>
                          <br>
                          C = Class:<br>
                          <br>
                          ...main classes:<br>
                              <br>
                              0 = Power                <br>
                              1 = Engine                <br>
                              2 = Transmission        <br>
                              3 = Chassis                <br>
                              4 = Body                <br>
                              5 = Electrics            <br>
                              <br>
                          ...auxiliary classes?<br>
                              <br>
                              6 = Safety                (Chassis, Body,
                          Electrics)<br>
                              7 = Security            (Power?, Body,
                          Electrics)<br>
                              8 = Comfort                (Chassis, Body,
                          Electrics)<br>
                              9 = Entertainment        (Body, Electrics)<br>
                              a = Communication        (Body, Electrics)<br>
                              <br>
                              <br>
                              b = reserved<br>
                              c = reserved<br>
                              d = reserved<br>
                              e = reserved<br>
                              f = reserved<br>
                              <br>
                          <br>
                          PPP = Property<br>
                              ...allowing for 4096 properties per class.<br>
                          <br>
                          <br>
                          <br>
                          <br>
                          <pre class="moz-signature" cols="72">-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
                        </div>
                      </blockquote>
                      <blockquote type="cite">
                        <div><dexter.vcf></div>
                      </blockquote>
                      <blockquote type="cite">
                        <div><span>_______________________________________________</span><br>
                          <span>OvmsDev mailing list</span><br>
                          <span><a moz-do-not-send="true" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a></span><br>
                          <span><a moz-do-not-send="true" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a></span><br>
                        </div>
                      </blockquote>
                      <br>
                      <fieldset class="mimeAttachmentHeader"></fieldset>
                      <br>
                      <pre wrap="">_______________________________________________
OvmsDev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
                    </blockquote>
                    <br>
                    <pre class="moz-signature" cols="72">-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
                    <br>
                    <fieldset class="mimeAttachmentHeader"></fieldset>
                    <br>
                    <pre wrap="">_______________________________________________
OvmsDev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
                  </blockquote>
                  <br>
                  <pre class="moz-signature" cols="72">-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
                </div>
              </blockquote>
              <blockquote type="cite">
                <div><dexter.vcf></div>
              </blockquote>
              <blockquote type="cite">
                <div><span>_______________________________________________</span><br>
                  <span>OvmsDev mailing list</span><br>
                  <span><a moz-do-not-send="true" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a></span><br>
                  <span><a moz-do-not-send="true" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a></span><br>
                </div>
              </blockquote>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
OvmsDev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OvmsDev@lists.teslaclub.hk">OvmsDev@lists.teslaclub.hk</a>
<a class="moz-txt-link-freetext" href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26
</pre>
  </div>

<span><dexter.vcf></span>_______________________________________________<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>