Printer Response: ok N##### P0 B4 - What are P and B?

Trying to track down an issue that's causing my printer to apparently randomly occasionally (holy adverbs Batman) pause for up to several seconds...

While watching my terminal activity, I notice that my printer responds to every movement command that I've seen in the following format:

ok N##### P0 B4

I'm not intimate with Gcode, but I get the gist. I understand the N number to be a line number, but for the life of me I can't find anywhere that describes what the P and B numbers are indicative of. Occasionally, I also notice the P number increase - the highest I've seen is P14. There generally seems to be a series of consecutive lines where the P number will fluctuate by no more than 2 at a time. As far as I've seen, the B number is always 4.

Below is a small excerpt from a recent print log...

Send: N116018 G1 X125.758 Y150.528 E1344.78295*105
Recv: ok N116018 P0 B4
Send: N116019 G1 X125.525 Y150.206 E1344.78918*101
Recv: ok N116019 P0 B4
Send: N116020 G1 X125.131 Y149.621 E1344.80024*102
Recv: ok N116020 P0 B4
Send: N116021 G1 X124.907 Y149.264 E1344.80685*99
Recv: ok N116021 P1 B4
Send: N116022 G1 X124.538 Y148.638 E1344.81824*104
Recv: ok N116022 P1 B4
Send: N116023 G1 X124.347 Y148.284 E1344.82454*108
Recv: ok N116023 P1 B4
Send: N116024 G1 X124.023 Y147.644 E1344.83579*98
Recv: ok N116024 P2 B4
Send: N116025 G1 X123.854 Y147.277 E1344.84212*101
Recv:  T:245.00 /245.00 B:45.15 /45.00 @:66 B@:2
Recv: ok N116025 P3 B4
Send: N116026 G1 X123.569 Y146.612 E1344.85346*98
Recv: ok N116026 P3 B4
Send: N116027 G1 X123.422 Y146.228 E1344.85991*96
Recv: ok N116027 P3 B4
Send: N116028 G1 X123.185 Y145.566 E1344.87093*96
Recv: ok N116028 P4 B4

In case it's helpful information, I'm running OctoPrint 1.3.12 with OctoPi 0.16.0 on a RaspberryPi 3B+, and my printer is a Taz 6.

Can anyone tell me what the P and B numbers mean? Thanks!

These are part of the ADVANCED_OK feature in Marlin:

  • P: the remaining space in the move planner buffer
  • B: the remaining space in the unprocessed command buffer

For some more information see https://github.com/foosel/OctoPrint/issues/2834

2 Likes