Jump to content

king2

Members
  • Posts

    117
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by king2

  1. I can see only two parameters of gwinSetStyle() - handler and style. Can you point me to exact place where I can apply custom style to all children of container?

    I have few places where I modifying content, in 3 threads. One thread updates date and time in header, one more thread will update USB flash free space, one more thread - everything else. Best strategy in my case will collect changes, and then call something like redrawAllPending(). More, I have much memory, so I can just redraw all display to another videobuffer, and change address of such buffer at end of LTDC display iteration (after last line was sent to display), so next frame will be displayed from new buffer with new contents.

    In y case I think it will be nice to:

    - change address of LTDC videobuffer to second one (will display copy of old content)

    - make whole page container invisible at old videobuffer, just to not redraw immediately

    - make all changes I want (styles, texts and so on), as I understand, nothing will be redrawed in this case

    - make page visible, redrawing all objects

    - change address of LTDC videobuffer back to first one (will display copy new content)

    - use DMA2D or DMA to copy all content from first to second videobuffer

    Is it best way?

    It will give me determinate time of changing content (in fact, it will be more if I have changed only one text or less if I was changed many styles in one shot).

    What will be If I (container and label styles is my_own_style):

    1. change container's style to default

    2. change label's styles (inside container) to default

    3. change container's style to my_own_style

    4. change label's styles (inside container) to my_own_style

    What will be done in asynchronous mode?

    1. it will do from 1 to 4

    2. it will do 3 and 4

    3. it will do nothing because at the end nothing was changed?

    Can I use async mode with manual redrawing content?

    Can I redraw only changed things in this mode?

    Thank you!

  2. I think this behavior should be customisable (when creating it), because two cases of using:

    1. One or two frames with almost static content, or frames that used often - it is better not to destory them

    2. Many frames with dynamic content, which can take all memory - it is better to destroy them after using

  3. I got error "ownership failure (chMtxUnlock)" while trying to call gwinSetText() from second thread (its used to display free space on USB). In trace I see that this is chDbgAssert in chMtxUnlock(), where ctp == my second thread, and ctp->p_mtxlist->m_owner pointed to flash rom area of CPU (with no name of thread).

    I'm creating GUI from main(), not from any thread.

    What I'm doing wrong? What should I do to get access to labels from any place?

    Thanks!

  4. I have in my project 5 containers, and 4 labels in each.

    I want allow user to select active container, so now for each change I:

    - apply default style for all containers and labels (25 x gwinSetStyle)

    - apply my own style to active container and its labels (5 x gwinSetStyle)

    All this done in one shot. If I will rotate rotary switch very quick, I can see how active selection goes from 1 to 5, and this takes about 1 second, which is too much as for me.

    I understand that I can apply default style just to previous active one, but now I think how uGFX fast, taking about 1 second to make 150 changes on screen in 1 second, with average size of 10000 pixels each? This is about 1.5Mpix in a second, but hardware acceleration gives actual quantity much less than 1.5Mpix.

    I use STM32F429 at 168MHz, with 800x480 display size via LTDC driver with DMA2D in gdisp_lld_blit_area().

    May be, I'm doing something wrong?

    How to speedup it?

  5. Tectu, I have modified my post-generate script, what it does:

    - replaces romfs_files.h contents with includes of files found in my own custom folder (to include 'replacement' images for widgets as well as images that present at design time)

    - places all gdispImage and font_t into header file as extern, to allow its usage from main firmware

    - removes static definition from all void functions (this is Create* ones), add them into header file, to allow its usage from main firmware

    - adds some definitions to gfxconf.h file (about OS and calibration, and modifies GFILE_MAX_GFILES)

    - changes LoadMouseCalibration defition as weak

    - replaces all handlers like ah_ and ah__ by arrays, in both gui.c and gui.h files

    Script attached.

    p.s. Studio does not save into project Unicode checkbox selection.

  6. Another idea :)

    Part of my interface divided into blocks, for example, I have three blocks for axis XYZ, and memory table, that consists of 5 containers, 4 label in each. I want to select current memory setting (line in a table, i.e. container) with 'selected' style. To do this, I have to set default style 5*4+5=25 times, and another 25 lines of code to set 'selected' style. A some sort of hell. Add another 'ifs' for setting labels in three blocks and you will get programming code from stone age when loops was not invented yet :)

    I cannot use loops because handlers are not in array.. array.. what if we will have possibility to declare handlers as arrays? For example, all handlers with names differs only by trailing digit can be arrays?

    Instead of:


    extern GHandle ghContainer_mem_5;
    extern GHandle ghLabel_mem_5_0;
    extern GHandle ghLabel_mem_5_1;
    extern GHandle ghLabel_mem_5_2;
    extern GHandle ghLabel_mem_5_3;
    extern GHandle ghContainer_mem_4;
    extern GHandle ghLabel_mem_4_0;
    extern GHandle ghLabel_mem_4_1;
    extern GHandle ghLabel_mem_4_2;
    extern GHandle ghLabel_mem_4_3;
    extern GHandle ghContainer_mem_3;
    extern GHandle ghLabel_mem_3_0;
    extern GHandle ghLabel_mem_3_1;
    extern GHandle ghLabel_mem_3_2;
    extern GHandle ghLabel_mem_3_3;
    extern GHandle ghContainer_mem_2;
    extern GHandle ghLabel_mem_2_0;
    extern GHandle ghLabel_mem_2_1;
    extern GHandle ghLabel_mem_2_2;
    extern GHandle ghLabel_mem_2_3;
    extern GHandle ghContainer_mem_1;
    extern GHandle ghLabel_mem_1_0;
    extern GHandle ghLabel_mem_1_1;
    extern GHandle ghLabel_mem_1_2;
    extern GHandle ghLabel_mem_1_3;
    extern GHandle ghContainer_0;
    extern GHandle ghLabel_0_0;
    extern GHandle ghLabel_0_1;
    extern GHandle ghLabel_0_2;
    extern GHandle ghLabel_0_3;
    extern GHandle ghLabel_0_4;
    extern GHandle ghContainer_1;
    extern GHandle ghLabel_1_0;
    extern GHandle ghLabel_1_1;
    extern GHandle ghLabel_1_2;
    extern GHandle ghLabel_1_3;
    extern GHandle ghLabel_1_i;
    extern GHandle ghContainer_2;
    extern GHandle ghLabel_1_0;
    extern GHandle ghLabel_1_1;
    extern GHandle ghLabel_1_2;
    extern GHandle ghLabel_1_3;
    extern GHandle ghLabel_1_4;

    we will get:


    extern GHandle ghContainer_mem[5];
    extern GHandle ghLabel_mem[5][4];
    extern GHandle ghContainer[3];
    extern GHandle ghLabel[3][4];

    I will change my script to get this type of source from Studio, but such type of defining variables can increase usability of code, isn't it?

    We can compact definition for all objects starting with 'ah' instead of 'gh', for example, to give maximum freedom to user.

    Should I post perl code here that will do substitution table?

    Sorry for so many crazy ideas from my side :)

  7. Thank you for describing potential problems with chips, I did not met them yet, but I will beware :)

    I glad that I have selected right way to implement interrupt.

    I think implementing entire interrupt method (without polling) is not so important, because we should implement queue of events in this case to make it right way.

    I was not met any problems yet with touch, so I think it is good to have this, but while full stack events will be implemented, as well as full stack WM, and other things linked to events queues, i.e. definitely not now and not at first priority. :)

    Thanks!

  8. I have touchpanel that raises EXTI interrupt when something was changed with touchpanel (pressed or depressed), but gmouse works in polling mode.

    So, now I just have global variable touch_panel_pressed, and this variable sets to true when EXTI interrupt was raised.

    In read_byte() I check this variable, if it is false, the function just return zero, so read_xyz() returns without actual I2C communication.

    If it was true, I set variable to false and do actual reading from touchpanel, so result can match read_byte() & 0x07 condition in read_xyz(). All changes was made in my custom gmouse_lld_FT5x06_board.h.

    What do you say about this approach? Is it good or I missed something important?

  9. Adding support for the second layer is fairly easy

    Not in case of my config. STM32F429 while working with LTDC and SDRAM at one time simply cannot display both layers right way.

    I think that bus bandwidth is limited more than this is mentioned in documentation, so LTDC cannot access to new pixels to be displayed at same time when it wants to read them from both layer's SDRAM addresses.

    As result I have sync problems, snow on screen or something like this (each next line was shifted to right by few pixels), depending on third thing who want to access to SDRAM - my application writing to display layers :)

  10. Sorry, I have no 429 discovery, so I can only guess.

    I'm working with WaveShare Open429-I kit with 7-inch capacitive display, that works by LTDC only, without any needs to setup it via SPI.

    Yes, i using 8M SDRAM embedded into main CPU module of Open429, so I cannot use full power of STEmWin's double layers (STM32F429 cannot use double layers on 800x480 with SDRAM due to bus bandwidth limitation). I have tried STemWin, and it works, but as I tried to ask questions in their forum and got no answer, and I see that developers of uGFX really wants to make uGFX better, so I decided to switch to uGFX (except this, I can see uGFX sources :)).

    About hardware acceleration.. I simply do not know. STM32F429 have DMA2D accelerator, and my display (and LTDC itself) cannot be used without videobuffer, so all acceleration can work with memory (video) buffer only. uGFX's LTDC driver uses DMA2D to fill areas.

  11. As I in same situation as you (writing project based on uGFX on STM32F429), let me try to answer some of your questions.

    SPI is a not part uGFX responsible for in your case, so this is question about ChibiOS HAL.

    To make LTDC working, I was copied board_STM32LTDC_template.h into $PROJ_DIR$/board_STM32LTDC.h, and added some defines into it:

    #define SDRAM_DEVICE_ADDR 0xd0000000
    #define STM32F4 TRUE

    I have changed driverCfg in this file, because I'm using 800x480 display.

    Also, I included gdisp_lld_STM32LTDC.c into my project.

    I have not used file from demos, and in my case everything works fine with generic driver.

    What about win95-like interface, uFGX have widgets that looking better than Win95's (in my opinion), so I used them as is.

    You can use Studio as visual designer and get some files to start with.

    Note that Studio can be used not just as example generator, but as designer in full life cycle of application, so you can add or change something in your app, generate code and just recompile your application.

    Tectu told that 0.13 version of Studio (will be available ~15th of Feb) will allow to use custom fonts, this also will help (now you can use in Studio only fonts embedded into uGFX).

    So, you need:

    - uGFX gfx_mk.c file, to compile entire lib in your firmware

    - LTDC display driver as was mentioned above

    - gui.c, gui.h gfxconf.h and other files that will make Studio for you

    I'm not developer of uGFX, just a user, so everything above is just my opinion.

  12. About guiInitResources() - this can be useful for me only if I will able to make all resources included (by Studio) into project, including images, for example, not used at start.

    Now resources are:

    - fonts

    - images

    If I will able to add fonts into Studio, and select which fonts I wish to include to project (not only that ones I using in designer! selected! I may want to use font later!) - it will work for me. Same with images. It is not so important for me, as I can add them by myself, but this feature will be useful for many users, I think.

    In guiCreate() we see:

    - fonts loading

    - images loading

    - some start-up init

    - creating of pages

    - show start-up page

    Developer may want to change almost anything of above:

    - fonts and images - load them later, or, for example, load fonts and/or images depending on settings.ini on user's SDCARD

    - start-up with no backlight set in Studio's project, but based on application logic or daylight level (here we can use 0% and set later, so it is not so important), but set default font, style can be based on user settings and will change visual effect of calling createPage*() functions

    - creating pages. Developer may want to create pages by demand, or create them depending on application settings

    So I think it is not necessary try to guess what developer may want, it will be enough to just give him possibility to overwrite guiCreate() function in its own code. If Studio will generate public functions like guiInitResources(), or even guiInitFonts() and guiInitImages() - this will just help to make user code clean and readable.

    So I think it will be good to leave guiCreate() as is, but allow developer to make his own alternative (or use it as is if he wants nothing unusual). I.e. make possibility to transfer guiCreate into user code, what is impossible without marking fonts, images handlers, and Create*() functions as public.

    Just my opinion.

  13. As you (and inmarket) mentioned, Studio now is just a 'example creator', and I hope that this is not forever :)

    But now if I will use generated guiCreate() function, I cannot^

    - change default font to my own

    - initialize some pages later (or never if not needed)

    - load additional resources (such as image files, I want to change images at runtime, but can assign (and have initialized) only one image per imagebox, so it is good for me to keep fonts and images initialization in one place

    So I decided not use default (generated) guiCreate(), but copy its contents into my main program and change this function manually. This is because I want access to functions. As I mentioned above, I want also to change images on fly, so I want access to image resources (and fonts). As temporary solution I changing fonts also, so I want access to font variables too.

    Also you can define guiEventLoop as weak, so developer will able to just define function with same name in its own main.c file and not change gui.c file.

    All these will allow to use Studio as GUI designer, change some elements later, just re-generate code and compile with new design, with no additional manual changes or tuning. Now I building my interface exactly this way, and I like it!

  14. Sorry for having so bad english :(

    Now I have special script. I run this script after code is generated by Studio.

    Script scans gui.c for function like createPagePage_main(void), createPagePage5(void) or similar and adds to gui.h their definitions.

    Script scans gui.c for font_t and gdispImage variables and adds something like extern gdispImage button_mic_red to gui.h.

    Script transforms gui.c into utf-8.

    After this transformation I can use all variables (not only GHandle ones) in main program.

    I can call guiCreate() from gui.c or I can write my own function for this, because I can now use all variables.

    Without it, I will get error that compiler can not found gdispImage variable (exists only inside gui.c, not in my main.c), same with calling functions that creates pages (linker cannot find functions).

    So, all that needed is (when generating gui.c and gui.h):

    - add to gui.h definitions font_t and gdispImage variables (as extern), not only GHandle vars

    - add to gui.h definitions of functions that creates pages (not only guiCreate, guiShowPage and guiEventLoop)

    Just to allow main program see that variables and call that functions.

  15. More feedback.

    I think it will be good to define image variables in header file as well as Create*() functions, like this is done for other resources handlers. Also it will be nice to define them as non-static. :)

    This will allow not to use guiCreate() from gui.c, copy this generated function from gui.c to firmware source file and modify. guiCreate() will not be included to firmware by compilator as unused, so we can use it 'as generated' or not, this will add some freedom to developer, without any codesize overhead.

    Also, Studio writes gui.c not in unicode (detected by FAR as win1251), so all Cyrillic chars not works :(

  16. Thank you for answer!

    You have mentioned that "We will eventually add a transparent background rendering option of the label widget ourselves (I put it on the ToDo list) but this won't happen before the weekend for sure." in other thread. I know how to achieve this right now (and wrote this already), but question was about how to do it right way (assuming 'label allowing transparency' is a part of stock uGFX). I mean that in future user (developer) can use label as now (with background) or can use it without filling label's area. So, label should have special parameter to turn on transparency (turn off filling). Draw routine should call function with fill or not, or just use this parameter to call one function with additional parameter (instead of both existing functions). So will be function like SetBackgroundFill(ghLabel1, FALSE), or wi.donotfillarea = 1, or something like this?

    I understand that transparent label requires clearing its area before it can be redrawed safely - in some cases (when changing text), or not (when changing just color of text, for example). So I try to guess right way how to do it, to be consistent with built-in transparency later.

    What about my own color formats and rewriting code, I always try not to make changes that can be avoided and i hate doubling of code like in two functions mentioned in previous message (may I got this some time ago while working with CPUs that had little RAM and ROM space), so it strange for me to trade firmware space for readability of code. :)

    This is why I asked about reasons to write two functions (with code overhead) instead of one.

  17. Going deeper into uGFX.

    How you would implement label with transparent background (i.e. without fill_area)?

    We need to determine will we call fill_area or not in draw routine (or call one of functions above, or mix both functions into one with new 'fill' parameter).

    But how we can know that user wants label to be transparent?

    We cannot use special color for transparent color, because we have no unused color values.

    So we should add new parameter to label?

    Can customparam be used for this or this is not a good idea?

    Also I see two functions - gdispGFillStringBox() and gdispGDrawStringBox(), which differs only by couple of lines (assigning colors and calling fillarea() - fill label area or not).

    Why was choosed this method of drawing string line by two functions? Why not use one function with parameter, to fill label area or not?

    Thanks!

  18. No, it won't work at all.

    When I trying to run it with command:

    mcufont import_ttf scada.ttf 20

    it terminates with message:

    This application has requested the Runtime to terminate it in an unusual way.

    Please contact the application's support team for more information.

    I have tried this on Windows 8 64-bit and Windows XP 32-bit with same result.

    I have tried to convert font DejaVuSans.ttf from fonts directory - same error.

    update: My friend gave me access to linux shell where linux binary runs fine without core dump (on second try), so I can convert fonts now. Multi-range is working, thank you! But windows binary needs to be repaired..

  19. I have read both articles and finally got font (maybe it will be useful to write in online converter that custom range should be set not in character codes, but by characters itself?)

    I got file with size of 251k.

    I cannot use two fonts because I have to use digits and cyrillic chars in one text.

    I think multiple ranges is a good idea to save firmware space.

×
×
  • Create New...