You are reading a single comment by @Mrbbp and its replies. Click here to read the full conversation.
  • i give you an example of a frame

    //Check Playback Status(01)
    //Command: AA 01 00 AB
    let command= [0xAA,0x01,0x00,0xAB];
    s.write(command)
    //Return: AA 01 01 Playback status SuM
    

    if i've read and kept the good part in the gps module, it use an object and fill the "line" until it's more than 80chars or until \n char.

     var gps = {line:""};
      serial.on('data', function(data) {
        gps.line += data;
      });
    

    i do not have this '\n' in the frame module.
    the length is not always the same. between 5 and 7 chars.
    The last char is always a sum of the values sent...
    I could :
    evaluate continiously the frame to know when it is end (the sum)
    or
    evaluate the second char received to determine the length of the frame (the command),
    or
    anticipate the length (5,6,7) of the response by the command sent.

    'Status', send back 5 chars
    'duration of the current audio', send back 7 chars.

    thanks

    i'll try.

About

Avatar for Mrbbp @Mrbbp started