Emwin mixes blue and red color

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Emwin mixes blue and red color

      Hey,
      i'm facing a strange problem. I recently noticed that all blue texts are displayed in red and all red texts are displayed in blue.
      Looks like emwin swaps the red and blue color part

      My current emwin version is 5.40. I went back to some old version with emwin 5.32 and the texts are displayed correct. Now my actual driver to communicate with the lcd has not undergone any changes. I was wondering if there have been some emwin internal changes?

      Thats my current code (tested with emwin 5.32 and 5.40)

      C Source Code

      1. GUI_DispStringAt("Text 1", 10, 10);
      2. GUI_SetColor(GUI_RED);
      3. //displayed in blue in 5.40
      4. GUI_DispStringAt("Text 2", 10, 40);
      5. GUI_SetColor(GUI_DARKGREEN);
      6. //displayed in green in 5.40
      7. GUI_DispStringAt("Text 3", 10, 70);
      8. GUI_SetColor(GUI_BLUE);
      9. //displayed in red in 5.40
      10. GUI_DispStringAt("Text 4", 60, 100);
      Display All
      Can you tell me where the color information is actually passed to the lcd driver?
    • hey thx, that did solve the problem i did replace GUICC_565 with GUICC_M565. :)
      I went back in my version control and i can defiantly confirm now that the change was introduced when i updated the emwin versions.
      However the actual driver and configuration files stayed the same. There must have been some internal changed in the emin lib.

      I replaced the GUICC_565 within the LCD_X_Config()

      Source Code

      1. void LCD_X_Config(void) {
      2. GUI_DEVICE * pDevice;
      3. CONFIG_FLEXCOLOR Config = {0};
      4. GUI_PORT_API PortAPI = {0};
      5. //
      6. // Set display driver and color conversion
      7. //
      8. pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_M565, 0, 0);
      9. //
      10. // Display driver configuration, required for Lin-driver
      11. //
      12. LCD_SetSizeEx (0, XSIZE_PHYS , YSIZE_PHYS);
      13. LCD_SetVSizeEx(0, VXSIZE_PHYS, VYSIZE_PHYS);
      14. //
      15. // Orientation
      16. //
      17. Config.Orientation = GUI_MIRROR_X;//GUI_SWAP_XY;// | GUI_MIRROR_Y;
      18. GUIDRV_FlexColor_Config(pDevice, &Config);
      19. //
      20. // Set controller and operation mode
      21. //
      22. PortAPI.pfWrite8_A0 = LcdWriteReg;
      23. PortAPI.pfWrite8_A1 = LcdWriteData;
      24. PortAPI.pfWriteM8_A1 = LcdWriteDataMultiple;
      25. PortAPI.pfRead8_A1 = LcdReadData;
      26. PortAPI.pfReadM8_A1 = LcdReadDataMultiple;
      27. GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B8);
      28. }
      Display All
      is there any other place i'll have to change?
    • hey,
      unfortunately th esolution is not perfect.
      all my bmps are missing their red color part. I tried regenerating the bmps with emwin bitmap converter with
      1. High color 565
      2. High color 565 read and blue swapped
      but both output images look the same (no red parts in either of them). Once i go back to GUICC_565 both images (swapped and normal) still kook the same but both of them have their red parts.
      SO do i have to change the driver setting anywhere else?
    • hey,
      all images are pngs originally. They were all converted using the segger tool BmpCvtST.exe

      The exported files are c files. All Images are displayed using GUI_DrawBitmap()


      (Just out of curiosity i replaced the emwin 5.40 Version (library (os + gcc) and header files) with the old V5.32 files (library + header). And voila everything working fine. Everything else stayed the same. GuiConf.c/h and LCDConf.c/h have not been touched. Therefore it must have something to do with internal changed from 5.32 to 5.40 )

      What is the current emwin version? Is there a newer version of 5.40 ?

      It is wired though that the switch of red and blue colors affected the text but not the images. I would have expected blue and red mixed in the images as well but there isno red at all:(
    • Hi,

      The latest version of emWin is V5.48c. But please note that we are not responsible for releasing the libraries offered by the silicon vendors.

      Please ask your silicon vendor if he can update the libraries offered by him.


      It is wired though that the switch of red and blue colors affected the text but not the images. I would have expected blue and red mixed in the images as well but there isno red at all
      Sometimes a little change can cause strange behavior. Without the same setup as you have it is hard to say what has caused this issue.

      Regards,
      Sven