<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>On 02/05/18 01:08, ovms wrote:<br>
    </p>
    <blockquote type="cite"
      cite="mid:c0421900-ad2c-43e8-bc03-74595acea9aa@DISKSTATION2">
      <div>Think I found out why I was unable to send mail to this list.
        (wrong sender address)</div>
      <div> </div>
      <div>My 2016 Leaf still has flapping SOC.</div>
    </blockquote>
    <br>
    Do you have a 30kWh battery?<br>
    <br>
    <blockquote type="cite"
      cite="mid:c0421900-ad2c-43e8-bc03-74595acea9aa@DISKSTATION2">
      <div>I made the following changes in vehicle_nissanleaf.cpp and
        compiled the code.</div>
      <div> </div>
      <div>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #272ad8; background-color: #ffffff;"><strong><span
              style="color: #ba2da2;">case</span> 0x50d</strong><span
            style="color: #000000;"><strong>:</strong>   //Changed this
            from 5bc. 50d is the instrument SOC</span></p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">   </span> {</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span> uint16_t nl_gids
          = ((uint16_t) d[<span style="color: #272ad8;">0</span>]
          << <span style="color: #272ad8;">2</span>) | ((d[<span
            style="color: #272ad8;">1</span>] & <span style="color:
            #272ad8;">0xc0</span>) >> <span style="color:
            #272ad8;">6</span>);</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span> <span
            style="color: #ba2da2;">if</span> (nl_gids == <span
            style="color: #272ad8;">1023</span>)</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">       </span> {</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #008400; background-color: #ffffff;"><span
            style="color: #000000;"><span class="Apple-converted-space"> 
                    </span></span></p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">       </span> <span
            style="color: #ba2da2;">break</span>;</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">       </span> }</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span> uint16_t max_gids
          = MyConfig.GetParamValueInt(<span style="color: #d12f1b;">"xnl"</span>,
          <span style="color: #d12f1b;">"maxGids"</span>,
          GEN_1_NEW_CAR_GIDS);</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span> <span
            style="color: #ba2da2;">float</span> km_per_kwh =
          MyConfig.GetParamValueFloat(<span style="color: #d12f1b;">"xnl"</span>,
          <span style="color: #d12f1b;">"kmPerKWh"</span>,
          GEN_1_KM_PER_KWH);</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span> <span
            style="color: #ba2da2;">float</span> wh_per_gid =
          MyConfig.GetParamValueFloat(<span style="color: #d12f1b;">"xnl"</span>,
          <span style="color: #d12f1b;">"whPerGid"</span>,
          GEN_1_WH_PER_GID);</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px
          Helvetica; background-color: #ffffff; min-height: 14.0px;"> </p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span>
          m_gids->SetValue(nl_gids);</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"><span
            class="Apple-converted-space">     </span>
          StandardMetrics.ms_v_bat_soc->SetValue(<strong>nl_gids / <span
              style="color: #272ad8;">4</span></strong>);  //Changed
          this so the value is divided by 4.</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"> </p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"> </p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;">SOC now shows
          exactly the same in the app as the instrument-panel does, and
          is not flapping. (I know the instrument-panel is different
          from the true SOC)</p>
      </div>
    </blockquote>
    <br>
    Right, so you've confirmed that if module sends a reasonable SOC to
    the server, the value stops flapping in the app?<br>
    <br>
    <blockquote type="cite"
      cite="mid:c0421900-ad2c-43e8-bc03-74595acea9aa@DISKSTATION2">
      <div>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"> </p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;">My coding
          capabilities are limited so if someone has a better idea, I
          can test it on my car.</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"> </p>
      </div>
    </blockquote>
    <br>
    We can make the SOC calculation configurable so that you can choose
    to use the instrument panel SOC or an SOC based on the new car
    battery size. When I took over the leaf support I wanted to use the
    instrument panel soc too, <span class="blob-code-inner"><span
        class="pl-c1"><span class="blob-code-inner"><span class="pl-c1"><span
              class="blob-code-inner"><span class="blob-code-inner"><span
                  class="pl-c1">see Tom Saxton's reply which
                  convincingly dissuaded me wanting to switch</span></span></span></span></span></span></span><span
      class="blob-code-inner"><span class="pl-c1"><span
          class="blob-code-inner"><span class="pl-c1"><span
              class="blob-code-inner"><span class="blob-code-inner"><span
                  class="pl-c1">:
                  <a class="moz-txt-link-freetext"
href="http://lists.openvehicles.com/pipermail/ovmsdev/2016-May/002993.html">http://lists.openvehicles.com/pipermail/ovmsdev/2016-May/002993.html</a>
                  (this discussion that was before I knew SOC was
                  available so I had some no longer relevant ideas about
                  how to actually implement it).<br>
                  <br>
                  Now we have the easier to configure v3 platform and
                  more users wanting to use the instrument panel SOC
                  I'll make it configurable. I should be able to get
                  that done tonight.<br>
                </span></span></span></span></span></span></span><br>
    <blockquote type="cite"
      cite="mid:c0421900-ad2c-43e8-bc03-74595acea9aa@DISKSTATION2">
      <div>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;">And now to a
          different thing:</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;"> </p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;">The app supports
          unlocking and locking of doors. The feature doesn't seem to be
          implemented for the Nissan Leaf.</p>
        <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo;
          color: #000000; background-color: #ffffff;">I have all the
          CAN-codes needed to make this work. Please let me know if I
          can contribute.</p>
      </div>
    </blockquote>
    <br>
    I'm uncomfortable doing this on my own car, but I'm very happy to
    have the feature implemented. I think it should be hidden behind a
    configuration option, so you can choose whether the standard
    functionality allows the car to be unlocked, but that is a different
    and not Leaf specific conversation.<br>
    <br>
    You should be able to implement it quite easily by following the
    pattern used in CommandStartCharge() in the Leaf code and the Lock
    and UnLock implementations in the Tesla Roadster and Kia Soul code.
    Be sure to send the frame to the correct CAN bus. The console
    logging functions are very useful for confirming what is going on
    when you're developing.<br>
    <br>
    Thanks for <br>
    <br>
  </body>
</html>