Commit fb7e1c2b authored by 何锐's avatar 何锐

feat:增加进入OTA界面

parent 8d358d96
...@@ -71,8 +71,8 @@ void Function_Check_Ctrl(uint32_t cmd); ...@@ -71,8 +71,8 @@ void Function_Check_Ctrl(uint32_t cmd);
void MENU_CHECK_STEP_ADD(void) void MENU_CHECK_STEP_ADD(void)
{ {
if(jiaoyan == 1) // if(jiaoyan == 1)
{ // {
MENU_CHECK_STEP++; MENU_CHECK_STEP++;
if(MENU_CHECK_STEP > 14) if(MENU_CHECK_STEP > 14)
...@@ -87,7 +87,7 @@ void MENU_CHECK_STEP_ADD(void) ...@@ -87,7 +87,7 @@ void MENU_CHECK_STEP_ADD(void)
{ {
MENU_CHECK_STEP = 1; MENU_CHECK_STEP = 1;
} }
} // }
} }
void MENU_CHECK_STEP_SUB(void) void MENU_CHECK_STEP_SUB(void)
...@@ -439,14 +439,89 @@ uint8_t yibiaoshuju[34]; ...@@ -439,14 +439,89 @@ uint8_t yibiaoshuju[34];
// Buzzer_Warning(); // Buzzer_Warning();
break; break;
// case 4: case 4: //AP模式
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 0;
LeftturnSignal = 1;
Bluetoothlight = 0;
Positionlight = 1;
highbeam = 0;
Lowbeam = 0;
GUI_Display_Version_Code_Service(15, 120, "OTA ", Letter_Num_11, PCodeText_Space_size);
GUI_Display_Version_Code_Service(15, 150, "Name is ", Letter_Num_11, PCodeText_Space_size);
blnamedisplay[0] = name2 / 16;
blnamedisplay[1] = name2 % 16;
blnamedisplay[2] = name1 / 16;
blnamedisplay[3] = name1 % 16;
// break; for(int i = 0; i<4; i++)
{
if(blnamedisplay[i] >= 10)
{
blnamedisplay[i] += 55;
}
}
blenamedisplay[0] = blnamedisplay[0];
blenamedisplay[1] = blnamedisplay[1];
blenamedisplay[2] = blnamedisplay[2];
blenamedisplay[3] = blnamedisplay[3];
blenamedisplay[4] = 0xFF;
if(blnamedisplay[0]+blnamedisplay[1]+blnamedisplay[2]+blnamedisplay[3] != 0)
{
General_Number_Disp(blenamedisplay, 90, 154);
}
break;
case 5: //P2P模式
if(Auto_ONOFF == 0)
{
LINE_OUT_NEG_01 = 1;
LINE_OUT_NEG_04 = 1;
LINE_OUT_NEG_02 = 1;
LINE_OUT_NEG_03 = 1;
}
RightturnSignal = 1;
LeftturnSignal = 0;
Bluetoothlight = 0;
Positionlight = 1;
highbeam = 0;
Lowbeam = 0;
GUI_Display_Version_Code_Service(15, 120, "OTA ", Letter_Num_11, PCodeText_Space_size);
GUI_Display_Version_Code_Service(15, 150, "Name is ", Letter_Num_11, PCodeText_Space_size);
blnamedisplay[0] = name2 / 16;
blnamedisplay[1] = name2 % 16;
blnamedisplay[2] = name1 / 16;
blnamedisplay[3] = name1 % 16;
for(int i = 0; i<4; i++)
{
if(blnamedisplay[i] >= 10)
{
blnamedisplay[i] += 55;
}
}
blenamedisplay[0] = blnamedisplay[0];
blenamedisplay[1] = blnamedisplay[1];
blenamedisplay[2] = blnamedisplay[2];
blenamedisplay[3] = blnamedisplay[3];
blenamedisplay[4] = 0xFF;
if(blnamedisplay[0]+blnamedisplay[1]+blnamedisplay[2]+blnamedisplay[3] != 0)
{
General_Number_Disp(blenamedisplay, 90, 154);
}
break;
default: default:
// POWER_CTRL_KL30 = 0u; // POWER_CTRL_KL30 = 0u;
......
...@@ -3884,7 +3884,7 @@ void Display_TFT_Clear(void) ...@@ -3884,7 +3884,7 @@ void Display_TFT_Clear(void)
TFT_LCD_Draw_Box(0, 0, 239, 319, TFT_LCD_FILL_FULL, TFT_LCD_TYPE_CLR); TFT_LCD_Draw_Box(0, 0, 239, 319, TFT_LCD_FILL_FULL, TFT_LCD_TYPE_CLR);
} }
void Display_Add(void) void Display_Add( void)
{ {
Display_Menu_Type++; Display_Menu_Type++;
} }
...@@ -3893,12 +3893,22 @@ void Display_Sub(void) ...@@ -3893,12 +3893,22 @@ void Display_Sub(void)
if ( Display_Menu_Type != 0 ) if ( Display_Menu_Type != 0 )
Display_Menu_Type--; Display_Menu_Type--;
} }
uint8_t OTAMode;
uint8_t OTAModeBegin = 0;
uint32_t Get_Display_Type(void) uint32_t Get_Display_Type(void)
{ {
if(BlueTooth == 1) if(BlueTooth == 1)
{ {
return 3; return 3;
} }
else if(OTAMode == 1)
{
return 4;
}
else if(OTAMode == 2)
{
return 5;
}
else else
{ {
if(zhenduanflag == Data_Mode_Dot) if(zhenduanflag == Data_Mode_Dot)
...@@ -4865,22 +4875,22 @@ void Display_Version_Info(uint32_t ON_OFF) ...@@ -4865,22 +4875,22 @@ void Display_Version_Info(uint32_t ON_OFF)
} }
TFT_LCD_Draw_Bmp(3, 90+25+25+30+30+30+5, ( uint8_t * )gImage_gImage_LEDwaif1X6_Y16 ); //硬线指示灯外发对比 TFT_LCD_Draw_Bmp(3, 90+25+25+30+30+30+5, ( uint8_t * )gImage_gImage_LEDwaif1X6_Y16 ); //硬线指示灯外发对比
TFT_LCD_Draw_Bmp(3, 90+25+25+30+25+30+30+5, ( uint8_t * )gImage_gImage_SV1X6_Y16 ); //软件版本号对比 // TFT_LCD_Draw_Bmp(3, 90+25+25+30+25+30+30+5, ( uint8_t * )gImage_gImage_SV1X6_Y16 ); //软件版本号对比
// if((R485_ID4Dh.Sig.ESP322 != 0) && ( R485_ID4Dh.Sig.G0312 != 0)) // if((R485_ID4Dh.Sig.ESP322 != 0) && ( R485_ID4Dh.Sig.G0312 != 0))
// { // {
if((esp32houmian == 32) && (guominhoumian == 33) && (wifihoumian == 35)) // if((esp32houmian == 32) && (guominhoumian == 33) && (wifihoumian == 35))
{ // {
TFT_LCD_Draw_Bmp(200, 90+25+25+30+25+30+30, ( uint8_t * )gImage_dui ); //软件版本号对比 对
jiaoyan = 1;
}
else
{
TFT_LCD_Draw_Bmp(200, 90+25+25+30+25+30+30, ( uint8_t * )gImage_cuo ); //软件版本号对比 错
jiaoyan = 0;
//正在调试取消版本号对比 想要取消版本号对比将上方注释掉并解开下方注释即可
// TFT_LCD_Draw_Bmp(200, 90+25+25+30+25+30+30, ( uint8_t * )gImage_dui ); //软件版本号对比 对 // TFT_LCD_Draw_Bmp(200, 90+25+25+30+25+30+30, ( uint8_t * )gImage_dui ); //软件版本号对比 对
// firstpowerflag = 2; // jiaoyan = 1;
} // }
// else
// {
// TFT_LCD_Draw_Bmp(200, 90+25+25+30+25+30+30, ( uint8_t * )gImage_cuo ); //软件版本号对比 错
// jiaoyan = 0;
// //正在调试取消版本号对比 想要取消版本号对比将上方注释掉并解开下方注释即可
// // TFT_LCD_Draw_Bmp(200, 90+25+25+30+25+30+30, ( uint8_t * )gImage_dui ); //软件版本号对比 对
// // firstpowerflag = 2;
// }
// } // }
// else // else
// { // {
...@@ -4903,7 +4913,7 @@ void Display_Version_Info(uint32_t ON_OFF) ...@@ -4903,7 +4913,7 @@ void Display_Version_Info(uint32_t ON_OFF)
// TFT_LCD_Draw_Bmp(3, 160, ( uint8_t * )gImage_Alarm_12_WordX6_Y165); //24脚输出占空比 // TFT_LCD_Draw_Bmp(3, 160, ( uint8_t * )gImage_Alarm_12_WordX6_Y165); //24脚输出占空比
// TFT_LCD_Draw_Bmp(210, 160, ( uint8_t * )gImage_Alarm_13_ImageX222_Y166); //% // TFT_LCD_Draw_Bmp(210, 160, ( uint8_t * )gImage_Alarm_13_ImageX222_Y166); //%
TFT_LCD_Draw_Bmp(3, 290, ( uint8_t * )gImage_gImage_checkVX6_Y165 ); //检测台版本号 TFT_LCD_Draw_Bmp(3, 290, ( uint8_t * )gImage_gImage_checkVX6_Y165 ); //检测台版本号
uint8_t mbuff [7] = {2,5,1,2,0,3,0xff}; uint8_t mbuff [7] = {2,5,1,2,0,9,0xff};
General_Number_Disp(mbuff, 160, 290); General_Number_Disp(mbuff, 160, 290);
} }
......
...@@ -49,6 +49,8 @@ enum DisplayFont ...@@ -49,6 +49,8 @@ enum DisplayFont
extern unsigned int Display_Menu_Type; extern unsigned int Display_Menu_Type;
extern uint32_t odo_val_Back ; extern uint32_t odo_val_Back ;
extern uint8_t OTAMode;
extern uint8_t OTAModeBegin;
void GeneralInfoDisp(unsigned char *p, unsigned short x, unsigned short y); void GeneralInfoDisp(unsigned char *p, unsigned short x, unsigned short y);
void Display_Title_Info(void); void Display_Title_Info(void);
void Display_Version_Info(uint32_t ON_OFF); void Display_Version_Info(uint32_t ON_OFF);
......
...@@ -176,8 +176,8 @@ void Key_Init(void) ...@@ -176,8 +176,8 @@ void Key_Init(void)
} }
stKeyParameter.u16KeyLoosenTime = 0U; stKeyParameter.u16KeyLoosenTime = 0U;
stKeyParameter.u16KeyShortPressTime = 20U; stKeyParameter.u16KeyShortPressTime = 20U;
stKeyParameter.u16KeyLongPressTime = 3000U; stKeyParameter.u16KeyLongPressTime = 2000U;
stKeyParameter.u32KeySuperLongPressTime = 90000U; stKeyParameter.u32KeySuperLongPressTime = 50000U;
} }
/*����Ӳ�߰������ԣ��ж϶̰���ʱ�����*/ /*����Ӳ�߰������ԣ��ж϶̰���ʱ�����*/
Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time) Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time)
......
...@@ -83,6 +83,7 @@ extern void confirmkeyserve(void); ...@@ -83,6 +83,7 @@ extern void confirmkeyserve(void);
extern void upkeyserve(void); extern void upkeyserve(void);
extern void downkeyserve(void); extern void downkeyserve(void);
extern void PasswordUnlock(void); extern void PasswordUnlock(void);
extern void OpenOTASercice(void);
extern Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time); extern Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time);
extern Key_Set_en_t Key_Parameter_Set_Long_Press_Time(uint16_t u16Time); extern Key_Set_en_t Key_Parameter_Set_Long_Press_Time(uint16_t u16Time);
extern Key_Set_en_t Key_Parameter_Set_Super_Long_Press_Time(uint32_t u32Time); extern Key_Set_en_t Key_Parameter_Set_Super_Long_Press_Time(uint32_t u32Time);
......
...@@ -124,14 +124,17 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent) ...@@ -124,14 +124,17 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
{ {
} }
} }
void Key_Operation_SW9(Key_Event_en_t enKeyEvent) //下移位 void Key_Operation_SW9(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) //下移位
{ {
downkeyflag = 1; downkeyflag = 1;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) //P2P模式
{ {
OTAMode = 2;
name1 = (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
} }
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{ {
...@@ -197,15 +200,17 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent) ...@@ -197,15 +200,17 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent)
{ {
} }
} }
void Key_Operation_SW1(Key_Event_en_t enKeyEvent) //上移位 void Key_Operation_SW1(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) //上移位
{ {
upkeyflag = 1; upkeyflag = 1;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) //AP模式
{ {
OTAMode = 1;
name1 = (devicename) & 0xFF;
name2 = (devicename >> 8) & 0xFF;
} }
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{ {
...@@ -355,6 +360,39 @@ void PasswordUnlock(void) ...@@ -355,6 +360,39 @@ void PasswordUnlock(void)
KeyStep = 0; KeyStep = 0;
} }
} }
uint8_t OpenOTATime;
void OpenOTASercice(void)
{
if (((OTAMode != 1) && (OTAMode != 2)) || (OTAModeBegin != 1))
{
return;
}
if (OpenOTATime > 240)
{
OTAMode = 0;
OpenOTATime = 0;
OTAModeBegin = 0;
OTAModeBeginTime = 0;
return;
}
OpenOTATime++;
if (OpenOTATime <= 120)
{
Press_to_up = ((OpenOTATime / 10) % 2) == 0 ? 1 : 0;
Press_to_down = 0;
}
else
{
uint16_t relativeTime = OpenOTATime - 120;
Press_to_down = ((relativeTime / 10) % 2) == 0 ? 1 : 0;
Press_to_up = 0;
}
}
/*-------------------------------------------------*/ /*-------------------------------------------------*/
Key_Real_Status_en_t Key_Real_sw5(void) Key_Real_Status_en_t Key_Real_sw5(void)
{ {
......
...@@ -59,6 +59,7 @@ void Sys_Run_Mode_2ms_Tasks_Group(void) ...@@ -59,6 +59,7 @@ void Sys_Run_Mode_2ms_Tasks_Group(void)
{ {
RTE_ADC_Services( ); RTE_ADC_Services( );
Get_static_Current(); Get_static_Current();
Bluetoothname();
} }
/*============================================================================== /*==============================================================================
...@@ -75,8 +76,8 @@ void Sys_Run_Mode_5ms_Tasks_Group(void) ...@@ -75,8 +76,8 @@ void Sys_Run_Mode_5ms_Tasks_Group(void)
void Sys_Run_Mode_10ms_Tasks_Group(void) void Sys_Run_Mode_10ms_Tasks_Group(void)
{ {
Key_Service(); Key_Service();
Bluetoothname(); OpenOTASercice();
if(clearOdoFlag == 0) if((clearOdoFlag == 0) && (OTAMode != 1) && (OTAMode != 2))
{ {
confirmkeyserve(); confirmkeyserve();
upkeyserve(); upkeyserve();
...@@ -112,9 +113,21 @@ uint8_t flashtime = 0; ...@@ -112,9 +113,21 @@ uint8_t flashtime = 0;
uint8_t showtime = 0; uint8_t showtime = 0;
uint8_t bleuarttime = 0; uint8_t bleuarttime = 0;
uint8_t querendelay = 0; uint8_t querendelay = 0;
uint8_t OTAModeBeginTime;
void Sys_Run_Mode_100ms_Tasks_Group(void) void Sys_Run_Mode_100ms_Tasks_Group(void)
{ {
if((OTAMode == 1) || (OTAMode == 2))
{
if(OTAModeBeginTime <= 150)
{
OTAModeBeginTime++;
}
else
{
OTAModeBegin = 1;
}
}
ProcessBluetoothDeviceNameWithLock(); ProcessBluetoothDeviceNameWithLock();
AutoClearCounterAfterAllLit(); AutoClearCounterAfterAllLit();
TimeDelay_3s(); TimeDelay_3s();
......
...@@ -8,6 +8,7 @@ extern uint32_t devicename; ...@@ -8,6 +8,7 @@ extern uint32_t devicename;
extern uint8_t upkeyflag; extern uint8_t upkeyflag;
extern uint8_t downkeyflag; extern uint8_t downkeyflag;
extern uint8_t Confirmkeyflag; extern uint8_t Confirmkeyflag;
extern uint8_t OTAModeBeginTime;
// extern uint8_t Openble[20]; // extern uint8_t Openble[20];
void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void); void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void);
void Sys_Run_Mode_2ms_Tasks_Group(void); void Sys_Run_Mode_2ms_Tasks_Group(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment