Missing pulses!

Assuming this is a current code, here is another look at the flow.
(Just in case - NOT to be "cut and paste" - just code annotations )

Kalasson:
Now this piece of code has made a major improvement!

Maybe we're happy with it now. Or if you could see anything that could cause a failure?

#define MAX485_DE       2

char PenBuff[5];
int PenBuffLen=5;
int IncPenLen=0;
float penetration=0;
float k=0.0025;

void setup() {
  Serial.begin(9600);
  Serial3.begin(19200);
  pinMode(MAX485_DE, OUTPUT);     
  digitalWrite(MAX485_DE, 0);     
}

void loop() {

while (Serial3.available() > 0) {

first character detected

IncPenLen=Serial3.readBytes(PenBuff, PenBuffLen);

read  PenBuffLen = 5 characters into a buffer ,
will "stall" until ALL are all received or time out IF programmed for timeout

? Did we actually read 5 characters?

Now read EACH character from buffer and analyze it

for (int i=0; i<IncPenLen;i++){

if(PenBuff[i]=='A'){
          penetration +=k;
        }

else if (PenBuff[i]=='B'){
          penetration -=k;
        }

else if (PenBuff[i]=='+'){
          penetration=penetration;
        }

Each "if" , when executed above modifies "penetration"
Now we can also modify penetration here

Is that desired?

if (penetration <=0 ){
          penetration=0;
        }
    }

Print penetration , why so slow?

Serial.println(penetration,4);
  }
}





Robin & Fredrik