You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • you would just maybe issue a wait or a SetTimeout for the AT+BAR command to ensure all of the AT+FOO response lines have been either handled or flushed?

    I'd handle all 3 lines - adding a timeout would work, but it's pretty nasty and might bite you later on. It's not hard - at the most basic level:

    at.cmd("AT+FOO", 1000, function (first) {
      return function(second) {
       return function(third) {
        // done
      };
      };
    });
    

    Or you could actually count the lines - but in a lot of cases there's an OK message or something to signify the end of the response that you can use:

    at.cmd("AT+FOO", 1000, function cb(d) {
      // stuff...
      if (d!="OK") return cb;
    });
    

    I guess though that can't happen because you don't know what response from the modem is tied to what command...

    Exactly - it's really the responsibility of the at.cmd's callback to keep track of the response that it is expecting.

    I may just go ahead and tackle a rewrite on the SIM900 module.

    Is the existing one not working for you? It sounded a lot like after the wiring issues, it was working ok?

About

Avatar for Gordon @Gordon started