diff --git a/src/main/io/osd.c b/src/main/io/osd.c index ef76c0cbe7..a02d79720b 100755 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -2194,12 +2194,21 @@ static bool osdDrawSingleElement(uint8_t item) } break; } - case OSD_DEBUG: { - // Longest representable string is -2147483648, hence 11 characters + /* + * Longest representable string is -2147483648 does not fit in the screen. + * Only 7 digits for negative and 8 digits for positive values allowed + */ for (uint8_t bufferIndex = 0; bufferIndex < DEBUG32_VALUE_COUNT; ++elemPosY, bufferIndex += 2) { - tfp_sprintf(buff, "[%u]=%11ld [%u]=%11ld", bufferIndex, debug[bufferIndex], bufferIndex+1, debug[bufferIndex+1]); + tfp_sprintf( + buff, + "[%u]=%8ld [%u]=%8ld", + bufferIndex, + constrain(debug[bufferIndex], -9999999, 99999999), + bufferIndex+1, + constrain(debug[bufferIndex+1], -9999999, 99999999) + ); displayWrite(osdDisplayPort, elemPosX, elemPosY, buff); } break;