News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Elmryn

#1
Hello,

we use a custom font, Nunito Sans. I have the font-files attached.
(We load xfont and glyh file to RAMG and use CMD_SETFONT2 to attach it to bitmaphandle 28.)

Best
#2
Hello,
Thank you for your previous explanation of how cmd_fillwidth works. However, we're experiencing behavior that doesn't seem to match what you described.

In our implementation, we're calculating the width as follows:

  • We add up the width of each word + the width of a space character
  • For the last word, we don't add the space width (since no trailing space is needed)
  • We compare this total to our max_text_width (which is 520 pixels, the same value we use for cmd_fillwidth)
  • We added a line above the text to visualize the max_text_width value of 520 pixels
Looking at our debug output:

DEBUG: Line 0: 'Sorry, the scanned code seems to be wrong.'
DEBUG: Line 1: ''
DEBUG: Line 2: 'To add a new user, please scan the correct'
DEBUG: Line 3: 'QR code from the Nutrio App.'

max width is 520

DEBUG: Starting new line with word 'Sorry, ', width = 72, line_count = 1
DEBUG: Adding word 'the ' to current line, width now = 115
DEBUG: Adding word 'scanned ' to current line, width now = 215
DEBUG: Adding word 'code ' to current line, width now = 275
DEBUG: Adding word 'seems ' to current line, width now = 352
DEBUG: Adding word 'to ' to current line, width now = 382
DEBUG: Adding word 'be ' to current line, width now = 416
DEBUG: Adding word 'wrong.' to current line, width now = 494


The final width is 494 pixels, which is less than our max_text_width of 520 pixels. According to your explanation, all these words should fit on one line. However, as you can see in the first image, the text is wrapping unnecessarily.

Is there something we're missing in how cmd_fillwidth calculates word widths?
Could there be other factors like internal padding or margin that we need to account for?

We'd appreciate any insights on why our implementation isn't matching the expected behavior of cmd_fillwidth.

Thanks for your help!
#3
Hi,

Okay, I understand that. But is it somehow possible to get the number of lines that FILLWIDTH will result in? Lets say I know my font is X pixel high. So for each line I need X pixels. So it would be nice to know how many lines my text with FILLWIDTH needed to calculate my total height. Or better, to just get the total used height, that CMD_TEXT+FILWIDTH needed.

For Example:
std::string text = "This is my beautiful text on the BT815 chip.";
I don't know the exact width of that text and with FILLWIDTH I do not have to care about it. But if I want to display a button directly under the text, I need to know the height that CMD_TEXT+FILLWIDTH take for the text to display.

Of course I can calculate that on my own by calculating the real text-width of my text, then do linebreaks by my own code according to a given max_width. Thus I would now how many lines or height I need for this text.
But since there is something like FILLWIDTH, which does part of the job by its own, it would be really nice to get the lines or total used height for the text from it.

I hope you can understand what I mean. Feels difficult to explain...

Best
#4
Hi,

I tested it again, and now it works just fine. Don't know, what I did wrong before.

Is there a way to find out, how many lines or area in pixels or height CMD_TEXT will generate or use when using CMD_FILLWIDTH and OPT_FILL?

Best
#5
Hi,

is it anyhow possible that CMD_FILLWIDTH can handle '\n' in a way, that it starts the line-break-stuff new?

Example:

std::string my_string = "Please do some stuff here and there.\n\nAnd now do print something with a blank line above.";


With the \n\n I want a blank line between the two sentences.
But when I use CMD_FILLWIDTH, the bt815 seems not to start its calculations new after a \n. This leads to a result like this:

Please do some
stuff here and
there.

          And now
do print ...


What I want is this:

Please do some
stuff here and
there.

And now do print
...

Is this anyhow possible with CMD_FILLWIDTH?
#6
Thanks for the ideas!

I also thought about the CRC too, but decided to just write my own version number directly after the blob. Works like a charm!

Thank you guys.
#7
Hi,

Thank you so far! That helps a lot.
Is there an example code, to see how to read the EDF part correctly?
To get it to RAMG is not the problem, but how to format or parse it into usable variables?

Best
#8
Hi,

Thanks for that idea. Am I correct that this will only work, if I do not insert the EDF block? (Because the EDF block size varies according to the number of assets, right?)

Best
#9
Hello,

I want to know, if it is in any way possible to put a custom defined variable into the flash-image, so that when BT815 starts, it can detect, which version of flash image is running and thus can decide if it will update the flash or not?

Example:
1. MCU-Firmware has the bt815-flash image included version 01.
2. We make an OTA update with a new bt815-flash image -> version 02.
3. on startup bt815 reads out version-number of bt815-flash image. If version == 01 -> updates the flash-image. If version == 02 -> nothing to do here.

Can we put the version-number or some other custom information with the EAB into the flash-image?

Best
#10
Hi,

Display is 800x480 pixels.
We have 12 MHz oscillator connected to the BT815. We run the Display at 72Mhz.
Here is the whole display-setup:


    MCU_Init(); // set up esp32s3-spi-driver (runs at 16 MHz)

    // Set Chip Select OFF
    HAL_ChipSelect(0);

    // Reset the display
    MCU_Delay_20ms();
    HAL_PowerDown(1);
    MCU_Delay_20ms();
    HAL_PowerDown(0);
    MCU_Delay_20ms();

    // can optionally set to 72MHz system clock here
    // In this case also adjust REG_FREQUENCY a few lines down from here in this file
    HAL_HostCmdWrite(0x44, 0x00); // 0x44 = HostCMD_CLKEXT
    HAL_HostCmdWrite(0x61, 0x46); // 0x46 = 01000110 -> 6 times osc-frequency (12MHz * 6)


    HAL_HostCmdWrite(0x68, 0x00); // Reset


    // Set active
    HAL_HostCmdWrite(0, 0x00);

    // MCU_Delay_500ms(); // Optional delay can be commented so long as we check the REG_ID and REG_CPURESET

    // Read REG_ID register (0x302000) until reads 0x7C
    while ((val = HAL_MemRead8(EVE_REG_ID)) != 0x7C)
    {
    }

    // Ensure CPUreset register reads 0 and so FT8xx is ready
    while (HAL_MemRead8(EVE_REG_CPURESET) != 0x00)
    {
    }

    HAL_MemWrite32(EVE_REG_FREQUENCY, 12 * 6 * 1000 * 1000);

    // This function will not return unless an EVE device is present.
    MCU_Setup();


// ------------------------- Display settings ------------------------------
    // LCD display parameters
    // Active width of LCD display
    HAL_MemWrite16(EVE_REG_HSIZE, EVE_DISP_WIDTH);
    // Total number of clocks per line
    HAL_MemWrite16(EVE_REG_HCYCLE, EVE_DISP_HCYCLE);
    // Start of active line
    HAL_MemWrite16(EVE_REG_HOFFSET, EVE_DISP_HOFFSET);
    // Start of horizontal sync pulse
    HAL_MemWrite16(EVE_REG_HSYNC0, EVE_DISP_HSYNC0);
    // End of horizontal sync pulse
    HAL_MemWrite16(EVE_REG_HSYNC1, EVE_DISP_HSYNC1);
    // Active height of LCD display
    HAL_MemWrite16(EVE_REG_VSIZE, EVE_DISP_HEIGHT);
    // Total number of lines per screen
    HAL_MemWrite16(EVE_REG_VCYCLE, EVE_DISP_VCYCLE);
    // Start of active screen
    HAL_MemWrite16(EVE_REG_VOFFSET, EVE_DISP_VOFFSET);
    // Start of vertical sync pulse
    HAL_MemWrite16(EVE_REG_VSYNC0, EVE_DISP_VSYNC0);
    // End of vertical sync pulse
    HAL_MemWrite16(EVE_REG_VSYNC1, EVE_DISP_VSYNC1);
    // Define RGB output pins
    HAL_MemWrite8(EVE_REG_SWIZZLE, EVE_DISP_SWIZZLE);
    // Define active edge of PCLK
    HAL_MemWrite8(EVE_REG_PCLK_POL, EVE_DISP_PCLKPOL);
    // Turn on or off CSpread
    HAL_MemWrite8(EVE_REG_CSPREAD, EVE_DISP_CSPREAD);
    // Turn on or off Dither
    HAL_MemWrite8(EVE_REG_DITHER, EVE_DISP_DITHER);

    // Write first display list
    HAL_MemWrite32((EVE_RAM_DL + 0), EVE_ENC_CLEAR_COLOR_RGB(0, 0, 0));
    HAL_MemWrite32((EVE_RAM_DL + 4), EVE_ENC_CLEAR(1, 1, 1));
    HAL_MemWrite32((EVE_RAM_DL + 8), EVE_ENC_DISPLAY());
    HAL_MemWrite8(EVE_REG_DLSWAP, EVE_DLSWAP_FRAME);

    // Read the  GPIO register for a read/modify/write operation
    regGpio = HAL_MemRead8(EVE_REG_GPIO);
    // set bit 7 of  GPIO register (DISP) - others are inputs
    regGpio = regGpio | 0x80;
    // Enable the DISP signal to the LCD panel
    HAL_MemWrite8(EVE_REG_GPIO, regGpio);

    // Write the PCLK or PCLK_FREQ register
    HAL_MemWrite8(EVE_REG_PCLK, EVE_DISP_PCLK); // EVE_DISP_PCLK = 2

    HAL_MemWrite8(EVE_REG_PWM_DUTY, 127);

    // ---------------------- Touch and Audio settings -------------------------
    // Eliminate any false touches
    HAL_MemWrite16(EVE_REG_TOUCH_RZTHRESH, 1200);

    // turn recorded audio volume down
    HAL_MemWrite8(EVE_REG_VOL_PB, EVE_VOL_ZERO);
    // turn synthesizer volume down
    HAL_MemWrite8(EVE_REG_VOL_SOUND, EVE_VOL_ZERO);
    // set synthesizer to mute
    HAL_MemWrite16(EVE_REG_SOUND, 0x6000);

    // --------------------- Clear screen ready to start -----------------------
    EVE_LIB_BeginCoProListDelayed();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmptyDelayed();

    // ---------------------- Reset all bitmap properties ------------------------
    EVE_LIB_BeginCoProListDelayed();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    for (i = 0; i < 16; i++)
    {
        EVE_BITMAP_HANDLE(i);
        EVE_CMD_SETBITMAP(0, 0, 0, 0);
    }
    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmptyDelayed();



Flash is running in full speed mode.

And one more thing: We used a 10pt font. Could it do any better if we use a 7pt font?

Best
#11
Hello,

I am new to working with an BT815 and consitently experience display artifacts when trying to display text in a custom font in a specific way. The font works properly as long as I only use a single font. As soon as multiple fonts are overlapping it starts flickering and displaying the artifacts.

I load the fonts from flash(glyphs in flash, xfont in ram_g) and set them with the EVE_CMD_SETFONT2 command.
All of the fonts are ~800KB in total right now(might be even more in the future), but still working on and finding new ways to make this less.

Since the code I use in the actual application is quite complex, I produced a minimal version of this, where this issue is still coming up:

    EVE_LIB_BeginCoProList();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    EVE_VERTEX_FORMAT(0);

    EVE_CMD_TEXT(0, 0, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 0, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 0, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 0, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");

    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmpty();


But this is working

    EVE_LIB_BeginCoProList();
    EVE_CMD_DLSTART();
    EVE_CLEAR_COLOR_RGB(0, 0, 0);
    EVE_CLEAR(1, 1, 1);
    EVE_VERTEX_FORMAT(0);

    EVE_CMD_TEXT(0, 0, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 100, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 200, NUNITO_SANS_32, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");
    EVE_CMD_TEXT(0, 300, NUNITO_SANS_24, 0, "Lorem ipsum dolor sit amet\n consectetur adipiscing elit. \nCras et lorem eget eros lacinia placerat.");

    EVE_DISPLAY();
    EVE_CMD_SWAP();
    EVE_LIB_EndCoProList();
    EVE_LIB_AwaitCoProEmpty();


I found a Problem in the forum, which sounds like the problem I have, so the bandwidth could be the issue here(but the font loaded in that topic is way bigger, only a single font and the topic seemed stale - with a warning to post there):
http://www.brtcommunity.com/index.php?topic=298.0

The solutions over there did not work for me or are not feasible, more details to me trying out the solutions:
- turning on adaptive frame rate did not do anything, the display does not support it
- adaptive HSync is sadly not available on BT815
- loading the font from RAM_G -> I would like to avoid it, because I need to load a couple of fonts, which will use up too much space, because I also need a broad spectrum of characters for different languages and there are already icons in RAM_G to avoid this problem when loading icons/image.
- flash IC is already in FULL state
- switching to BT817 is not possible right now, too many devices to replace

I am very thankfull for ideas on how to handle this issue and maybe someone can verify this problem for me, just in case I was not smart enough to load the font properly or the issue lies somwhere else entirely.

Im still hoping I dont have to work around the issue, but we will see.

Best
Elmryn