ESP32 Serial buffer in the PlatformIO works different fron the Arduino IDE

Good afternoon people

I’m having problems using the ES32 Serial buffer.

My code below has the function of storing the data received on the Serial port and print this data in the Serial Monitor, but it works one way on the Arduino IDE and on PlatformIO it works the other way.
Code compiled in the PlatformIO test:

Can anyone help me with a solution?

Thank you very much in advance

Below is the code example.

#include <Arduino.h>
void setup() {
Serial.begin(9600);
}
void loop() {
  if (Serial.available()) {
 int i = 0;
 while(Serial.available()>0){
    char a = Serial.read();
    Serial.print(a);
    Serial.print(", ");

    i = 1;
    }
 if(i == 1) 
 {
  Serial.println("");
   i = 0;

  for(int r = 0; r < 61; r++){char u = Serial2.read();}
   
 }
  }
}

The Arduino-IDE serial monitor sends the whole string when you press enter. The PlatformIO serial monitor sends the individual characters as soon as you type them. If you want PlatformIO to be have like the Arduino IDE serial monitor, add monitor_filters = send_on_enter (per documentation) to the platformio.ini.

I understand, but i’m testing both examples in the Arduino IDE Serial Monitor, the only difference is the code was compiled in the PlatformIO and later was tested in the Arduino IDE Serial monitor

Ahh. What is the version of the Arduino-ESP32 core that you’re using in the Arduino IDE (board manager)? With what settings are you compiling in the Arduino IDE?

I’m using the most recent version of the Arduino-ESP32 core, with the default settings if possible you could test it by copying this code and compiling in the two IDEs and seeing if the final result varies, thanks in advance