<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>The changes have been made. It took longer than I expected because I found a couple of edge cases that may cause GPRS to be locked up in areas of marginal cellular coverage (which I think explains the rare cases that have been reported to me), and I also tidied up the reception of SMS messages during GPRS establishment failures (in particular if the APN is incorrect).</div><div><br></div><div>For the LEDs, what I've ended up with is:</div><div><br></div><div><ol class="MailOutline"><li>When first powered on, the red led stays on, and the green led blinks the version of firmware in the module (e.g.; 1, 2, 5). After that, it enters normal mode.<br><br></li><li>In normal mode, the green led is used to indicate the state, and the red led is used to indicate the last error.<br><br></li><li>If the modem needs to be reset, both red and green leds are turned on for the couple of seconds it takes to reset the modem.</li></ol></div><div><br></div><div>The following states are defined:</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="'Andale Mono'">// LED MODES<br>#define NET_LED_WAKEUP 10 // Attempting to wake up the modem<br>#define NET_LED_INITSIM1 9 // Checking SIM card insertion status<br>#define NET_LED_INITSIM2 8 // Checking SIM card PIN status<br>#define NET_LED_INITSIM3 7 // Initialising modem<br>#define NET_LED_COPS 6 // COPS initialisation<br>#define NET_LED_NETINIT 5 // GPRS NET initialisation<br>#define NET_LED_NETAPNOK 4 // GPRS APN is OK, final init<br>#define NET_LED_NETCALL 3 // GPRS Network call<br>#define NET_LED_READY 2 // READY state<br>#define NET_LED_READYGPRS 1 // READY GPRS state</font></blockquote><div><br></div><div>The normal behavior is it will start at 10 green blinks and count down to 2 (GSM only) or 1 (GPRS). If GPRS lock is lost, but GSM is still up, the green will blink 1.</div><div><br></div><div>The followed error codes are defined:</div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><font class="Apple-style-span" face="'Andale Mono'">// LED ERRORS<br>#define NET_LED_ERRLOSTSIG 1 // Lost signal<br>#define NET_LED_ERRMODEM 2 // Problem communicating with modem<br>#define NET_LED_ERRSIM1 3 // SIM is not inserted/detected<br>#define NET_LED_ERRSIM2 4 // PIN lock on the SIM<br>#define NET_LED_ERRCOPS 6 // COPS GSM lock could not be obtained<br>#define NET_LED_ERRGPRSRETRY 7 // Error (maybe temp) during GPRS init<br>#define NET_LED_ERRGPRSFAIL 8 // GPRS NET INIT failed</font></blockquote><div><div><br></div><div>The error code is cleared (red led turned off) once everything is ok.</div><div><br></div><div>Another few hours testing, then I'll commit this code.</div><div><br></div><div>Regards, Mark.</div><div><br></div><div>On 8 May, 2012, at 7:37 PM, Mark Webb-Johnson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Not too bad.</div><div><br></div><div>I've re-worked the low priority interrupt handler stuff used to drive the comms port to also drive these LEDs off timer#1. That makes the entire LED subsystem self-sustaining and I don't need to change other parts of the code to maintain the animation.</div><div><br></div><div>Tricky stuff to get right, and I haven't had so much fun with blinking lights since basic electronics classes all those years ago using 555 ICs.</div><div><br></div><div>1 time period on, then 3 off, gives a nice clear countable display.</div><div><br></div><div>One experiment that didn't work was to leave the timings for the two LEDs independent. It is too hard to count flashes of green when a red led next to it is flashing a different code at a different start time. My current approach is to synchronize the two to start the codes at the same time, for a set fixed time period. If one is flashing less digits than the other, then it just waits, before they both start together again.</div><div><br></div><div>Next step is the code for solid on (easy), then startup animation, then I update the modem driver logic. In the modem code, it is much easier now, as we don't need to do any flashing animation at all. Just a function call to tell the led code what digit to show, and the led will start flashing that at the next cycle.</div><div><br></div><div>With luck, so long as I haven't messed anything up, I should be done with the leds this week.</div><div><br></div><div>I've also done the code changes for volt/ampera support stub, and some minor bug-fixes.</div><div><br></div><div>Then, timed-charges command support, and I'm moving on to the charge and drive logs.<br><br>Regards, Mark</div><div><br></div><div><div>On 8 May, 2012, at 11:23 AM, William Petefish wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Mark,<div><br></div><div>How goes the coding?</div><div><br></div><div>William<br><br><div class="gmail_quote">On Sun, May 6, 2012 at 2:41 PM, Udo Werges <span dir="ltr"><<a href="mailto:Udo.Werges@t-online.de" target="_blank">Udo.Werges@t-online.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font style="font-family:arial,helvetica,sans-serif" size="2">sounds
good, the changes will give a lot more information via the flashing
LEDs.<br> <br>
pro voting<br><br>Udo<br>Germany<br><br>mobil +49171 374
7978<br>
e-mail <a href="mailto:udo.werges@t-online.de" target="_blank">udo.werges@t-online.de</a><br>
eFax <a href="tel:%2B49322%2023%2073%209801" value="+4932223739801" target="_blank">+49322 23 73 9801</a><div><div class="h5"><br>
<br>
-----Original Message-----<br>
> Date: Sat, 05 May 2012 10:46:57 +0200<br>
> Subject: Re: [Ovmsdev] Flashing Lights<br>
> From: William Petefish <<a href="mailto:william.petefish@gmail.com" target="_blank">william.petefish@gmail.com</a>><br>
> To: OVMS Developers <<a href="mailto:ovmsdev@lists.teslaclub.hk" target="_blank">ovmsdev@lists.teslaclub.hk</a>><br>
<br>
<div style="float:left">> </div><blockquote><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">#6 has my vote. It may be more complex
in code, but easier to impliment on existing hardware.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I guess it could act similar to the old OBD that
cars had prior to OBD2.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">William</div> <div class="gmail_quote">On May 5, 2012 2:36 AM, "Mark
Webb-Johnson" <<a href="mailto:mark@webb-johnson.net" target="_blank">mark@webb-johnson.net</a>>
wrote:<br type="attribution"><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> <div style="word-wrap:break-word"><div><br></div><div>I've been getting frustrated lately trying to help users
diagnose problems early-on in the GSM connection sequence. We've had
problems with SIMs cards getting recognised (broken sim cards), with sim
locks (PIN lock on), with general modem comms issues, and with lack of
GSM signal - and all these show up as the same red flash, red solid, red
flash, red-green-alternate indicators. Without getting out a USB-serial
cable and laptop, it is real hard to diagnose.</div> <div><br></div><div>Talking this through with Bennett, and others, I think we
can do better, and I suggest the following changes:</div><div><br></div><div><ol><li>Take the LED control out of the individual code
files and have them controlled by a central module with its own timer.
This module would be told at a high level what to do with the LED (eg;
make the green led flash 7 times) and would make it so.<br> <br></li><li>Both LEDs off would indicate NO POWER.<br><br></li><li>On
startup, animate both LEDs for a short time to demonstrate that they
both work.<br><br></li><li>Change init code to (a) use AT to verify
modem is connected, (b) check for SIM connected and readable, (c) check
for SIM PIN lock, (d) initialize modem to our required settings, and (e)
AT+COPS for cellular signal search. By splitting this up, to separate
check states, we can individually alert on a failure at a particular
state.<br> <br></li><li>In general, use the green LED to show
status, and the red LED to show the last error (cleared whenever a state
is successful).<br><br></li><li>On startup, you would see the green
led count up through each stage, and if it got stuck at a particular
stage the blinks would tell you where it is. If there was an error at
any stage, the red LED would indicate the error code.<br> <br></li><li>For blinking, I suggest just off for a second, then rapidly
blink the code, then off for a second, then rapidly blink the code,
etc.<br><br></li><li>Once we reach a final GOOD state (either GSM
with GPRS disabled, or GPRS connected to server), we would just turn
both LEDs to a steady blinking pattern (perhaps on for a second, off for
a second).</li> </ol></div><div><br></div><div>As well as the obvious
clarity to diagnostics that this brings, it would also be for general
use to see at a glance if the module is working correctly and is
connected to the server ok.</div> <div><br></div><div>What do people
think?</div><div><br></div><div>Regards, Mark.</div><div><br></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> </div></blockquote></div></div></font>
<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><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br></blockquote></div><br></div></blockquote></div><br></body></html>