Serial.write truncating output

It is a known behavior that when printing a number via

DEBUG_SERIAL.println(x, BIN);

then all leading zeroes are not printed. Hence 1111111 is the expected output for the number 0x7f / 127.

The solution is to print all bits manually: