@@ -2204,7 +2204,7 @@ void initDisplay(){
22042204 bbepWakeUp (&bbep);
22052205 bbepSendCMDSequence (&bbep, bbep.pInitFull );
22062206 if (! (globalConfig.displays [0 ].transmission_modes & TRANSMISSION_MODE_CLEAR_ON_BOOT)){
2207- drawBootScreen ();
2207+ drawBootScreen (123456 ); // TODO change to real passcode if set
22082208 bbepRefresh (&bbep, REFRESH_FULL);
22092209 waitforrefresh (60 );
22102210 bbepSleep (&bbep, 1 ); // Put display to sleep before power down
@@ -3976,7 +3976,7 @@ static void bootRenderTextRow(uint8_t* rowBuf, int pitch, int fontRow,
39763976 }
39773977}
39783978
3979- void drawBootScreen () {
3979+ void drawBootScreen (uint32_t passcode ) {
39803980 int W = globalConfig.displays [0 ].pixel_width ;
39813981 int H = globalConfig.displays [0 ].pixel_height ;
39823982 if (W == 0 || H == 0 ) return ;
@@ -4023,13 +4023,20 @@ void drawBootScreen() {
40234023 if (squareSize < pixPerByte * 2 ) squareSize = pixPerByte * 2 ;
40244024 int sqSpacing = (squareSize / 4 / pixPerByte) * pixPerByte;
40254025 if (sqSpacing < pixPerByte) sqSpacing = pixPerByte;
4026- int sqGroupW = numCols * squareSize + (numCols - 1 ) * sqSpacing;
4026+
40274027 int sqGroupH = numRows * squareSize + (numRows - 1 ) * sqSpacing;
40284028 uint8_t lMask = (bitsPerPixel == 4 ) ? 0x0F : (bitsPerPixel == 2 ) ? 0x3F : 0x7F ;
40294029 uint8_t rMask = (bitsPerPixel == 4 ) ? 0xF0 : (bitsPerPixel == 2 ) ? 0xFC : 0xFE ;
40304030
4031- // Bottom info strip: rule + gap + deviceFw + lineGap + credit + gap
4032- int infoAreaH = 1 + gap + charH + lineGap + charH + gap;
4031+ // Passcode strip (optional): gap + squareSize + gap
4032+ bool showPasscode = (passcode != 0 );
4033+ char digits[7 ] = {};
4034+ if (showPasscode)
4035+ snprintf (digits, sizeof (digits), " %06lu" , (unsigned long )passcode);
4036+ int passcodeStripH = showPasscode ? (gap + squareSize + gap) : 0 ;
4037+
4038+ // Bottom info strip: [passcode strip] + rule + gap + deviceFw + lineGap + credit + gap
4039+ int infoAreaH = passcodeStripH + 1 + gap + charH + lineGap + charH + gap;
40334040 int logoAreaH = H - infoAreaH;
40344041 if (logoAreaH < 0 ) logoAreaH = 0 ;
40354042
@@ -4071,8 +4078,6 @@ void drawBootScreen() {
40714078 {
40724079 int srcW = BOOT_LOGO_G5_WIDTH;
40734080 int srcH = BOOT_LOGO_G5_HEIGHT;
4074- int srcPitch = (srcW + 7 ) / 8 ;
4075-
40764081 // Single-row decode buffer
40774082 // srcRow is monotonically non-decreasing as currentY increases, so we
40784083 // advance the G5 decoder forward only, reusing the buffer when the same
@@ -4141,6 +4146,50 @@ void drawBootScreen() {
41414146 bbepWriteData (&bbep, whiteRow, pitch);
41424147 #endif
41434148
4149+ // Passcode strip — 6 digit squares centered between logo and rule
4150+ if (showPasscode) {
4151+ int digitGroupW = 6 * squareSize + 5 * sqSpacing;
4152+ int digitOriginX = ((W - digitGroupW) / 2 / pixPerByte) * pixPerByte;
4153+
4154+ // Top gap
4155+ for (int i = 0 ; i < gap && currentY < H; i++, currentY++)
4156+ bbepWriteData (&bbep, whiteRow, pitch);
4157+
4158+ // Digit squares
4159+ int charStartRow = (squareSize - charH) / 2 ; // vertical centering offset
4160+ for (int row = 0 ; row < squareSize && currentY < H; row++, currentY++) {
4161+ memset (rowBuf, whiteValue, pitch);
4162+ bool borderRow = (row == 0 || row == squareSize - 1 );
4163+ for (int d = 0 ; d < 6 ; d++) {
4164+ int sx = digitOriginX + d * (squareSize + sqSpacing);
4165+ int byteStart = sx / pixPerByte;
4166+ int byteCount = squareSize / pixPerByte;
4167+ if (byteCount < 1 ) byteCount = 1 ;
4168+ if (borderRow) {
4169+ memset (rowBuf + byteStart, 0x00 , byteCount);
4170+ } else {
4171+ // White fill with left/right border pixels
4172+ memset (rowBuf + byteStart, whiteValue, byteCount);
4173+ rowBuf[byteStart] &= lMask;
4174+ rowBuf[byteStart + byteCount - 1 ] &= rMask;
4175+ // Digit character — centered horizontally and vertically
4176+ int fontRow = row - charStartRow;
4177+ if (fontRow >= 0 && fontRow < charH) {
4178+ int charX = sx + (squareSize - charW) / 2 ;
4179+ char ch[2 ] = {digits[d], ' \0 ' };
4180+ bootRenderTextRow (rowBuf, pitch, fontRow / fontScale, ch,
4181+ charX, charW, fontScale, bitsPerPixel, colorScheme);
4182+ }
4183+ }
4184+ }
4185+ bbepWriteData (&bbep, rowBuf, pitch);
4186+ }
4187+
4188+ // Bottom gap
4189+ for (int i = 0 ; i < gap && currentY < H; i++, currentY++)
4190+ bbepWriteData (&bbep, whiteRow, pitch);
4191+ }
4192+
41444193 // Rule
41454194 if (currentY < H) {
41464195 memset (rowBuf, 0x00 , pitch);
0 commit comments