Petite question sur le do while

Bonjour,
J'aimerais ignorer des caracters \r et \c qui suivent le mot RING

J'ai fait ceci et je ne suis pas sure du do while.

En gros, su mon buffer contient le mot RING, il lit le caractere qui sui et si c'est un \r ou un \n, il e stock pas la valeur dans le buffer

if(prog_char_strcmp(replybuffer, (prog_char*)F("RING")) == 0)
        {
// RING vient d'être lue
          DEBUG_PRINT(F("Debug2: "));
          DEBUG_PRINT(F(replybuffer));
          DEBUG_PRINTLN(F(" detected!"));
          strlen(replybuffer);
// Vide le buffer
          memset(replybuffer,'\0',255);
// remet l'index au debut
          replyidx=0;
// Reinitialise le timeout
          timeout = time_out;

          DEBUG_PRINT(F("Debug3: "));
          DEBUG_PRINT(F(replybuffer));
          DEBUG_PRINTLN(F(" ereased!"));
 // Lit le prochain carcatere et tourne en rond tant qu'il recoit les caractere \r et \n. Aussi tot qu'il lit un 
// autre caractere, insére le dans replybuffer
// OU si timout est egal à 0, sort de la boucle      
          do{
            c = mySerial->read();
            if(c == '\r')
            {
              DEBUG_PRINT(F("flush "));
              DEBUG_PRINTLN(F("c"));
            }
            else if(c == '\r')
            {
              DEBUG_PRINT(F("flush "));
              DEBUG_PRINTLN(F("r"));
            }
            else
            {
              DEBUG_PRINT(F("after flush "));
              DEBUG_PRINTLN(c);
              replybuffer[replyidx] = c;
timeout = time_out; // reinitialise le timeout
            }
timeout--;
          }while((c =='\r' || c== '\n') && (timout >0));
// Je ne suis absolument pas certain de ma condition dans le while.
        }

Es-ce que mon while, vous semble juste?

Voici toute la fonction

uint8_t Adafruit_FONA::readline(uint16_t timeout, boolean multiline) {
  uint16_t replyidx = 0;


  uint16_t time_out = timeout;

  while (timeout--) {
    if (replyidx >= 254) {
      //DEBUG_PRINTLN(F("SPACE"));
      break;
    }

    while(mySerial->available()) {
      char c =  mySerial->read();
      if (c == '\r') continue;
      if (c == 0xA) {
        if (replyidx == 0)   // the first 0x0A is ignored
          continue;

        if (!multiline) {
          timeout = 0;         // the second 0x0A is the end of the line
          break;
        }
      }
      replybuffer[replyidx] = c;
      DEBUG_PRINT(c, HEX); DEBUG_PRINT("#"); DEBUG_PRINTLN(replybuffer);
      
      // added by pam to try to escape RING
       if(prog_char_strcmp(replybuffer, (prog_char*)F("RING")) == 0)
        {
          DEBUG_PRINT(F("Debug2: "));
          DEBUG_PRINT(F(replybuffer));
          DEBUG_PRINTLN(F(" detected!"));
          strlen(replybuffer);

          memset(replybuffer,'\0',255);
          replyidx=0;
          timeout = time_out;

          DEBUG_PRINT(F("Debug3: "));
          DEBUG_PRINT(F(replybuffer));
          DEBUG_PRINTLN(F(" ereased!"));
         
          do{
            c = mySerial->read();
            if(c == '\r')
            {
              DEBUG_PRINT(F("flush "));
              DEBUG_PRINTLN(F("c"));
            }
            else if(c == '\r')
            {
              DEBUG_PRINT(F("flush "));
              DEBUG_PRINTLN(F("r"));
            }
            else
            {
              DEBUG_PRINT(F("after flush "));
              DEBUG_PRINTLN(c);
              replybuffer[replyidx] = c;
            }
          }while(c =='\r' || c== '\n');
        }
      // end added by pam


      replyidx++;
    }

    if (timeout == 0) {
      DEBUG_PRINTLN(F("TIMEOUT readLine"));
      break;
    }
    delay(1);
  }
  replybuffer[replyidx] = 0;  // null term

  return replyidx;
}

Merciii