IPS-LCD-Display - 1,14 '' 240x135px SPI - 65K RGB - Waveshare 18231Error: initializer-string for array of chars is too long [-fpermissive]

Hello everybody,

I have a problem with my IPS-LCD-Display - 1,14 '' 240x135px SPI - 65K RGB - Waveshare 18231.
I have downloaded the arduino code from the official website, but I cant even verify the code. Here is the error message:

C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font12.cpp:110:1: error: initializer-string for array of chars is too long [-fpermissive]
 };
 ^
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font12.cpp:110:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font12.cpp:110:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font12.cpp:110:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font12.cpp:110:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
 };
 ^
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\font24CN.cpp:455:1: error: initializer-string for array of chars is too long [-fpermissive]
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\DEV_Config.cpp: In function 'void Config_Init()':
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\DEV_Config.cpp:51:7: error: 'class arduino::ArduinoSPI' has no member named 'setDataMode'
   SPI.setDataMode(SPI_MODE3);
       ^~~~~~~~~~~
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\DEV_Config.cpp:52:7: error: 'class arduino::ArduinoSPI' has no member named 'setBitOrder'
   SPI.setBitOrder(MSBFIRST);
       ^~~~~~~~~~~
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\DEV_Config.cpp:53:7: error: 'class arduino::ArduinoSPI' has no member named 'setClockDivider'
   SPI.setClockDivider(SPI_CLOCK_DIV2);
       ^~~~~~~~~~~~~~~
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\DEV_Config.cpp:53:23: error: 'SPI_CLOCK_DIV2' was not declared in this scope
   SPI.setClockDivider(SPI_CLOCK_DIV2);
                       ^~~~~~~~~~~~~~
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\DEV_Config.cpp:53:23: note: suggested alternative: 'CGC_CLOCK_PLL2'
   SPI.setClockDivider(SPI_CLOCK_DIV2);
                       ^~~~~~~~~~~~~~
                       CGC_CLOCK_PLL2
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\GUI_Paint.cpp: In function 'void Paint_DrawString_CN(uint16_t, uint16_t, const char*, cFONT*, uint16_t, uint16_t)':
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\GUI_Paint.cpp:499:32: error: invalid conversion from 'const char*' to 'const unsigned char*' [-fpermissive]
  const unsigned char* p_text = pString;
                                ^~~~~~~

exit status 1

Compilation error: initializer-string for array of chars is too long [-fpermissive]

Can someone help me with this problem? :slight_smile:

Your topic does not indicate an upload problem and therefore has been moved to a more suitable location on the forum.

Please post your sketch. Please tell us which board you have selected in the IDE.

PS
Your error is actually elsewhere; see

Hey @sterretje,

thank you for your response! I have selected the Arduino Uno R4. Please find the sketch here:

#include <SPI.h>
#include "LCD_Driver.h"
#include "GUI_Paint.h"
#include "image.h"

void setup()
{
  Config_Init();
  LCD_Init();
  LCD_Clear(WHITE);
  LCD_SetBacklight(100);
  Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 0, WHITE);
  Paint_Clear(WHITE);
  Paint_SetRotate(0);
  Paint_DrawPoint(2,1, BLACK, DOT_PIXEL_1X1,  DOT_FILL_RIGHTUP);//240 240
  Paint_DrawPoint(2,6, BLACK, DOT_PIXEL_2X2,  DOT_FILL_RIGHTUP);
  Paint_DrawPoint(2,11, BLACK, DOT_PIXEL_3X3, DOT_FILL_RIGHTUP);
  Paint_DrawPoint(2,16, BLACK, DOT_PIXEL_4X4, DOT_FILL_RIGHTUP);
  Paint_DrawPoint(2,21, BLACK, DOT_PIXEL_5X5, DOT_FILL_RIGHTUP);
  Paint_DrawLine( 10,  5, 40, 35, MAGENTA, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
  Paint_DrawLine( 10, 35, 40,  5, MAGENTA, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
  
  Paint_DrawLine( 80,  20, 110, 20, CYAN, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
  Paint_DrawLine( 95,   5,  95, 35, CYAN, DOT_PIXEL_1X1, LINE_STYLE_DOTTED);
  
  Paint_DrawRectangle(10, 5, 40, 35, RED, DOT_PIXEL_2X2,DRAW_FILL_EMPTY);
  Paint_DrawRectangle(45, 5, 75, 35, BLUE, DOT_PIXEL_2X2,DRAW_FILL_FULL);
  
  Paint_DrawCircle(95, 20, 15, GREEN, DOT_PIXEL_1X1, DRAW_FILL_EMPTY);
  Paint_DrawCircle(130, 20, 15, GREEN, DOT_PIXEL_1X1, DRAW_FILL_FULL);
  
  
  Paint_DrawFloatNum (50, 40 ,9.87654321,3, &Font20,  WHITE,  BLACK);
  Paint_DrawString_EN(1, 40, "ABC", &Font20, 0x000f, 0xfff0);
  Paint_DrawString_CN(1,60, "微雪电子",  &Font24CN, WHITE, BLUE);
  Paint_DrawString_EN(1, 100, "WaveShare", &Font16, RED, WHITE);

  Paint_DrawImage(gImage_70X70, 160, 60, 70, 70); 

}
void loop()
{
  
}



/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

However, the error highlights line 110 (see sad smilie) of the font12.cpp:

/**
  ******************************************************************************
  * @file    Font12.c
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    18-February-2014
  * @brief   This file provides text Font12 for STM32xx-EVAL's LCD driver. 
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
  *
  * Redistribution and use in source and binary forms, with or without modification,
  * are permitted provided that the following conditions are met:
  *   1. Redistributions of source code must retain the above copyright notice,
  *      this list of conditions and the following disclaimer.
  *   2. Redistributions in binary form must reproduce the above copyright notice,
  *      this list of conditions and the following disclaimer in the documentation
  *      and/or other materials provided with the distribution.
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
  *      may be used to endorse or promote products derived from this software
  *      without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "fonts.h"


// 
//  Font data for Courier New 12pt
// 

const CH_CN Font12CN_Table[] = 
{
/*--  文字:  你  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"你",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1D,0xC0,0x1D,0x80,0x3B,0xFF,0x3B,0x07,
0x3F,0x77,0x7E,0x76,0xF8,0x70,0xFB,0xFE,0xFB,0xFE,0x3F,0x77,0x3F,0x77,0x3E,0x73,
0x38,0x70,0x38,0x70,0x3B,0xE0,0x00,0x00,0x00,0x00},

/*--  文字:  好  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"好",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x73,0xFF,0x70,0x0F,0xFE,0x1E,
0x7E,0x3C,0x6E,0x38,0xEE,0x30,0xEF,0xFF,0xFC,0x30,0x7C,0x30,0x38,0x30,0x3E,0x30,
0x7E,0x30,0xE0,0x30,0xC1,0xF0,0x00,0x00,0x00,0x00},

/*--  文字:  树  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"树",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x0E,0x30,0x0E,0x3F,0xEE,0x30,0xEE,
0xFC,0xFF,0x76,0xCE,0x77,0xFE,0x7B,0xFE,0xFF,0xFE,0xF3,0xDE,0xF3,0xCE,0x37,0xEE,
0x3E,0x6E,0x3C,0x0E,0x30,0x3E,0x00,0x00,0x00,0x00},

/*--  文字:  莓  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"莓",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x70,0xFF,0xFF,0x3E,0x70,0x38,0x00,
0x7F,0xFF,0xE0,0x00,0xFF,0xFC,0x3B,0x8C,0x39,0xCC,0xFF,0xFF,0x73,0x9C,0x71,0xDC,
0x7F,0xFF,0x00,0x1C,0x01,0xF8,0x00,0x00,0x00,0x00},

/*--  文字:  派  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"派",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x1F,0xFF,0xF0,0x3E,0x00,0x0E,0x1F,
0xCF,0xFB,0xFF,0xF8,0x3F,0xFF,0x0F,0xFF,0x7F,0xD8,0x7F,0xDC,0x6F,0xCE,0xED,0xFF,
0xFD,0xF7,0xF9,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},

/*--  文字:  a  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"a",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3E,0x00,0x67,0x00,0x07,0x80,0x0F,0x80,0x7F,0x80,0xE3,0x80,0xE7,0x80,0xE7,0x80,
0x7F,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

/*--  文字:  b  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"b",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x70,0x00,0x70,0x00,
0x7F,0x00,0x7B,0x80,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x71,0xC0,0x7B,0x80,
0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

/*--  文字:  c  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"c",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x3F,0x00,0x73,0x00,0xF0,0x00,0xE0,0x00,0xE0,0x00,0xE0,0x00,0xF0,0x00,0x73,0x00,
0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},

/*--  文字:  A  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"A",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x1F,0x00,0x1F,0x00,
0x1F,0x00,0x3B,0x80,0x3B,0x80,0x71,0x80,0x7F,0xC0,0x71,0xC0,0xE0,0xE0,0xE0,0xE0,
0xE0,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
**};** :frowning_face:

cFONT Font12CN = {
  Font12CN_Table,
  sizeof(Font12CN_Table)/sizeof(CH_CN),  /*size of table*/
  11, /* ASCII Width */
  16, /* Width */
  21, /* Height */
};

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Apologies, I did not scroll through the full error message.

As far as I can see it's a bug in the files that are part of the sketch.
Font12CN_Table[] is a one-dimensional array but the initialisation is for a two-dimensional array.

const CH_CN Font12CN_Table[] = 
{
/*--  文字:  你  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"你",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1D,0xC0,0x1D,0x80,0x3B,0xFF,0x3B,0x07,
0x3F,0x77,0x7E,0x76,0xF8,0x70,0xFB,0xFE,0xFB,0xFE,0x3F,0x77,0x3F,0x77,0x3E,0x73,
0x38,0x70,0x38,0x70,0x3B,0xE0,0x00,0x00,0x00,0x00},

/*--  文字:  好  --*/
/*--  微软雅黑12;  此字体下对应的点阵为:宽x高=16x21   --*/
{"好",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x73,0xFF,0x70,0x0F,0xFE,0x1E,
0x7E,0x3C,0x6E,0x38,0xEE,0x30,0xEF,0xFF,0xFC,0x30,0x7C,0x30,0x38,0x30,0x3E,0x30,
0x7E,0x30,0xE0,0x30,0xC1,0xF0,0x00,0x00,0x00,0x00},
...
...
}

A one-dimensional array would simply have a { and }, this array has more { and } separated by commas.

It's also of type CH_CN which is a struct defined in fonts.h as

//GB2312
typedef struct                                          // 汉字字模数据结构
{
  unsigned char index[3];                               // 汉字内码索引
  const char matrix[MAX_HEIGHT_FONT*MAX_WIDTH_FONT/8];  // 点阵码数据
}CH_CN;

So that's another bug in the Font12CN_Table[]. Once you have fixed every font, you might still have other problem due to that.

Compiling for an Uno gives the same "too long" message but this time it's just a warning because the compiler is configured differently.

After compiling that, I think that you will still have the problem with the SPI stuff.

Update: I was in contact with the waveshare support.
Their responds was:

"Because the R4 library is different from UNO, R4 needs to change the length and SPI initialization

See the location in the figure below :



If it cannot be displayed, you can try to adjust the SPI frequency, increase or decrease, adjust it to increase or decrease by 100K"

However, after making the adjustments I still got an error:

C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\GUI_Paint.cpp: In function 'void Paint_DrawString_CN(uint16_t, uint16_t, const char*, cFONT*, uint16_t, uint16_t)':
C:\Users\...\1.14inch Code\LCD_Module_code\Arduino\LCD_1inch14\GUI_Paint.cpp:499:32: error: invalid conversion from 'const char*' to 'const unsigned char*' [-fpermissive]
  const unsigned char* p_text = pString;
                                ^~~~~~~

exit status 1

Compilation error: invalid conversion from 'const char*' to 'const unsigned char*' [-fpermissive]

The IDE highlighted the line 499 of GUI_Paint.cpp:

`/*****************************************************************************
  | File        :   GUI_Paint.c
  | Author      :   Waveshare team
  | Function    : Achieve drawing: draw points, lines, boxes, circles and
                    their size, solid dotted line, solid rectangle hollow
                    rectangle, solid circle hollow circle.
  | Info        :
    Achieve display characters: Display a single character, string, number
    Achieve time display: adaptive size display time minutes and seconds
  ----------------
  | This version:   V1.0
  | Date        :   2018-11-15
  | Info        :

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documnetation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to  whom the Software is
  furished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.

******************************************************************************/
#include "GUI_Paint.h"
#include "DEV_Config.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h> //memset()
#include <math.h>

volatile PAINT Paint;

/******************************************************************************
  function: Create Image
  parameter:
    image   :   Pointer to the image cache
    width   :   The width of the picture
    Height  :   The height of the picture
    Color   :   Whether the picture is inverted
******************************************************************************/
void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
{
  Paint.WidthMemory = Width;
  Paint.HeightMemory = Height;
  Paint.Color = Color;
  Paint.WidthByte = Width;
  Paint.HeightByte = Height;
  
  Paint.Rotate = Rotate;
  Paint.Mirror = MIRROR_NONE;

  if (Rotate == ROTATE_0 || Rotate == ROTATE_180) {
    Paint.Width = Width;
    Paint.Height = Height;
  } else {
    Paint.Width = Height;
    Paint.Height = Width;
  }
}

/******************************************************************************
  function: Select Image Rotate
  parameter:
    Rotate   :   0,90,180,270
******************************************************************************/
void Paint_SetRotate(UWORD Rotate)
{
  if (Rotate == ROTATE_0 || Rotate == ROTATE_90 || Rotate == ROTATE_180 || Rotate == ROTATE_270) {
    //Debug("Set image Rotate %d\r\n", Rotate);
    Paint.Rotate = Rotate;
  } else {
    //Debug("rotate = 0, 90, 180, 270\r\n");
    //  exit(0);
  }
}

/******************************************************************************
  function: Select Image mirror
  parameter:
    mirror   :       Not mirror,Horizontal mirror,Vertical mirror,Origin mirror
******************************************************************************/
void Paint_SetMirroring(UBYTE mirror)
{
  if (mirror == MIRROR_NONE || mirror == MIRROR_HORIZONTAL ||
      mirror == MIRROR_VERTICAL || mirror == MIRROR_ORIGIN) {
    //Debug("mirror image x:%s, y:%s\r\n", (mirror & 0x01) ? "mirror" : "none", ((mirror >> 1) & 0x01) ? "mirror" : "none");
    Paint.Mirror = mirror;
  } else {
    //Debug("mirror should be MIRROR_NONE, MIRROR_HORIZONTAL, \
        MIRROR_VERTICAL or MIRROR_ORIGIN\r\n");
    //exit(0);
  }
}

/******************************************************************************
  function: Draw Pixels
  parameter:
    Xpoint  :   At point X
    Ypoint  :   At point Y
    Color   :   Painted colors
******************************************************************************/
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
{
  if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
    //Debug("Exceeding display boundaries\r\n");
    return;
  }
  UWORD X, Y;

  switch (Paint.Rotate) {
    case 0:
      X = Xpoint;
      Y = Ypoint;
      break;
    case 90:
      X = Paint.WidthMemory - Ypoint - 1;
      Y = Xpoint;
      break;
    case 180:
      X = Paint.WidthMemory - Xpoint - 1;
      Y = Paint.HeightMemory - Ypoint - 1;
      break;
    case 270:
      X = Ypoint;
      Y = Paint.HeightMemory - Xpoint - 1;
      break;

    default:
      return;
  }

  switch (Paint.Mirror) {
    case MIRROR_NONE:
      break;
    case MIRROR_HORIZONTAL:
      X = Paint.WidthMemory - X - 1;
      break;
    case MIRROR_VERTICAL:
      Y = Paint.HeightMemory - Y - 1;
      break;
    case MIRROR_ORIGIN:
      X = Paint.WidthMemory - X - 1;
      Y = Paint.HeightMemory - Y - 1;
      break;
    default:
      return;
  }

  // printf("x = %d, y = %d\r\n", X, Y);
  if (X > Paint.WidthMemory || Y > Paint.HeightMemory) {
    //Debug("Exceeding display boundaries\r\n");
    return;
  }

  // UDOUBLE Addr = X / 8 + Y * Paint.WidthByte;
  LCD_SetUWORD(X, Y, Color);
}

/******************************************************************************
  function: Clear the color of the picture
  parameter:
    Color   :   Painted colors
******************************************************************************/
void Paint_Clear(UWORD Color)
{
  LCD_SetCursor(0, 0, Paint.WidthByte , Paint.HeightByte);
  for (UWORD Y = 0; Y < Paint.HeightByte; Y++) {
    for (UWORD X = 0; X < Paint.WidthByte; X++ ) {//8 pixel =  1 byte
      LCD_WriteData_Word(Color);
    }
  }
}

/******************************************************************************
  function: Clear the color of a window
  parameter:
    Xstart :   x starting point
    Ystart :   Y starting point
    Xend   :   x end point
    Yend   :   y end point
******************************************************************************/
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
{
  UWORD X, Y;
  for (Y = Ystart; Y < Yend; Y++) {
    for (X = Xstart; X < Xend; X++) {//8 pixel =  1 byte
      Paint_SetPixel(X, Y, Color);
    }
  }
}

/******************************************************************************
function:	Draw Point(Xpoint, Ypoint) Fill the color
parameter:
    Xpoint		:   The Xpoint coordinate of the point
    Ypoint		:   The Ypoint coordinate of the point
    Color		:   Set color
    Dot_Pixel	:	point size
******************************************************************************/
void Paint_DrawPoint( UWORD Xpoint,       UWORD Ypoint, UWORD Color,
                      DOT_PIXEL Dot_Pixel,DOT_STYLE Dot_FillWay)
{
    if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
        Debug("Paint_DrawPoint Input exceeds the normal display range\r\n");
        return;
    }

    int16_t XDir_Num , YDir_Num;
    if (Dot_FillWay == DOT_FILL_AROUND) {
        for (XDir_Num = 0; XDir_Num < 2*Dot_Pixel - 1; XDir_Num++) {
            for (YDir_Num = 0; YDir_Num < 2 * Dot_Pixel - 1; YDir_Num++) {
                if(Xpoint + XDir_Num - Dot_Pixel < 0 || Ypoint + YDir_Num - Dot_Pixel < 0)
                    break;
                // printf("x = %d, y = %d\r\n", Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel);
                Paint_SetPixel(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
            }
        }
    } else {
        for (XDir_Num = 0; XDir_Num <  Dot_Pixel; XDir_Num++) {
            for (YDir_Num = 0; YDir_Num <  Dot_Pixel; YDir_Num++) {
                Paint_SetPixel(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
            }
        }
    }
}

/******************************************************************************
function:	Draw a line of arbitrary slope
parameter:
    Xstart :Starting Xpoint point coordinates
    Ystart :Starting Xpoint point coordinates
    Xend   :End point Xpoint coordinate
    Yend   :End point Ypoint coordinate
    Color  :The color of the line segment
******************************************************************************/
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, 
                    UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
{
    if (Xstart > Paint.Width || Ystart > Paint.Height ||
        Xend > Paint.Width || Yend > Paint.Height) {
        Debug("Paint_DrawLine Input exceeds the normal display range\r\n");
        return;
    }

    UWORD Xpoint = Xstart;
    UWORD Ypoint = Ystart;
    int dx = (int)Xend - (int)Xstart >= 0 ? Xend - Xstart : Xstart - Xend;
    int dy = (int)Yend - (int)Ystart <= 0 ? Yend - Ystart : Ystart - Yend;

    // Increment direction, 1 is positive, -1 is counter;
    int XAddway = Xstart < Xend ? 1 : -1;
    int YAddway = Ystart < Yend ? 1 : -1;

    //Cumulative error
    int Esp = dx + dy;
    char Dotted_Len = 0;

    for (;;) {
        Dotted_Len++;
        //Painted dotted line, 2 point is really virtual
        if (Line_Style == LINE_STYLE_DOTTED && Dotted_Len % 3 == 0) {
            //Debug("LINE_DOTTED\r\n");
            Paint_DrawPoint(Xpoint, Ypoint, IMAGE_BACKGROUND, Line_width, DOT_STYLE_DFT);
            Dotted_Len = 0;
        } else {
            Paint_DrawPoint(Xpoint, Ypoint, Color, Line_width, DOT_STYLE_DFT);
        }
        if (2 * Esp >= dy) {
            if (Xpoint == Xend)
                break;
            Esp += dy;
            Xpoint += XAddway;
        }
        if (2 * Esp <= dx) {
            if (Ypoint == Yend)
                break;
            Esp += dx;
            Ypoint += YAddway;
        }
    }
}

/******************************************************************************
function:	Draw a rectangle
parameter:
    Xstart :Rectangular  Starting Xpoint point coordinates
    Ystart :Rectangular  Starting Xpoint point coordinates
    Xend   :Rectangular  End point Xpoint coordinate
    Yend   :Rectangular  End point Ypoint coordinate
    Color  :The color of the Rectangular segment
    Filled : Whether it is filled--- 1 solid 0:empty
******************************************************************************/
void Paint_DrawRectangle( UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, 
                          UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Filled )
{
    if (Xstart > Paint.Width || Ystart > Paint.Height ||
        Xend > Paint.Width || Yend > Paint.Height) {
        Debug("Input exceeds the normal display range\r\n");
        return;
    }

    if (Filled ) {
        UWORD Ypoint;
        for(Ypoint = Ystart; Ypoint < Yend; Ypoint++) {
            Paint_DrawLine(Xstart, Ypoint, Xend, Ypoint, Color ,Line_width, LINE_STYLE_SOLID);
        }
    } else {
        Paint_DrawLine(Xstart, Ystart, Xend, Ystart, Color ,Line_width, LINE_STYLE_SOLID);
        Paint_DrawLine(Xstart, Ystart, Xstart, Yend, Color ,Line_width, LINE_STYLE_SOLID);
        Paint_DrawLine(Xend, Yend, Xend, Ystart, Color ,Line_width, LINE_STYLE_SOLID);
        Paint_DrawLine(Xend, Yend, Xstart, Yend, Color ,Line_width, LINE_STYLE_SOLID);
    }
}

/******************************************************************************
function:	Use the 8-point method to draw a circle of the
            specified size at the specified position->
parameter:
    X_Center  :Center X coordinate
    Y_Center  :Center Y coordinate
    Radius    :circle Radius
    Color     :The color of the :circle segment
    Filled    : Whether it is filled: 1 filling 0:Do not
******************************************************************************/
void Paint_DrawCircle(  UWORD X_Center, UWORD Y_Center, UWORD Radius, 
                        UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill )
{
    if (X_Center > Paint.Width || Y_Center >= Paint.Height) {
        Debug("Paint_DrawCircle Input exceeds the normal display range\r\n");
        return;
    }

    //Draw a circle from(0, R) as a starting point
    int16_t XCurrent, YCurrent;
    XCurrent = 0;
    YCurrent = Radius;

    //Cumulative error,judge the next point of the logo
    int16_t Esp = 3 - (Radius << 1 );

    int16_t sCountY;
    if (Draw_Fill == DRAW_FILL_FULL) {
        while (XCurrent <= YCurrent ) { //Realistic circles
            for (sCountY = XCurrent; sCountY <= YCurrent; sCountY ++ ) {
                Paint_DrawPoint(X_Center + XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//1
                Paint_DrawPoint(X_Center - XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//2
                Paint_DrawPoint(X_Center - sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//3
                Paint_DrawPoint(X_Center - sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//4
                Paint_DrawPoint(X_Center - XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//5
                Paint_DrawPoint(X_Center + XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//6
                Paint_DrawPoint(X_Center + sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//7
                Paint_DrawPoint(X_Center + sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);
            }
            if (Esp < 0 )
                Esp += 4 * XCurrent + 6;
            else {
                Esp += 10 + 4 * (XCurrent - YCurrent );
                YCurrent --;
            }
            XCurrent ++;
        }
    } else { //Draw a hollow circle
        while (XCurrent <= YCurrent ) {
            Paint_DrawPoint(X_Center + XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//1
            Paint_DrawPoint(X_Center - XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//2
            Paint_DrawPoint(X_Center - YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//3
            Paint_DrawPoint(X_Center - YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//4
            Paint_DrawPoint(X_Center - XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//5
            Paint_DrawPoint(X_Center + XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//6
            Paint_DrawPoint(X_Center + YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//7
            Paint_DrawPoint(X_Center + YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//0

            if (Esp < 0 )
                Esp += 4 * XCurrent + 6;
            else {
                Esp += 10 + 4 * (XCurrent - YCurrent );
                YCurrent --;
            }
            XCurrent ++;
        }
    }
}

/******************************************************************************
  function: Show English characters
  parameter:
    Xpoint           :X coordinate
    Ypoint           :Y coordinate
    Acsii_Char       :To display the English characters
    Font             :A structure pointer that displays a character size
    Color_Background : Select the background color of the English character
    Color_Foreground : Select the foreground color of the English character
******************************************************************************/
void Paint_DrawChar(UWORD Xpoint, UWORD Ypoint, const char Acsii_Char,
                    sFONT* Font, UWORD Color_Background, UWORD Color_Foreground)
{

  UWORD Page, Column;

  if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
    //Debug("Paint_DrawChar Input exceeds the normal display range\r\n");
    return;
  }
  uint32_t Char_Offset = (Acsii_Char - ' ') * Font->Height * (Font->Width / 8 + (Font->Width % 8 ? 1 : 0));
  const unsigned char *ptr = &Font->table[Char_Offset];

  for ( Page = 0; Page < Font->Height; Page ++ ) {
    for ( Column = 0; Column < Font->Width; Column ++ ) {

      //To determine whether the font background color and screen background color is consistent
      if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
        if (pgm_read_byte(ptr) & (0x80 >> (Column % 8)))
          Paint_SetPixel (Xpoint + Column, Ypoint + Page, Color_Foreground );
      } else {
        if (pgm_read_byte(ptr) & (0x80 >> (Column % 8))) {
          Paint_SetPixel (Xpoint + Column, Ypoint + Page, Color_Foreground );
        } else {
          Paint_SetPixel (Xpoint + Column, Ypoint + Page, Color_Background );
        }
      }
      //One pixel is 8 bits
      if (Column % 8 == 7) {
        ptr++;
      }
    }/* Write a line */
    if (Font->Width % 8 != 0) {
      ptr++;
    }
  }/* Write all */
}

/******************************************************************************
  function: Display the string
  parameter:
    Xstart           :X coordinate
    Ystart           :Y coordinate
    pString          :The first address of the English string to be displayed
    Font             :A structure pointer that displays a character size
    Color_Background : Select the background color of the English character
    Color_Foreground : Select the foreground color of the English character
******************************************************************************/
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
                         sFONT* Font, UWORD Color_Background, UWORD Color_Foreground )
{
  UWORD Xpoint = Xstart;
  UWORD Ypoint = Ystart;

  if (Xstart > Paint.Width || Ystart > Paint.Height) {
    //Debug("Paint_DrawString_EN Input exceeds the normal display range\r\n");
    return;
  }

  while (* pString != '\0') {
    //if X direction filled , reposition to(Xstart,Ypoint),Ypoint is Y direction plus the Height of the character
    if ((Xpoint + Font->Width ) > Paint.Width ) {
      Xpoint = Xstart;
      Ypoint += Font->Height;
    }

    // If the Y direction is full, reposition to(Xstart, Ystart)
    if ((Ypoint  + Font->Height ) > Paint.Height ) {
      Xpoint = Xstart;
      Ypoint = Ystart;
    }
    Paint_DrawChar(Xpoint, Ypoint, * pString, Font, Color_Background, Color_Foreground);

    //The next character of the address
    pString ++;

    //The next word of the abscissa increases the font of the broadband
    Xpoint += Font->Width;
  }
}


/******************************************************************************
  function: Display the string
  parameter:
    Xstart           :X coordinate
    Ystart           :Y coordinate
    pString          :The first address of the Chinese string and English
                        string to be displayed
    Font             :A structure pointer that displays a character size
    Color_Background : Select the background color of the English character
    Color_Foreground : Select the foreground color of the English character
******************************************************************************/
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Background, UWORD Color_Foreground)
{
 const unsigned char* p_text = pString;

  int refcolumn = Xstart;
  int i, j, Num;
  /* Send the string character by character on EPD */
  while (*p_text != 0) {
    if (*p_text < 0x7F) {                                  //ASCII
      for (Num = 0; Num < font->size ; Num++) {
        if (*p_text == pgm_read_byte(&font->table[Num].index[0])) {
          const char* ptr = &font->table[Num].matrix[0];

          for (j = 0; j < font->Height; j++) {
            for (i = 0; i < font->Width; i++) {
              if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
                Paint_SetPixel(refcolumn + i,Ystart + j, Color_Foreground);
              }
              if (i % 8 == 7) {
                ptr++;
              }
            }
            if (font->Width % 8 != 0) {
              ptr++;
            }
          }
          break;
        }
      }
      /* Point on the next character */
      p_text += 1;
      /* Decrement the column position by 16 */
      refcolumn += font->ASCII_Width;
    } else {                                   //中文
      for (Num = 0; Num < font->size ; Num++) {
        if ((*p_text == pgm_read_byte(&font->table[Num].index[0])) && (*(p_text + 1) == pgm_read_byte(&font->table[Num].index[1])) && (*(p_text + 2) == pgm_read_byte(&font->table[Num].index[2]))) {
          const char* ptr = &font->table[Num].matrix[0];

          for (j = 0; j < font->Height; j++) {
            for (i = 0; i < font->Width; i++) {
              if (pgm_read_byte(ptr) & (0x80 >> (i % 8))) {
                Paint_SetPixel(refcolumn + i,Ystart + j, Color_Foreground);
              }
              if (i % 8 == 7) {
                ptr++;
              }
            }
            if (font->Width % 8 != 0) {
              ptr++;
            }
          }
          break;
        }
      }
      /* Point on the next character */
      p_text += 3;
      /* Decrement the column position by 16 */
      refcolumn += font->Width;
    }
  }
}

/******************************************************************************
  function: Display nummber
  parameter:
    Xstart           :X coordinate
    Ystart           : Y coordinate
    Nummber          : The number displayed
    Font             :A structure pointer that displays a character size
    Color_Background : Select the background color of the English character
    Color_Foreground : Select the foreground color of the English character
******************************************************************************/
#define  ARRAY_LEN 50
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber,
                   sFONT* Font, UWORD Color_Background, UWORD Color_Foreground )
{

  int16_t Num_Bit = 0, Str_Bit = 0;
  uint8_t Str_Array[ARRAY_LEN] = {0}, Num_Array[ARRAY_LEN] = {0};
  uint8_t *pStr = Str_Array;

  if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
    //Debug("Paint_DisNum Input exceeds the normal display range\r\n");
    return;
  }

  //Converts a number to a string
  do{
    Num_Array[Num_Bit] = Nummber % 10 + '0';
    Num_Bit++;
    Nummber /= 10;
  }while (Nummber);

  //The string is inverted
  while (Num_Bit > 0) {
    Str_Array[Str_Bit] = Num_Array[Num_Bit - 1];
    Str_Bit ++;
    Num_Bit --;
  }

  //show
  Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Background, Color_Foreground);
}
/******************************************************************************
function:	Display float number
parameter:
    Xstart           :X coordinate
    Ystart           : Y coordinate
    Nummber          : The float data that you want to display
	Decimal_Point	 : Show decimal places
    Font             :A structure pointer that displays a character size
    Color            : Select the background color of the English character
******************************************************************************/
void Paint_DrawFloatNum(UWORD Xpoint, UWORD Ypoint, double Nummber,  UBYTE Decimal_Point, 
                        sFONT* Font,  UWORD Color_Background, UWORD Color_Foreground)
{
  char Str[ARRAY_LEN] = {0};
  dtostrf(Nummber,0,Decimal_Point+2,Str);
  char * pStr= (char *)malloc((strlen(Str))*sizeof(char));
  memcpy(pStr,Str,(strlen(Str)-2));
  * (pStr+strlen(Str)-1)='\0';
  if((*(pStr+strlen(Str)-3))=='.')
  {
	*(pStr+strlen(Str)-3)='\0';
  }
  //show
  Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Foreground, Color_Background);
  free(pStr);
  pStr=NULL;
}
/******************************************************************************
  function: Display time
  parameter:
    Xstart           :X coordinate
    Ystart           : Y coordinate
    pTime            : Time-related structures
    Font             :A structure pointer that displays a character size
    Color            : Select the background color of the English character
******************************************************************************/
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
                    UWORD Color_Background, UWORD Color_Foreground)
{
  uint8_t value[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

  UWORD Dx = Font->Width;

  //Write data into the cache
  Paint_DrawChar(Xstart                           , Ystart, value[pTime->Hour / 10], Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx                      , Ystart, value[pTime->Hour % 10], Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx  + Dx / 4 + Dx / 2   , Ystart, ':'                    , Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx * 2 + Dx / 2         , Ystart, value[pTime->Min / 10] , Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx * 3 + Dx / 2         , Ystart, value[pTime->Min % 10] , Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx * 4 + Dx / 2 - Dx / 4, Ystart, ':'                    , Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx * 5                  , Ystart, value[pTime->Sec / 10] , Font, Color_Background, Color_Foreground);
  Paint_DrawChar(Xstart + Dx * 6                  , Ystart, value[pTime->Sec % 10] , Font, Color_Background, Color_Foreground);
}

/******************************************************************************
  function: Display image
  parameter:
    image            :Image start address
    xStart           : X starting coordinates
    yStart           : Y starting coordinates
    xEnd             :Image width
    yEnd             : Image height
******************************************************************************/
void Paint_DrawImage(const unsigned char *image, UWORD xStart, UWORD yStart, UWORD W_Image, UWORD H_Image)
{
  int i, j;
  for (j = 0; j < H_Image; j++) {
    for (i = 0; i < W_Image; i++) {
      if (xStart + i < LCD_WIDTH  &&  yStart + j < LCD_HEIGHT) //Exceeded part does not display
        Paint_SetPixel(xStart + i, yStart + j, (pgm_read_byte(image + j * W_Image * 2 + i * 2 + 1)) << 8 | (pgm_read_byte(image + j * W_Image * 2 + i * 2)));
      //Using arrays is a property of sequential storage, accessing the original array by algorithm
      //j*W_Image*2          Y offset
      //i*2                  X offset
      //pgm_read_byte()
    }
  }

}
`

@sterretje What do you think about that?

Either change the functions pString argument to unsigned char or change p_text to char. The former one might give errors in functions that call Paint_DrawString_CN; the latter might cause errors further down the line in functions called from Paint_DrawString_CN.

It makes sense (for me) to change p_txt to a char pointer as you're working with text (so characters).

Thank you for the input @sterretje! I just got rid of the "unsigned" and it compiled! Now I also see something on the screen after uploading :slight_smile:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.