TJ-WW03-H03/APP_smoke_N_V1.3/HARDWARE/LCD/ST7735S.c

872 lines
19 KiB
C
Raw Normal View History

2024-07-29 10:32:25 +08:00
#include "ST7735s.h"
#include <stdio.h>
#include "spi_master_dma_interrupt.h"
#include "public.h"
#include "fpc.h"
#include "sim_eeprom.h"
#define ST7735_SLPOUT 0x11
#define ST7735_FRMCTR1 0xB1
#define ST7735_FRMCTR2 0xB2
#define ST7735_FRMCTR3 0xB3
#define ST7735_INVCTR 0xB4
#define ST7735_PWCTR1 0xC0
#define ST7735_PWCTR2 0xC1
#define ST7735_PWCTR3 0xC2
#define ST7735_PWCTR4 0xC3
#define ST7735_PWCTR5 0xC4
#define ST7735_VMCTR1 0xC5
#define ST7735_COLMOD 0x3A
#define ST7735_GMCTRP1 0xE0
#define ST7735_GMCTRN1 0xE1
#define ST7735_NORON 0x13
#define ST7735_DISPON 0x29
#define ST7735_CASET 0x2A
#define ST7735_RASET 0x2B
#define ST7735_RAMWR 0x2C
#define ST7735_INVOFF 0x20
#define ST7735_INVON 0x21
#define ST7735_MADCTL 0x36
#define ST7735_MADCTL_MX 0x40
#define ST7735_MADCTL_MY 0x80
#define ST7735_MADCTL_MV 0x20
#define ST7735_XOFFSET 0x02 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>80*160 <20><><EFBFBD><EFBFBD><EFBFBD>ߵڶ<DFB5><DAB6>е<EFBFBD>ram<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A3AC>Ļ<EFBFBD>к<EFBFBD><D0BA><EFBFBD>
//<2F><><EFBFBD><EFBFBD>82*160<36><30>ram ͼƬ<CDBC><C6AC>x<EFBFBD><78><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>Ư<EFBFBD><C6AF> ż<>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD>ͬ<EFBFBD><CDAC>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ʲ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>
#define PLATFORM_DelayMS DELAY_Ms
static uint8_t DMA_ram_buffer[4096];
float breath_down[10] = {0.900000, 0.810000, 0.729000, 0.656100, 0.590490, 0.531441, 0.478297, 0.430467, 0.387420, 0.348678};
//float breath_up[10] = {1.250000,1.562500,1.953125,2.441406,3.051758,3.814697,4.768372,5.960464,7.450581,9.313226};
u8 debug_flag = 0;
float Cclt_Power(float a, uint8_t b)
{
uint8_t i;
float temp;
temp = 1.0;
for(i=0;i<b;i++)
temp = temp*a;
return temp;
}
void ST7735_Reset(void)
{
DELAY_Ms(1);
GPIO_ResetBits(ST7735_RST_GPIO_Port, ST7735_RST_Pin);
PLATFORM_DelayMS(1);
GPIO_SetBits(ST7735_RST_GPIO_Port, ST7735_RST_Pin);
PLATFORM_DelayMS(120);
}
void ST7735_WriteCommand(uint8_t cmd)
{
GPIO_ResetBits(ST7735_DC_GPIO_Port, ST7735_DC_Pin);
SPI2_WriteBuffer(&cmd,1);
}
void ST7735_WriteByte(uint8_t data)
{
GPIO_SetBits(ST7735_DC_GPIO_Port, ST7735_DC_Pin);
SPI2_WriteBuffer(&data,1);
}
void ST7735_WriteData(uint8_t *data, uint16_t data_size)
{
GPIO_SetBits(ST7735_DC_GPIO_Port, ST7735_DC_Pin);
SPI2_WriteBuffer(data,data_size);
}
void ST7735_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_AHBPeriphClockCmd(RCC_AHBENR_GPIOA, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBENR_GPIOB, ENABLE);
RCC_AHBPeriphClockCmd(RCC_AHBENR_GPIOD, ENABLE);
GPIO_StructInit(&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = PVCC_EN_Pin ;//PVCC
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PVCC_EN_Port, &GPIO_InitStruct);
GPIO_StructInit(&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = ST7735_DC_Pin ;//DC(RS)
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(ST7735_DC_GPIO_Port, &GPIO_InitStruct);
GPIO_StructInit(&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = ST7735_RST_Pin ;//REST
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(ST7735_RST_GPIO_Port, &GPIO_InitStruct);
GPIO_StructInit(&GPIO_InitStruct);
GPIO_InitStruct.GPIO_Pin = ST7735_LED_Pin ;//LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(ST7735_LED_GPIO_Port, &GPIO_InitStruct);
PVCC_EN_ON();//pvcc_3.0 enable
GPIO_SetBits(ST7735_DC_GPIO_Port, ST7735_DC_Pin);
GPIO_SetBits(ST7735_RST_GPIO_Port, ST7735_RST_Pin);
ST7735_Reset();
ST7735_WriteCommand(0x11); //SleepOut
ST7735_WriteCommand(0x21); //<2F><><EFBFBD>÷<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>ױ<EFBFBD><D7B1><EFBFBD> <20>ڱ<EFBFBD><DAB1><EFBFBD>
ST7735_WriteCommand(0xB1);
ST7735_WriteByte(0x01);
ST7735_WriteByte(0x2C);
ST7735_WriteByte(0x2D);
ST7735_WriteCommand(0xB2);
ST7735_WriteByte(0x01);
ST7735_WriteByte(0x2C);
ST7735_WriteByte(0x2D);
ST7735_WriteCommand(0xB3);
ST7735_WriteByte(0x01);
ST7735_WriteByte(0x2C);
ST7735_WriteByte(0x2D);
ST7735_WriteByte(0x01);
ST7735_WriteByte(0x2C);
ST7735_WriteByte(0x2D);
ST7735_WriteCommand(0xB4); //Dot inversion
ST7735_WriteByte(0x03);
ST7735_WriteCommand(0xC0);
ST7735_WriteByte(0x62);
ST7735_WriteByte(0x02);
ST7735_WriteByte(0x04);
ST7735_WriteCommand(0xC1);
ST7735_WriteByte(0xC0);
ST7735_WriteCommand(0xC2);
ST7735_WriteByte(0x0D);
ST7735_WriteByte(0x00);
ST7735_WriteCommand(0xC3);
ST7735_WriteByte(0x8D);
ST7735_WriteByte(0x6A);
ST7735_WriteCommand(0xC4);
ST7735_WriteByte(0x8D);
ST7735_WriteByte(0xEE);
ST7735_WriteCommand(0xC5); //VCOM
ST7735_WriteByte(0x0E);
ST7735_WriteCommand(ST7735_CASET);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x83);
ST7735_WriteCommand(ST7735_RASET);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0xa1);
ST7735_WriteCommand(0xE0);
ST7735_WriteByte(0x10);
ST7735_WriteByte(0x0E);
ST7735_WriteByte(0x02);
ST7735_WriteByte(0x03);
ST7735_WriteByte(0x0E);
ST7735_WriteByte(0x07);
ST7735_WriteByte(0x02);
ST7735_WriteByte(0x07);
ST7735_WriteByte(0x0A);
ST7735_WriteByte(0x12);
ST7735_WriteByte(0x27);
ST7735_WriteByte(0x37);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x0D);
ST7735_WriteByte(0x0E);
ST7735_WriteByte(0x10);
ST7735_WriteCommand(0xE1);
ST7735_WriteByte(0x10);
ST7735_WriteByte(0x0E);
ST7735_WriteByte(0x03);
ST7735_WriteByte(0x03);
ST7735_WriteByte(0x0F);
ST7735_WriteByte(0x06);
ST7735_WriteByte(0x02);
ST7735_WriteByte(0x08);
ST7735_WriteByte(0x0A);
ST7735_WriteByte(0x13);
ST7735_WriteByte(0x26);
ST7735_WriteByte(0x36);
ST7735_WriteByte(0x00);
ST7735_WriteByte(0x0D);
ST7735_WriteByte(0x0E);
ST7735_WriteByte(0x10);
ST7735_WriteCommand(0x3A); //<2F><><EFBFBD>ظ<EFBFBD>ʽ
ST7735_WriteByte(0x06); //3 rgb444;5 rgb565 ;6 rgb666;
ST7735_WriteCommand(0x36); //<2F>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>ʸ<EFBFBD>ʽ
ST7735_WriteByte(0xC8);
ST7735_WriteCommand(0x29);
ST7735_FillScreen_666(BG_COLOR);//ui<75><69><EFBFBD><EFBFBD>ɫ
LCD_ON();
}
void ST7735_SetAddressWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
{
x0 += ST7735_XSTART;
y0 += ST7735_YSTART;
x1 += ST7735_XSTART;
y1 += ST7735_YSTART;
ST7735_WriteCommand(ST7735_CASET);
uint8_t data[] = {0x00,x0,0x00,x1};
ST7735_WriteData(data,4);
ST7735_WriteCommand(ST7735_RASET);
data[1] = y0;
data[3] = y1;
ST7735_WriteData(data,4);
}
void ST7735_DrawRectangle_666(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t color)
{
// uint16_t i,j;
// uint16_t len = width*height*3;
// uint16_t times = 0;
// uint16_t remainder = 0;
// times = len/4095;
// remainder = len%4095;
// ST7735_SetAddressWindow(x,y,x+width-1,y+height-1);
// ST7735_WriteCommand(ST7735_RAMWR);
// for(i = 0;i<times;i++)
// {
// for(j=0;j<4095;j++)
// {
// DMA_ram_buffer[j] = color >> (16-(j%3)*8)& 0xFF;
// }
// ST7735_WriteData((uint8_t *)DMA_ram_buffer,4095);
// }
// if(remainder)
// {
// for(j=0;j<remainder;j++)
// {
// DMA_ram_buffer[j] = color >> (16-(j%3)*8)& 0xFF;
// }
// ST7735_WriteData((uint8_t *)DMA_ram_buffer,4096);
// }
uint8_t buff[width * 3];
uint16_t i = 0;
for (i = 0; i < width; i++) {
buff[i * 3] = color >> 16& 0xFF;
buff[i * 3 + 1] = color >>8 & 0xFF;
buff[i * 3 + 2] = color & 0xFF;
}
ST7735_SetAddressWindow(x, y, x + width - 1, y + height - 1);
ST7735_WriteCommand(ST7735_RAMWR);
for (i = 0; i < height; i++) {
ST7735_WriteData(buff, 3* width);
}
}
void ST7735_DrawRectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)
{
uint8_t buff[width * 2];
uint16_t i = 0;
for (i = 0; i < width; i++) {
buff[i * 2] = color >> 8;
buff[i * 2 + 1] = color & 0xFF;
}
ST7735_SetAddressWindow(x, y, x + width - 1, y + height - 1);
ST7735_WriteCommand(ST7735_RAMWR);
// Write the color data
for (i = 0; i < height; i++) {
ST7735_WriteData(buff, sizeof(uint16_t) * width);
}
}
void ST7735_FillScreen(uint16_t color)
{
ST7735_DrawRectangle(0, 0, ST7735_WIDTH, ST7735_HEIGHT, color);
}
void ST7735_FillScreen_666(uint32_t color)
{
ST7735_DrawRectangle_666(0, 0, ST7735_WIDTH, ST7735_HEIGHT, color);
}
void ST7735_Clear_Part_Window(uint16_t x, uint16_t y, uint16_t width, uint16_t height,uint32_t color)
{
ST7735_DrawRectangle_666(x, y, width, height, color);
}
void ST7735_ImageBreath_down(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *image,uint16_t lenth,uint8_t k)
{
uint16_t i,j,time,remainder;
remainder = lenth%4096;
time = lenth/4096;
ST7735_SetAddressWindow(x, y, x + width - 1, y + height - 1);
ST7735_WriteCommand(ST7735_RAMWR);
for(i=0;i<time;i++)
{
for(j=0;j<4096;j++)
{
DMA_ram_buffer[j]=image[j+i*4096]*breath_down[k];
}
ST7735_WriteData((uint8_t *)DMA_ram_buffer,4096);
}
if(remainder)
{
for(j=0;j<remainder;j++)
{
DMA_ram_buffer[j]=image[j+i*4096]*breath_down[k];
}
ST7735_WriteData((uint8_t *)DMA_ram_buffer,remainder);
}
}
void ST7735_ImageBreath_up(uint16_t x, uint16_t y, uint16_t width, uint16_t height,uint16_t lenth, uint8_t num ,uint8_t k)
{
}
void ST7735_DrawImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height,uint16_t lenth,const uint8_t *image)
{
uint16_t i,j,time;
ST7735_SetAddressWindow(x, y, x + width - 1, y + height - 1);
ST7735_WriteCommand(ST7735_RAMWR);
time = lenth%4096?(lenth/4096 +1):(lenth/4096);
if(lenth<4096)
{
for(j=0;j<lenth;j++)
{
DMA_ram_buffer[j]=image[j];
}
ST7735_WriteData((uint8_t *)DMA_ram_buffer,lenth);
}
else
{
for(i=0;i<time;i++)
{
if(i<time-1)
{
for(j=0;j<4096;j++)
{
DMA_ram_buffer[j]=image[j+i*4096];
}
ST7735_WriteData((uint8_t *)DMA_ram_buffer,4096);
}
else
{
if(lenth%4096)
{
for(j=0;j<lenth%4096;j++)
{
DMA_ram_buffer[j]=image[j+i*4096];
}
ST7735_WriteData((uint8_t *)DMA_ram_buffer,lenth%4096);
}
else
{
for(j=0;j<4096;j++)
{
DMA_ram_buffer[j]=image[j+i*4096];
}
ST7735_WriteData((uint8_t *)DMA_ram_buffer,4096);
}
}
}
}
}
void ST7735_DrawFlashImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height,uint16_t lenth,uint8_t num)
{
uint16_t i,time,remainder,j,k;
remainder = lenth%4096;
time = lenth/4096;
k = 0;
ST7735_SetAddressWindow(x, y, x + width - 1, y + height - 1);
ST7735_WriteCommand(ST7735_RAMWR);
for(i=0;i<time;i++)
{
SPI1_FLASH_FastRead((uint32_t)num*64*1024 + i*4096,(uint8_t *)DMA_ram_buffer,4096);
ST7735_WriteData((uint8_t *)DMA_ram_buffer,4096);
// if(debug_flag)
// {
// for(j = 0;j<4096;j++)
// {
// printf("0X%02x,",DMA_ram_buffer[j]);
// ++k;
// if(k==16)
// {
// k=0;
// printf("\n");
// }
// }
// k = 0;
// }
}
if(remainder)
{
SPI1_FLASH_FastRead((uint32_t)num*64*1024 + i*4096,(uint8_t *)DMA_ram_buffer,remainder);
ST7735_WriteData((uint8_t *)DMA_ram_buffer,remainder);
// if(debug_flag)
// {
// for(j = 0;j<remainder;j++)
// {
//
// printf("0X%02x,",DMA_ram_buffer[j]);
// ++k;
// if(k==16)
// {
// k=0;
// printf("\n");
// }
//
// }
// }
}
// if(debug_flag)
// {
// debug_flag = 0;
// }
}
void ST7735_Draw_BatLevel(uint16_t x, uint16_t y)
{
static uint8_t buff[15] = {0X44,0X8C,0XE4, 0X5C,0XA0,0XF4, 0X44,0X8C,0XE0, 0X3C,0X84,0XDC, 0X34,0X80,0XDC};
ST7735_SetAddressWindow(x, y, x , y + 5 - 1);
ST7735_WriteCommand(ST7735_RAMWR);
ST7735_WriteData(buff,15);
}
void animation_start_tow(void)
{
}
void animation_start(void)
{
static u8 pic_rank = 0;
static u8 first_flag = 0;
if(logo1_flag == 0 )
{
ST7735_FillScreen_666(BG_COLOR);
ST7735_DrawFlashImage(11,5,58,13,2262,1);
ST7735_DrawFlashImage(26,30,27,113,9153,3);
logo1_flag =1 ;
first_flag =0;
pic_clock = 0;
}
if(pic_clock >=80)
{
pic_clock = 0;
////////////////////
switch(pic_rank)
{
case 12:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 11:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 10:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 9:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 8:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 7:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 6:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 5:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 4:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 3:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 0:
first_flag ++;
if(first_flag==10)
{
first_flag = 0;
pic_rank = 3;
}
break;
case 13:
pic_rank = 0;
restart = 0;
break;
default:
break;
}
////////////////////<2F><><EFBFBD><EFBFBD>+Сͼ<D0A1>ķ<EFBFBD><C4B7><EFBFBD>
/*
switch(pic_rank)
{
case 12:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(35,64,10,45,1350,pic_rank);
pic_rank++;
break;
case 11:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(34,61,12,51,1836,pic_rank);
pic_rank++;
break;
case 10:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(33,58,14,58,2436,pic_rank);
pic_rank++;
break;
case 9:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(32,54,15,65,2925,pic_rank);
pic_rank++;
break;
case 8:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(31,51,17,72,3672,pic_rank);
pic_rank++;
break;
case 7:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(31,47,18,79,4266,pic_rank);
pic_rank++;
break;
case 6:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(30,44,20,85,5100,pic_rank);
pic_rank++;
break;
case 5:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(29,41,22,92,6072,pic_rank);
pic_rank++;
break;
case 4:
ST7735_Clear_Part_Window(26,30,27,113,BG_COLOR);
ST7735_DrawFlashImage(28,37,23,99,6831,pic_rank);
pic_rank++;
break;
case 3:
ST7735_DrawFlashImage(26,30,27,113,9153,pic_rank);
pic_rank++;
break;
case 0:
first_flag ++;
if(first_flag==10)
{
first_flag = 0;
pic_rank = 3;
}
break;
case 13:
pic_rank = 0;
restart = 0;
break;
default:
break;
}
*/
}
}
void animation_show_v(void)
{
static u8 last_battery_level;
static u8 x_start =0;
static u8 y_start =0;
static u8 time_count = 0;
static bool charge_start_flag = 0;
static bool flicker_flag = 0;
u8 i;
if(logo2_flag == 0 )
{
restart = 0;
logo2_flag =1 ;
flicker_flag = 0;
pic_clock = 0;
time_count = 0;
charge_start_flag = 0;
last_battery_level = g_work.m_conditon.m_conditon.V_conditon;
ST7735_FillScreen_666(BG_COLOR);
ST7735_DrawFlashImage(11,5,58,13,2262,1);
for(i = 0;i<16;i++)
{
ST7735_DrawFlashImage(10,20+i*8,60,5,900,16);
}
if(last_battery_level > 0 )
{
for(i = 1;i<=last_battery_level;i++)
{
ST7735_DrawFlashImage(10,12+i*8,60,5,900,15);
}
if(is_charging)//<2F><><EFBFBD><EFBFBD><E7B6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
{
ST7735_DrawFlashImage(10,12+(i-1)*8,60,5,900,13);
charge_start_flag = 1;
}
}
else
{
if(is_charging)//<2F><><EFBFBD><EFBFBD><E7B6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
{
charge_start_flag = 1;
}
}
x_start = 69;
y_start = 12+(i-1)*8;
}
if(is_charging)
{
if(charge_start_flag==0)
{
charge_start_flag = 1;
logo2_flag = 0;
return ;
}
if(last_battery_level == 0)
{
return ;
}
if(pic_clock>=33 && time_count<60)
{
ST7735_Draw_BatLevel(x_start-time_count,y_start);
time_count++;
pic_clock = 0;
}
if(time_count>=60)
{
ST7735_DrawFlashImage(10,y_start,60,5,900,13);
time_count = 0;
if(last_battery_level==(g_work.m_conditon.m_conditon.V_conditon+1))
{
logo2_flag = 0;
}
}
}
else
{
if(charge_start_flag==1)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
logo2_flag = 0;
charge_start_flag = 0;
return ;
}
if(last_battery_level<16 && last_battery_level>=13)
{
if(pic_clock >= 400)
{
if(flicker_flag==0)
{
for(i = last_battery_level;i<16;i++)
{
ST7735_DrawFlashImage(10,20+i*8,60,5,900,15);
}
flicker_flag = 1;
}
else
{
for(i = last_battery_level;i<16;i++)
{
ST7735_DrawFlashImage(10,20+i*8,60,5,900,16);
}
flicker_flag = 0;
}
pic_clock = 0;
}
}
else
{
pic_clock = 0;
flicker_flag = 0;
}
}
}
void animation_temp_on(void)
{
static u8 up_down_flag = 0;
static u8 up_down_time = 0;
if(logo3_flag == 0 )
{
restart = 0;
ST7735_FillScreen_666(BG_COLOR);
ST7735_DrawFlashImage(11,5,58,13,2262,1);
ST7735_DrawFlashImage(33,22,12,123,4428,17);
logo3_flag =1 ;
g_work.m_work_flag._beep_flag = 1;
pic_clock = 0;
}
if(pic_clock>=50)
{
if(up_down_flag == 0)
{
if(up_down_time<10)
{
#ifdef package_3
ST7735_ImageBreath_down(33,22,12,123,(const unsigned char *)gImage_17,4428,up_down_time);
#endif
up_down_time++;
}
if(up_down_time == 10)
{
up_down_time = 0;
up_down_flag = 1;
}
}
else
{
if(up_down_time<10)
{
#ifdef package_3
ST7735_ImageBreath_down(33,22,12,123,(const unsigned char *)gImage_17,4428,(9-up_down_time));
#endif
up_down_time++;
}
if(up_down_time == 10)
{
up_down_time = 0;
up_down_flag = 0;
}
}
pic_clock = 0;
}
}
void animation_smoking(void)
{
static u8 times = 0;
if(logo4_flag == 0 )
{
restart = 0;
ST7735_FillScreen_666(BG_COLOR);
ST7735_DrawFlashImage(11,5,58,13,2262,1);
ST7735_DrawFlashImage(33,22,12,123,4428,17);
ST7735_DrawFlashImage(33,141,12,5,180,19);
logo4_flag =1 ;
times = 0;
pic_clock = 0;
g_work.m_work_flag._beep_flag = 2;
}
if(pic_clock >= (g_work.m_set_other_hot.set_all_time-g_work.m_set_other_hot.set_order_time-10)*1000/78)
{
if(times<=78)
{
ST7735_DrawFlashImage(33,141-times,12,5,180,19);
times++;
}
if(times>78)
{
times = 0;
}
pic_clock = 0;
}
}
void animation_heat_over(void)
{
static u8 up_down_flag = 0;
static u8 up_down_time = 0;
static bool over_flag = 0;
if(logo5_flag == 0 )
{
restart = 0;
ST7735_DrawFlashImage(11,5,58,13,2262,1);
ST7735_DrawFlashImage(33,22,12,49,1764,18);
pic_clock = 0;
logo5_flag =1 ;
g_work.m_work_flag._beep_flag = 2;
over_flag = 0;
}
if(keep_temp_time)
{
if(pic_clock>=50)
{
if(up_down_flag == 0)
{
if(up_down_time<10)
{
#ifdef package_3
ST7735_ImageBreath_down(33,22,12,49,(const unsigned char *)gImage_18,1764,up_down_time);
#endif
up_down_time++;
}
if(up_down_time == 10)
{
up_down_time = 0;
up_down_flag = 1;
}
}
else
{
if(up_down_time<50)
{
#ifdef package_3
ST7735_ImageBreath_down(33,22,12,49,(const unsigned char *)gImage_18,1764,(9-up_down_time));
#endif
up_down_time++;
}
if(up_down_time == 10)
{
up_down_time = 0;
up_down_flag = 0;
}
}
pic_clock = 0;
}
}
else
{
if(over_flag==0)
{
ST7735_DrawFlashImage(33,22,12,49,1764,20);
over_flag =1;
}
}
}