/************************** Copyright (c) **********************************
|
** FUZHOU FUGUANG ELECTRONICS Co.,LTD.
|
** ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
|
** http://www.fuguang.com
|
**
|
**-------------- File Info -------------------------------------------------
|
** File name: FileManage.c
|
** Last modified Date: 2008-11-16
|
** Last Version: 1.0
|
** Descriptions: Tested datas management functions
|
**
|
**--------------------------------------------------------------------------
|
** Created by: mxpopstar
|
** Created date: 2008-11-16
|
** Version: 1.0
|
** Descriptions: The original version
|
**
|
**--------------------------------------------------------------------------
|
** Modified by: mxpopstar
|
** Modified date: 2008-11-20
|
** Version:
|
** Descriptions: Tested datas management functions
|
**
|
***************************************************************************/
|
//
|
#include "Define.h"
|
#include "Delay.h"
|
#include "FileManage.h"
|
#include <avr/eeprom.h>
|
#include <avr/wdt.h>
|
#include "SST25VF_Driver.h"
|
#include "AD7843_Driver.h"
|
#include "NRF905_Driver.h"
|
#include "M64USART_Driver.h"
|
#include "MainMenu.h"
|
#include "TFT_Driver.h"
|
#include "DS1302_Driver.h"
|
#include "MessageBox.h"
|
#include "USBModule_Driver.h"
|
#include "WorkingPage.h"
|
#include "ChargePage.h"
|
#include "SYSSetPage.h"
|
#include "CRC16.h"
|
#include "CH376inc.h"
|
#include "CH376FILE_SYS.H"
|
#include "USBModule_Driver.h"
|
#include "STM32U.h"
|
#include "SAMD21U.h"
|
|
|
extern FBO_Data GB_FBO_Data;
|
extern SYS_State GB_SYS_State;
|
extern File_Inf GB_TestDataInf;
|
extern volatile unsigned int GB_TestingParm[13];
|
extern unsigned char countbak;
|
|
#if(SoftLanguage == CN)
|
const prog_uchar FMTextItem[3][5] =
|
{
|
{36, 37, 38, 39, 59},//Êý¾Ý¹ÜÀí:
|
{57, 58, 36, 37, 59},//²âÊÔÊý¾Ý:
|
{119,41,155, 63, 59},//ÄÚ´æÓàÁ¿:
|
};
|
//
|
|
const prog_uchar FMClearListItem[1][16] =
|
{
|
" "
|
};
|
//
|
|
const prog_uchar FMDataInfContent[2][4] =
|
{
|
{54, 56, 36, 37},//·ÅµçÊý¾Ý
|
{55, 56, 36, 37},//³äµçÊý¾Ý
|
};
|
//
|
|
const prog_uchar FMStoptypeContent[9][4] =
|
{
|
{117, 118, 80, 81}, //ÊÖ¶¯Í£Ö¹
|
{ 64, 65, 108, 101}, //ʱ¼äµ½
|
{ 62, 63, 108, 101}, //ÈÝÁ¿µ½
|
{ 70, 71, 48, 72}, //µ¥ÌåÏÂÏÞ
|
{ 68, 69, 48, 72}, //×é¶ËÏÂÏÞ
|
{ 80, 56, 101, 101}, //Í£µç
|
{119, 41, 121, 122}, //ÄÚ´æ²»×ã
|
{193, 194, 168, 169}, //ζÈÒì³£
|
{122, 123, 101, 101}, //δ֪
|
};
|
//
|
|
const prog_uchar FMDataInfText[11][5] =
|
{
|
{36, 37, 102, 103, 59},//Êý¾ÝÐÅÏ¢
|
{36, 37, 104, 105, 59},//Êý¾ÝÀàÐÍ
|
{60, 61, 62, 63, 59},//±ê³ÆÈÝÁ¿
|
{57, 58, 56, 82, 59},//²âÊÔµçÁ÷
|
{57, 58, 62, 63, 59},//²âÊÔÈÝÁ¿
|
{57, 58, 64, 116, 59},//²âÊÔʱ³¤
|
{70, 71, 48, 72, 59},//µ¥ÌåÏÂÏÞ
|
{68, 69, 48, 72, 59},//×é¶ËÏÂÏÞ
|
{226,68, 70, 71, 59},//ÿ×éµ¥Ìå
|
{57, 58, 68, 36, 59},//²âÊÔ×éÊý
|
{80, 81, 106, 107, 59},//Í£Ö¹ÔÒò
|
};
|
//
|
|
const prog_uchar FMDataInfSubText[2][1] =
|
{
|
{68}, //×é
|
{227}, //¸ö
|
};
|
//
|
|
const prog_uchar FMButtonItem[7][5] =
|
{
|
{112,101,101,101,101}, //ÉÏÉý¼ýÍ·
|
{113,101,101,101,101}, //Ͻµ¼ýÍ·
|
{ 30, 28, 11, 44, 41}, //USBת´æ
|
{ 2, 3, 2, 44, 41}, //232ת´æ
|
{ 52, 53,101,101,101}, //Í˳ö
|
{ 42, 43,101,101,101}, //ɾ³ý
|
{109, 42,101,101,101}, //ȫɾ
|
};
|
//
|
|
const prog_uchar FMAlarmText[2][11] =
|
{
|
{45,46,125,42,43,130,36,37,127,128,101},//È·¶¨ÒªÉ¾³ý¸ÃÊý¾ÝÂð?
|
{45,46,125,42,43,109,131,36,37,127,128},//È·¶¨ÒªÉ¾³ýÈ«²¿Êý¾ÝÂð?
|
};
|
//
|
|
const prog_uchar USBErrorText[3][8] =
|
{
|
{30, 139, 120, 41, 83, 137,101,101},//UÅ̲»´æÔÚ£¡
|
{30, 139, 140, 141,137,101,101,101},//UÅ̹ÊÕÏ£¡
|
{27, 28, 2, 3, 2, 140,141,137},//RS232Ïß·¹ÊÕÏ!
|
};
|
//
|
#else
|
const prog_uchar FMTextItem[3][12] =
|
{
|
{96,59,73,73,87,64}, //Êý¾Ý¹ÜÀí:6
|
{80,59,69,71,0,63,59,73,73,87,81}, //²âÊÔÊý¾Ý:11
|
{108,59,72,91,78,88,26}, //ÄÚ´æÓàÁ¿:7
|
};
|
//
|
|
const prog_uchar FMClearListItem[1][16] =
|
{
|
{0,0,0,0,0,0,0,0,0,0,0,0,0,0},
|
};
|
//
|
|
const prog_uchar FMDataInfContent[2][12] =
|
{
|
{109,59,67,76,91,63}, //"·Åµç²âÊÔ"6
|
{100,59,76,91,63,0}, //"³äµç¼à²â"5
|
};
|
//
|
|
const prog_uchar FMStoptypeContent[9][12] =
|
{
|
{109,79,83,14,77,78,74,75,0,0}, //"ManualStop", ÊÖ¶¯Í£Ö¹10
|
// {94,76,64,72,91,0,0,0,0,0}, //"TimeUp "ʱ¼äµ½
|
// {108,74,71,73,14,65,73,70,0,0}, //"CapOver "ÈÝÁ¿µ½
|
{107,62,76,14,61,76,64,72,64,73,68,1},//·Åµçʱ¼äµ½//12
|
{107,62,76,14,65,72,70,74,77,78,68,1},//ÈÝÁ¿µ½//12
|
{106,68,67,70,14,53,89,71,0,0}, //"BattLow "µ¥ÌåÏÂÏÞ
|
{106,68,67,70,14,53,62,76,0,0}, //"GroupLow "×é¶ËÏÂÏÞ
|
{106,64,78,110,64,78,68,0,0,0}, //"PowerOff "Í£µç
|
{106,64,78,108,59,72,91,78,68,0}, //"MemOver "ÄÚ´æ²»×ã
|
{111,64,72,75,13,76,59,0,0,0}, //"TempOver "ζÈÒì³£
|
{106,64,68,67,61,64,77,78,73,74}, //"Unknown "δ֪
|
};
|
//
|
|
const prog_uchar FMDataInfText[11][14] =
|
{
|
{0}, //Êý¾ÝÐÅÏ¢
|
{109,64,66,68,72,26}, //Êý¾ÝÀàÐÍ6
|
{106,74,72,68,73,14,65,72,70,14,26}, //±ê³ÆÈÝÁ¿11
|
{111,74,70,26}, //²âÊÔµçÁ÷4
|
{98,72,70,74,77,78,88,26}, //²âÊÔÈÝÁ¿8
|
{96,71,68,78,64,71,88,73,74,77,78,88,26},//²âÊÔʱ³¤13
|
{107,62,76,14,73,59,75,76,14,89,71,26}, //µ¥ÌåÏÂÏÞ12
|
{107,62,76,14,73,59,75,76,14,62,76,26}, //×é¶ËÏÂÏÞ12
|
{103,74,71,14,89,71,26}, //ÿ×éµ¥Ìå7
|
{103,74,71,14,62,76,26}, //²âÊÔ×éÊý7
|
{108,76,68,83,68,73,59,26}, //Í£Ö¹ÔÒò8
|
};
|
//
|
|
const prog_uchar FMDataInfSubText[3][2] =
|
{
|
{62,76}, //×é2
|
{89,71}, //¸ö#2
|
{116},
|
};
|
//
|
|
const prog_uchar FMButtonItem[7][11] =
|
{
|
{94,61,64,76,81}, //ÉÏÉý¼ýÍ·5
|
{94,73,68,67}, //Ͻµ¼ýÍ·4
|
{53,51,34}, //USBת´æ3
|
{50,51,18,19,18}, //232ת´æ
|
{94,87,81,74,63}, //Í˳ö5
|
{112,63,59,71,68,78,88}, //ɾ³ý 7
|
{107,83,68,77,78,68,78,88}, //ȫɾ8
|
};
|
//
|
|
const prog_uchar FMAlarmText[3][32] =
|
{
|
{112,63,59,71,68,78,88,0,63,59,73,73,87,64,31},
|
//"Will you delete the data?",È·¶¨ÒªÉ¾³ý¸ÃÊý¾ÝÂð?15
|
{112,63,59,71,68,78,88,0,61,77,64,0,63,59,73,73,87,64,31},
|
//"Will you delete all the data?",È·¶¨ÒªÉ¾³ýÈ«²¿Êý¾ÝÂð?19
|
{74,75,76,64,63,64,71,91,90,85,68,69,31},
|
};
|
//
|
|
const prog_uchar USBErrorText[3][20] =
|
{
|
{53,51,34,13,63,68,77,70,0,73,64,0,73,59,69,63,64,73,1},
|
//"No U disk exist!",UÅ̲»´æÔÚ£¡19
|
{107,84,68,60,70,59,0,53,51,34,13,63,68,77,70,59,1},
|
//"U disk error!",UÅ̹ÊÕÏ£¡17
|
{107,84,68,60,70,59,0,50,51,18,19,18,1},
|
//"RS232 error!",RS232Ïß·¹ÊÕÏ!13
|
};
|
//
|
#endif
|
//
|
const prog_uchar FLAG[2][10]=
|
{
|
"CH6",
|
"NUT",
|
};
|
|
|
static unsigned char FirstUseTag[8] __attribute__((section(".eeprom"))) =
|
{
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
};// -------------- ÓÃÀ´¼ì²âÊDz»ÊǵÚÒ»´ÎÓôËÒDZí -----------------
|
//
|
|
volatile static unsigned char FileList[SSTBlockSum] = {0};
|
|
volatile static STRUCTFILE File;
|
|
static unsigned char (*FMParentPage)(void) = DSPFileManagePage;
|
static unsigned char (*FMChildPage)(void) = DSPFileManagePage;
|
static unsigned char FMPItemIndex = 0;
|
static unsigned char FMPListItemCount = 0;
|
static unsigned char DSPListStartIndex = 0;
|
|
unsigned char DSPFileManagePage(void)
|
{
|
// unsigned char n;
|
|
DisableCustomInput();
|
if(FMParentPage == DSPFileManagePage)
|
{
|
FMParentPage = GB_SYS_State.CurrentPage;//±£´æ¸¸Ò³ÃæÖ¸Õë
|
}
|
GB_SYS_State.CurrentPage = DSPFileManagePage;
|
FMChildPage = DSPFileManagePage;
|
GB_SYS_State.GetInput = GetFileManageButtonDown;
|
|
DSP16x24Str(FMTextItem[0], 6, 16, 24, 18, blue, yellow); //Êý¾Ý¹ÜÀí
|
#if(SoftLanguage == CN)
|
DrawLine(24, 42, 12, 0, blue, white, linebold, 2);
|
#else
|
DrawLine(24, 42, 12, 0, blue, white, linebold, 2);
|
#endif
|
|
DSP16x24Str(FMTextItem[1], 11, 14, 20, 56, blue, white); //²âÊÔÊý¾Ý
|
DrawLine( 20, 84, 33, 1, blue, white, linebold, 1);
|
DrawLine(252, 84, 33, 1, blue, white, linebold, 1);
|
DrawLine( 20, 84, 29, 0, blue, white, linebold, 1);
|
DrawLine( 20, 348, 29, 0, blue, white, linebold, 1);
|
|
//for(n=1; n<11; n++)
|
{
|
DSP12x16Str(FMDataInfText[1], 6, 12, 288, 24+32*1, blue, white);//Êý¾ÝÀàÐÍ
|
DSP12x16Str(FMDataInfText[2], 11, 12, 288, 24+32*2, blue, white);//±ê³ÆÈÝÁ¿
|
DSP12x16Str(FMDataInfText[3], 4, 12, 288, 24+32*3, blue, white);//²âÊÔµçÁ÷
|
DSP12x16Str(FMDataInfText[4], 8, 12, 288, 24+32*4, blue, white);//²âÊÔÈÝÁ¿
|
DSP12x16Str(FMDataInfText[5], 13, 12, 288, 24+32*5, blue, white);//²âÊÔʱ³¤
|
DSP12x16Str(FMDataInfText[6], 12, 12, 288, 24+32*6, blue, white);//µ¥ÌåÏÂÏÞ
|
DSP12x16Str(FMDataInfText[7], 12, 12, 288, 24+32*7, blue, white);//×é¶ËÏÂÏÞ
|
DSP12x16Str(FMDataInfText[8], 7, 12, 288, 24+32*8, blue, white);//ÿ×éµ¥Ìå
|
DSP12x16Str(FMDataInfText[9],7, 12, 288, 24+32*9, blue, white);//µ¥Ìå×éÊý
|
DSP12x16Str(FMDataInfText[10], 8, 12, 288, 24+32*10, blue, white);//Í£Ö¹ÔÒò
|
}
|
|
DSPFileList();
|
DrawFMButton(FMPListItemCount);
|
DrawButtonH48(2, FMButtonItem[2], 3, 15, 23, 274, 400, gray1, gray2); //USBת´æ
|
GetAndDspMemoryRest(292, 16);//ÏÔʾÄÚ´æÓàÁ¿
|
|
unsigned char data = ReadUDiskType(); //20160116
|
//PrintValue(0, 0, data, " ", 16, 300, 300+30, blue, white);
|
|
if(Def_UDisk_Ch376 == data) //20160116
|
DSP16x24Str(FLAG[0], 3, 16, 585, 8, blue, yellow);//CH6
|
else if(Def_UDisk_STM32U == data) //20160116
|
DSP16x24Str(FLAG[1], 3, 16, 585, 8, blue, yellow);//IDCE-4815CT
|
else if(Def_UDisk_SAMD21U == data)
|
DSP16x24Str(FLAG[1], 3, 16, 585, 8, blue, yellow);//IDCE-4815CT
|
|
if(FMPListItemCount > 0)
|
DrawButtonH48(2, FMButtonItem[2], 3, 15, 23, 274, 400, gray1, white); //USBת´æ
|
else
|
DrawButtonH48(2, FMButtonItem[2], 3, 15, 23, 274, 400, gray1, gray2); //USBת´æ
|
|
|
return 0;
|
}
|
//
|
|
void DrawFMButton(unsigned char itemcount)
|
{
|
unsigned char Fcl;
|
if(FMPListItemCount > 0)
|
Fcl = white;
|
else
|
Fcl = gray2;
|
|
DrawButtonH48(2, FMButtonItem[0], 5, 16, 8, 24, 400, gray1, Fcl); //ÉÏÉý¼ýÍ·
|
DrawButtonH48(2, FMButtonItem[1], 4, 16, 14, 149, 400, gray1, Fcl); //Ͻµ¼ýÍ·
|
DrawButtonH48(2, FMButtonItem[2], 3, 15, 23, 274, 400, gray1, Fcl); //USBת´æ
|
DrawButtonH48(2, FMButtonItem[3], 5, 15, 10, 399, 400, gray1, Fcl); //232ת´æ
|
DrawButtonH48(2, FMButtonItem[4], 5, 14, 10, 524, 400, gray1, red); //Í˳ö
|
|
DrawButtonH481(2, FMButtonItem[5], 7, 12, 3, 524, 134, gray1, Fcl); //ɾ³ý
|
DrawButtonH481(2, FMButtonItem[6], 8, 11, 4, 524, 220, gray1, white);//ȫɾ
|
}
|
//
|
|
unsigned char GetMemoryRest(void)
|
{
|
unsigned char tmp;
|
unsigned int count = 0;
|
for(tmp=0; tmp<SSTBlockSum; tmp++)
|
{
|
if(ReadByte_SST25VF(SSTBlockSize*tmp) == 0xFF)
|
count++;
|
}
|
return((unsigned char)(count*100/SSTBlockSum));
|
}
|
void GetAndDspMemoryRest(const unsigned int dspx, const unsigned int dspy)
|
{
|
unsigned char tmp;
|
unsigned char color = green7;
|
tmp = GetMemoryRest();
|
|
if(tmp>67)
|
{
|
color = green7;
|
}
|
else if((tmp<=67) && (tmp>33))
|
{
|
color = yellow;
|
}
|
else color = red;
|
|
DSP16x24Str(FMTextItem[2], 7, 16, dspx, dspy, blue, color);
|
PrintValue(2, 0, tmp, "%", 16, dspx+120, dspy, blue, color);
|
}
|
//
|
|
unsigned char CheckFileListExists(unsigned char list)
|
{
|
unsigned char n;
|
for(n=0; n<SSTBlockSum; n++)
|
{
|
if(FileList[n] == list)
|
return 1;
|
}
|
return 0;
|
}
|
//
|
|
unsigned long GetListItemAddr(unsigned char listitem)
|
{
|
unsigned char n;
|
for(n=0; n<SSTBlockSum; n++)
|
{
|
if(ReadByte_SST25VF(SSTBlockSize*n) == listitem)
|
{
|
return (SSTBlockSize*n);
|
}
|
}
|
|
return (0xffffffff);
|
}
|
//
|
|
unsigned char GetBlockSum(unsigned char listitem)
|
{
|
unsigned char n;
|
unsigned char sum = 0;
|
for(n=0; n<SSTBlockSum; n++)
|
{
|
if(ReadByte_SST25VF(SSTBlockSize*n) == listitem)
|
{
|
sum++;
|
}
|
}
|
|
return (sum);
|
}
|
//
|
|
void ClearFileList(void)
|
{
|
unsigned char n;
|
for(n=0; n<8; n++)
|
{
|
DSP16x24Str(FMClearListItem[0], 14, 16, 24, 56+32*(n+1), blue, yellow);
|
}
|
}
|
//
|
|
void DSPTestDataInf(File_Inf *fileinf)
|
{
|
unsigned char Fcolor = white;
|
unsigned char FFcolor = white;
|
unsigned char datatype;
|
if(fileinf->TestStartInf.DataType == 0xFD)//·ÅµçÊý¾Ý
|
{
|
datatype = 0x00;
|
FFcolor = red;
|
}
|
else
|
{
|
datatype = 0x01; //³äµçÊý¾Ý
|
FFcolor = white;
|
}
|
|
DSP12x16Str(FMDataInfContent[datatype], 6, 12, 400, 56, blue, FFcolor);
|
PrintValue1(1, 0, fileinf->TestStartInf.STDCap, " AH", 12, 422, 88, blue, Fcolor);
|
//DSP12x16Str(FMDataInfSubText[2], 1, 12, 482, 88, blue, white);//H
|
if(datatype == 0x00)
|
PrintValue1(2, 0, fileinf->TestStartInf.TestCur, " A", 16, 412, 120, blue, Fcolor);
|
else DSP16x24Str(FMClearListItem[0], 6, 16, 412, 120, blue, Fcolor);
|
|
if(fileinf->TestStopInf.TestCap < 10000)
|
{
|
PrintValue1(1, 0, fileinf->TestStopInf.TestCap, " AH", 12, 400, 152, blue, Fcolor);
|
//DSP12x16Str(FMDataInfSubText[2], 1, 12, 460, 152, blue, white);//H
|
}
|
else DSP16x24Str(FMClearListItem[0], 6, 16, 412, 152, blue, Fcolor);
|
|
if((fileinf->TestStopInf.TestTimeLong.hour<100)
|
&&(fileinf->TestStopInf.TestTimeLong.minute<60)
|
&&(fileinf->TestStopInf.TestTimeLong.second<60))
|
{
|
PrintTime1(&(fileinf->TestStopInf.TestTimeLong), ':', HM, 448, 184, blue, Fcolor);
|
}
|
else DSP12x16Str(FMClearListItem[0], 6, 16, 412, 184, blue, Fcolor);
|
|
PrintValue1(1, 2, fileinf->TestStartInf.MVLLimit, " B", 12, 436, 216, blue, Fcolor);
|
PrintValue1(1, 1, fileinf->TestStartInf.SumVLLimit, " B", 12, 436, 248, blue, Fcolor);
|
PrintValue1(2, 0, fileinf->TestStartInf.BattSum, "", 16, 412, 280, blue, Fcolor);
|
DSP12x16Str(FMDataInfSubText[1], 2, 12, 460, 280, blue, white); //¸ö
|
PrintValue1(2, 0, fileinf->TestStartInf.BattGroup, "", 16, 412, 312, blue, Fcolor);
|
DSP12x16Str(FMDataInfSubText[0], 2, 12, 460, 312, blue, white); //×é
|
if(fileinf->TestStopInf.StopType >= 8)
|
{
|
fileinf->TestStopInf.StopType = 8;
|
}
|
DSP12x16Str(FMClearListItem[0], 16, 12, 412, 344, blue, Fcolor);
|
if((fileinf->TestStopInf.StopType == 1)||(fileinf->TestStopInf.StopType == 2))
|
DSP12x16Str(FMStoptypeContent[fileinf->TestStopInf.StopType], 12, 12, 412, 344, blue, Fcolor);
|
else
|
DSP12x16Str(FMStoptypeContent[fileinf->TestStopInf.StopType], 10, 12, 412, 344, blue, Fcolor);
|
}
|
//
|
|
void DSPFileList(void)
|
{
|
unsigned char index = 0;
|
unsigned char n = 0;
|
|
FMPListItemCount = 0;
|
for(index=0; index<SSTBlockSum; index++)
|
{
|
FileList[index] = 0xff;
|
}
|
|
for(index=0; index<SSTBlockSum; index++)
|
{
|
unsigned char tag;
|
tag = ReadByte_SST25VF(SSTBlockSize*index);
|
if((tag<SSTBlockSum) && (CheckFileListExists(tag)==0))
|
{
|
FileList[n++] = tag;
|
}
|
}
|
FMPListItemCount = n;
|
if(FMPItemIndex >= FMPListItemCount)
|
FMPItemIndex = FMPListItemCount-1;
|
if(DSPListStartIndex >= FMPListItemCount)
|
DSPListStartIndex = FMPListItemCount;
|
|
//----------------------------------------------------------------
|
if(FMPListItemCount > 0)
|
PrintValue(3, 0, FMPItemIndex+1, "/", 16, 180, 56, blue, white);
|
else
|
{
|
FMPItemIndex = 0;
|
PrintValue(3, 0, FMPItemIndex, "/", 16, 180, 56, blue, white);
|
}
|
PrintValue(3, 0, FMPListItemCount, "", 16, 228, 56, blue, white);
|
//----------------------------------------------------------------
|
|
for(index=DSPListStartIndex; index<8+DSPListStartIndex; index++)
|
{
|
if(FileList[index] == 0xff)
|
{
|
continue;
|
}
|
else
|
{
|
File_Inf tmpfileinf;
|
unsigned long infaddr = GetListItemAddr(FileList[index]);
|
if(infaddr >= SSTMemorySize)
|
{
|
continue;
|
}
|
else
|
{
|
ReadFileInf(infaddr+2, &tmpfileinf);
|
}
|
|
if(index != FMPItemIndex)
|
{
|
PrintTime(&(tmpfileinf.TestStartInf.TestStartTime), ':', YMDHM,
|
24, 56+32*(index-DSPListStartIndex+1), blue, white);
|
}
|
else
|
{
|
PrintTime(&(tmpfileinf.TestStartInf.TestStartTime), ':', YMDHM,
|
24, 56+32*(index-DSPListStartIndex+1), green5, white);
|
DSPTestDataInf(&tmpfileinf);//ÏÔʾÊý¾ÝÐÅÏ¢
|
}
|
}
|
}
|
}
|
//
|
|
void GetFileManageButtonDown(void)
|
{
|
unsigned char touched_item = ButtonNull;
|
|
touched_item = GetTouchLocal();
|
|
if((touched_item==Button0) && (FMPListItemCount>0))//ÉÏÉý¼ýÍ·
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
if(FMPItemIndex > 0)
|
FMPItemIndex--;
|
else
|
FMPItemIndex = FMPListItemCount-1;
|
|
if(FMPItemIndex < DSPListStartIndex)
|
{
|
DSPListStartIndex--;
|
}
|
else if(FMPItemIndex > DSPListStartIndex+7)
|
{
|
if(FMPListItemCount >= 8)
|
DSPListStartIndex = FMPItemIndex-7;
|
else DSPListStartIndex = 0;
|
}
|
DSPFileList();
|
|
_delay_ms(100);
|
}
|
else if((touched_item==Button1) && (FMPListItemCount>0))//Ͻµ¼ýÍ·
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
FMPItemIndex++;
|
if(FMPItemIndex >= FMPListItemCount)
|
{
|
FMPItemIndex = 0;
|
DSPListStartIndex = 0;
|
}
|
else if(FMPItemIndex > DSPListStartIndex+7)
|
{
|
DSPListStartIndex++;
|
}
|
DSPFileList();
|
|
_delay_ms(100);
|
}
|
else if((touched_item==Button2) && (FMPListItemCount>0))//USBת´æ
|
{
|
BuzzerBeep(100);
|
|
if(countbak == 0)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
return;
|
}
|
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι¹·
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι¹·
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι¹·
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
|
// FMChildPage = DSPMessageBoxNull;
|
// if(DSPMessageBox3(USBErrorText[2], 13, MB_YESNO, BeepNull) == ButtonOK)
|
{
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
_delay_ms(500);
|
wdt_reset(); //ι?
|
if(Def_UDisk_Ch376 == getUDiskType()) //20160116
|
ReadFile(FileList[FMPItemIndex], usb_device); //20160116
|
else if(Def_UDisk_STM32U == getUDiskType()) //20160116
|
ReadFile(FileList[FMPItemIndex], usb_stm32U); //20160116
|
else if(Def_UDisk_SAMD21U == getUDiskType()) //20160116
|
ReadFile(FileList[FMPItemIndex], usb_samd21U); //20160116
|
}
|
}
|
else if((touched_item==Button3) && (FMPListItemCount>0))//232ת´æ
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
ReadFile(FileList[FMPItemIndex], comm_device);
|
}
|
else if(touched_item == Button4)//Í˳ö
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
BackColorCH();
|
FMParentPage();
|
FMParentPage = DSPFileManagePage;//»Ö¸´¸¸Ö¸ÕëËùÖ¸Ò³ÃæÎª×Ô¼º
|
}
|
|
else if(touched_item == Button6)//ȫɾ
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
FMChildPage = DSPMessageBoxNull;
|
if(DSPMessageBox(FMAlarmText[1], 19, MB_YESNO, BeepNull) == ButtonOK)
|
{
|
EraseChip_SST25VF();
|
_delay_ms(100);
|
BackColorCH();
|
DSPFileManagePage();//ˢб¾Ò³Ãæ
|
}
|
_delay_ms(200);
|
}
|
else if((touched_item==Button7) && (FMPListItemCount>0))//ɾ³ý
|
{
|
if(GetButtonIsBeep(0) == BeepIsWork)
|
BuzzerBeep(100);
|
FMChildPage = DSPMessageBoxNull;
|
if(DSPMessageBox(FMAlarmText[0], 15, MB_YESNO, BeepNull) == ButtonOK)
|
{
|
if(FMPListItemCount > 0)
|
{
|
DeleteFile(FileList[FMPItemIndex]);
|
ClearFileList();
|
DSPFileList();
|
}
|
}
|
|
DrawFMButton(FMPListItemCount);
|
GetAndDspMemoryRest(292, 16);//ÏÔʾÄÚ´æÓàÁ¿
|
_delay_ms(200);
|
}
|
}
|
//
|
|
void FileManageInit(void)
|
{
|
unsigned char first_use_check[8] = {0};
|
unsigned char n;
|
unsigned char first_use = 0;//¼Ù¶¨²»ÊǵÚÒ»´ÎÓÃ
|
|
File.AlreadyCreated = 0;
|
File.FileHandle = 0xff;
|
File.FileAddr = 0xffffffff;
|
|
//------------ ¼ì²éÊÇ·ñÊǵÚÒ»´ÎʹÓñ¾ÒDZí --------------
|
eeprom_busy_wait();
|
eeprom_read_block(first_use_check, FirstUseTag, sizeof(FirstUseTag));
|
for(n=0; n<8; n++)
|
{
|
if(first_use_check[n] == 0xff)
|
{
|
first_use = 1;
|
continue;
|
}
|
else
|
{
|
first_use = 0;
|
break;
|
}
|
}
|
//--- Èç¹ûÊǵÚÒ»´ÎÓñ¾ÒDZí,ÔòȫƬ²Á³ýflash´æ´¢Æ÷ -----
|
if(first_use == 1)
|
{
|
Buzzer_ON;
|
EraseChip_SST25VF();
|
_delay_ms(100);
|
Buzzer_OFF;
|
}
|
//---------- ʹÒÇ±í´¦ÓڷǵÚÒ»´ÎʹÓõÄ״̬ ------------
|
for(n=0; n<8; n++)
|
{
|
first_use_check[n] = 0x00;
|
}
|
eeprom_busy_wait();
|
eeprom_write_block(first_use_check, FirstUseTag, sizeof(FirstUseTag));
|
}
|
//
|
|
unsigned char FileExists(void)
|
{
|
if((File.AlreadyCreated==1) && (File.FileHandle<SSTBlockSum))//ÎļþÒѾ½¨Á¢ÇÒ¾ä±úÓÐЧ
|
{
|
return 1;
|
}
|
else
|
{
|
return 0;
|
}
|
}
|
//
|
|
unsigned char CreateFile(void)
|
{
|
unsigned char n;
|
File.FileAddr = 0;
|
if(File.AlreadyCreated == 1)
|
{
|
return 0;
|
}
|
|
for(n=0; n<SSTBlockSum; n++)
|
{
|
if(ReadByte_SST25VF(SSTBlockSize*n) != 0xFF)
|
{
|
continue;
|
}
|
else
|
{
|
File.FileAddr = SSTBlockSize*n;
|
File.FileHandle = n;
|
break;
|
}
|
}
|
|
if(n >= SSTBlockSum)//ûÓÐÊ£ÓàÄÚ´æ¿ÉÓÃ
|
{
|
File.AlreadyCreated = 0;
|
File.FileHandle = 0xFF;
|
return 0;
|
}
|
|
File.AlreadyCreated = 1;
|
WriteByte_SST25VF(File.FileAddr++, File.FileHandle);
|
WriteByte_SST25VF(File.FileAddr++, File.FileHandle);
|
WriteBlock_SST25VF(File.FileAddr, &(GB_TestDataInf.TestStartInf), sizeof(Data_Start_Inf));
|
File.FileInfAddr = File.FileAddr + sizeof(Data_Start_Inf);
|
File.FileAddr += 256;//sizeof(File_Inf);//Ìø¹ýÊý¾ÝÐÅÏ¢µØÖ·
|
|
return 1;
|
}
|
//
|
|
|
|
void SaveFile(volatile const FBO_Data *fbodata)
|
{
|
unsigned int datalen = sizeof(FBO_Data) - 1000 + fbodata->BattSum*2;
|
|
if(FileExists() == 0)
|
return;
|
|
GB_FBO_Data.CRC16 = 0;
|
GB_FBO_Data.CRC16 = CalCRC16(fbodata, datalen);
|
|
//----------- ÏÈÔÚ32k¿éµÄÍ·Á½¸ö×Ö½ÚдÈëµÄ±êÖ¾·û,µØÖ·Ò²Ôö¼Ó2 ------------
|
if((File.FileAddr%SSTBlockSize) == 0)
|
{
|
WriteByte_SST25VF(File.FileAddr++, File.FileHandle);
|
WriteByte_SST25VF(File.FileAddr++, File.FileHandle);
|
if(GetMemoryRest() <= 4) //ÄÚ´æ²»×ã,¹Ø±ÕÎļþ;
|
{
|
CloseFile(fbodata, WPFLASHUPSTOP);
|
return;
|
}
|
}
|
|
//----------- ½Ó×ÅдÈëºóÐøÊý¾Ý,µØÖ·ÔöÁ¿ÎªÐ´ÈëÊý¾ÝµÄ³¤¶È ----------------
|
if((SSTBlockSize-(File.FileAddr%SSTBlockSize)) >= datalen)
|
{
|
WriteBlock_SST25VF(File.FileAddr, fbodata, datalen);
|
File.FileAddr += datalen;
|
}
|
else //------ Èç¹ûÊ£Óà¿éµÄÈÝÁ¿²»¹»,ÔòÀ©Õŵ½ÏÂÒ»¸ö32K¿é -----------------
|
{
|
unsigned long tmpaddr = File.FileAddr;
|
File.FileAddr = GetListItemAddr(0xFF);
|
//------- Èç¹ûÁìÍÁÀ©ÕÅ´íÎó»òʧ°Ü,Ç¿ÖÆ¹Ø±ÕÎļþ! ----------
|
if((File.FileAddr<=tmpaddr) || (File.FileAddr>=SSTMemorySize))
|
{
|
File.AlreadyCreated = 0;
|
File.FileHandle = 0xff;
|
File.FileAddr = 0xffffffff;
|
File.FileInfAddr = 0xffffffff;
|
return;
|
}
|
|
SaveFile(fbodata); //-- µÝ¹éµ÷ÓÃ×ÔÉíÖØÐÂÖ´ÐÐÒ»´Î±£´æ²Ù×÷;
|
}
|
}
|
//
|
|
void CloseFile(volatile const FBO_Data *data, const unsigned char stoptype)
|
{
|
if(FileExists() == 0)
|
return;
|
|
GB_TestDataInf.TestStopInf.TestTimeLong = data->m_TestTime;
|
GB_TestDataInf.TestStopInf.TestCap = data->AllCap;
|
GB_TestDataInf.TestStopInf.StopType = stoptype;//Í£Ö¹ÔÒò
|
for(unsigned char m=0; m<4; m++)
|
{
|
GB_TestDataInf.TestStopInf.SMaxIndex[m] = GetMonomerMaxIndex(m);
|
GB_TestDataInf.TestStopInf.SMinIndex[m] = GetMonomerMinIndex(m);
|
GB_TestDataInf.TestStopInf.SMaxVol[m] = GetMonomerMaxVol(m);
|
GB_TestDataInf.TestStopInf.SMinVol[m] = GetMonomerMinVol(m);
|
}
|
GB_TestDataInf.TestStopInf.BlockSum = GetBlockSum(File.FileHandle);
|
GB_TestDataInf.TestStopInf.StandBy = 0;//±¸ÓÃ
|
WriteBlock_SST25VF(File.FileInfAddr, &(GB_TestDataInf.TestStopInf), sizeof(Data_Stop_inf));
|
|
File.AlreadyCreated = 0;
|
File.FileHandle = 0xff;
|
File.FileAddr = 0xffffffff;
|
File.FileInfAddr = 0xffffffff;
|
}
|
//
|
void ReadFile(unsigned char filehandle, unsigned char device)//Õû¸öº¯ÊýÓÉCH376°æ±¾Ìæ»»¶øÀ´¡£?
|
{
|
unsigned char LongNameBuf[ LONG_NAME_BUF_LEN ]; /* ´æ·Å³¤ÎļþÃû */
|
unsigned char LongName1[] =
|
{
|
'F', 0x00, //F
|
0x30, 0x00, //0 2
|
0x30, 0x00, //0 0
|
0x30, 0x00, //0 1
|
0x30, 0x00, //0 1
|
'-', 0x00,
|
0x30, 0x00, //0 0
|
0x30, 0x00, //0 6
|
'-', 0x00,
|
0x30, 0x00, //0 0
|
0x30, 0x00, //0 2
|
' ', 0x00,
|
0x30, 0x00, //0 0
|
0x30, 0x00, //0 9
|
'.', 0x00,
|
0x30, 0x00, //0 3
|
0x30, 0x00, //0 0
|
'.', 0x00,
|
0x30, 0x00, //0 4
|
0x31, 0x00, //1 5
|
'.', 0x00, //.
|
'F', 0x00, //F
|
'B', 0x00, //B
|
'O', 0x00 //O
|
};
|
//----------------------------------------------------------------------------------------------
|
unsigned char ShortName[] = {'/','0','0','0','0','0','0','0','0','.','F','B','O',0x00};
|
//----------------------------------------------------------------------------------------------
|
unsigned char rs232headerTX[4] = {0xAA,0xAA,0xAA,0xAA};
|
unsigned char rs232headerRX[4] = {0};
|
File_Inf fileinf;
|
unsigned char blocksum = 0;
|
ReadFileInf(GetListItemAddr(filehandle)+2, &fileinf);
|
blocksum = GetBlockSum(filehandle);
|
rs232headerTX[2] = blocksum;
|
|
if(blocksum > 0)
|
{
|
if(device == usb_device)
|
{
|
unsigned char EER = 0;
|
//------------ Çл»µ½MUSB¶Ë¿Ú ---------------
|
// Config_M64USART1(1152);
|
Delay_MS(10);
|
|
ShortName[7] = (fileinf.TestStartInf.TestStartTime.second)%10 + 0x30;
|
ShortName[6] = (fileinf.TestStartInf.TestStartTime.second)/10 + 0x30;
|
ShortName[5] = (fileinf.TestStartInf.TestStartTime.minute)%10 + 0x30;
|
ShortName[4] = (fileinf.TestStartInf.TestStartTime.minute)/10 + 0x30;
|
ShortName[3] = (fileinf.TestStartInf.TestStartTime.hour)%10 + 0x30;
|
|
LongName1[2] = 0x32; //³¤ÎļþÃû
|
LongName1[4] = (fileinf.TestStartInf.TestStartTime.year%1000)/100 + 0x30;
|
LongName1[6] = (fileinf.TestStartInf.TestStartTime.year%100)/10 + 0x30;
|
LongName1[8] = fileinf.TestStartInf.TestStartTime.year%10 + 0x30;
|
LongName1[12] = fileinf.TestStartInf.TestStartTime.month/10+0x30;
|
LongName1[14] = fileinf.TestStartInf.TestStartTime.month%10+0x30;
|
LongName1[18] = fileinf.TestStartInf.TestStartTime.day/10+0x30;
|
LongName1[20] = fileinf.TestStartInf.TestStartTime.day%10+0x30;
|
LongName1[24] = fileinf.TestStartInf.TestStartTime.hour/10+0x30;
|
LongName1[26] = fileinf.TestStartInf.TestStartTime.hour%10+0x30;
|
LongName1[30] = fileinf.TestStartInf.TestStartTime.minute/10+0x30;
|
LongName1[32] = fileinf.TestStartInf.TestStartTime.minute%10+0x30;
|
LongName1[36] = fileinf.TestStartInf.TestStartTime.second/10+0x30;
|
LongName1[38] = fileinf.TestStartInf.TestStartTime.second%10+0x30;
|
|
memcpy(LongNameBuf, LongName1, sizeof(LongName1)); // ¸´ÖƳ¤ÎļþÃûµ½LongNameBuf³¤ÎļþÃû»º³åÇø
|
LongNameBuf[sizeof(LongName1)] = 0x00; // ´´½¨³¤ÎļþÃûĩβÓÃÁ½¸ö0±íʾ½áÊø
|
LongNameBuf[sizeof(LongName1)+1] = 0x00;
|
|
if(USB_INT_SUCCESS != mInitCH376Host()) //³õʼ»¯CH376
|
{
|
EER = 1;
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[0], 19, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
if(CH376DiskConnect() != USB_INT_SUCCESS) //¼ì²âUÅÌÊÇ·ñÁ¬½Ó
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[0], 19, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
for ( unsigned char s = 0; s < 5; s++ )
|
{
|
_delay_ms( 50 ); // ×µÈ´ýʱ¼ä,10*50mS //
|
wdt_reset(); //ι¹·
|
if ( CH376DiskMount( ) == USB_INT_SUCCESS )
|
{
|
break; //³õʼ»¯´ÅÅ̲¢²âÊÔ´ÅÅÌÊÇ·ñ¾ÍÐ÷
|
}
|
else if(s >= 3)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[0], 19, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
for ( unsigned char s = 0; s < 5; s++ )
|
{
|
_delay_ms( 50 );
|
wdt_reset(); //ι¹·
|
if(CH376CreateLongName(ShortName, LongNameBuf) == USB_INT_SUCCESS)
|
{
|
break;
|
}
|
else if(s >= 3)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
if(CH376FileOpenPath(ShortName) != USB_INT_SUCCESS)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
|
}
|
else if(usb_stm32U == device)
|
{
|
unsigned char STM32UName[]={'F','2','0','1','6',
|
'-','0','1',
|
'-','1','8',
|
' ','1','6',
|
'.','0','6',
|
'.','0','0',
|
'.','F','B','O',
|
0x00};
|
|
STM32UName[0] = 'F'; //³¤ÎļþÃû
|
STM32UName[1] = '2'; //³¤ÎļþÃû
|
STM32UName[2] = (fileinf.TestStartInf.TestStartTime.year%1000)/100 + 0x30;
|
STM32UName[3] = (fileinf.TestStartInf.TestStartTime.year%100)/10 + 0x30;
|
STM32UName[4] = fileinf.TestStartInf.TestStartTime.year%10 + 0x30;
|
|
STM32UName[6] = fileinf.TestStartInf.TestStartTime.month/10+0x30;
|
STM32UName[7] = fileinf.TestStartInf.TestStartTime.month%10+0x30;
|
|
STM32UName[9] = fileinf.TestStartInf.TestStartTime.day/10+0x30;
|
STM32UName[10] = fileinf.TestStartInf.TestStartTime.day%10+0x30;
|
|
STM32UName[12] = fileinf.TestStartInf.TestStartTime.hour/10+0x30;
|
STM32UName[13] = fileinf.TestStartInf.TestStartTime.hour%10+0x30;
|
|
STM32UName[15] = fileinf.TestStartInf.TestStartTime.minute/10+0x30;
|
STM32UName[16] = fileinf.TestStartInf.TestStartTime.minute%10+0x30;
|
|
STM32UName[18] = fileinf.TestStartInf.TestStartTime.second/10+0x30;
|
STM32UName[19] = fileinf.TestStartInf.TestStartTime.second%10+0x30;
|
|
/*unsigned short pp = */;
|
for(unsigned char s=0;s<15;s++)
|
{
|
_delay_ms(500);
|
wdt_reset(); //ι¹·
|
if( creatFileManage(STM32UName, sizeof(STM32UName)) == pdTRUE)
|
{
|
break;
|
}
|
else if(s >= 10)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
|
}
|
else if(usb_samd21U == device)
|
{
|
unsigned char SAMD21UName[]={'F','2','0','1','6',
|
'-','0','1',
|
'-','1','8',
|
' ','1','6',
|
'.','0','6',
|
'.','0','0',
|
'.','F','B','O',
|
0x00};
|
|
SAMD21UName[0] = 'F'; //³¤ÎļþÃû
|
SAMD21UName[1] = '2'; //³¤ÎļþÃû
|
SAMD21UName[2] = (fileinf.TestStartInf.TestStartTime.year%1000)/100 + 0x30;
|
SAMD21UName[3] = (fileinf.TestStartInf.TestStartTime.year%100)/10 + 0x30;
|
SAMD21UName[4] = fileinf.TestStartInf.TestStartTime.year%10 + 0x30;
|
|
SAMD21UName[6] = fileinf.TestStartInf.TestStartTime.month/10+0x30;
|
SAMD21UName[7] = fileinf.TestStartInf.TestStartTime.month%10+0x30;
|
|
SAMD21UName[9] = fileinf.TestStartInf.TestStartTime.day/10+0x30;
|
SAMD21UName[10] = fileinf.TestStartInf.TestStartTime.day%10+0x30;
|
|
SAMD21UName[12] = fileinf.TestStartInf.TestStartTime.hour/10+0x30;
|
SAMD21UName[13] = fileinf.TestStartInf.TestStartTime.hour%10+0x30;
|
|
SAMD21UName[15] = fileinf.TestStartInf.TestStartTime.minute/10+0x30;
|
SAMD21UName[16] = fileinf.TestStartInf.TestStartTime.minute%10+0x30;
|
|
SAMD21UName[18] = fileinf.TestStartInf.TestStartTime.second/10+0x30;
|
SAMD21UName[19] = fileinf.TestStartInf.TestStartTime.second%10+0x30;
|
|
/*unsigned short pp = */;
|
for(unsigned char s=0;s<15;s++)
|
{
|
_delay_ms(500);
|
wdt_reset(); //ι¹·
|
if( creatFileManage_21(SAMD21UName, sizeof(SAMD21UName)) == pdTRUE)
|
{
|
break;
|
}
|
else if(s >= 10)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
}
|
else
|
{
|
unsigned char n = 0;
|
unsigned char error = 0;
|
//ClearUSART1RXBuffer();
|
//SendSTR_M64USART1(rs232headerTX, 4);
|
//ReceiveSTR_M64USART1(rs232headerRX, 4, 500000);
|
ClearUSART0RXBuffer();
|
SendSTR_M64USART0(rs232headerTX, 4);
|
ReceiveStr_M64USART0(rs232headerRX, 4);
|
for(n=0; n<4; n++)
|
{
|
if(rs232headerTX[n] != rs232headerRX[n])
|
{
|
error = 1;
|
break;
|
}
|
}
|
if(error != 0)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[2], 13, MB_OK, FlashUPStop);
|
return;
|
}
|
}
|
|
|
if(ReadBlock_SST25VF(filehandle, blocksum, device) == NO)
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
// return;
|
}
|
|
|
|
|
if(device == usb_device)
|
{
|
if(CH376FileClose(TRUE) != USB_INT_SUCCESS)// ¶ÔÓÚ¸ùĿ¼Ôò±ØÐëÒª¹Ø±Õ
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
else if(device == usb_stm32U) //20160116
|
{
|
if( pdFALSE == STM32U_closeFile() )
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
else if(usb_samd21U == device) //20160116
|
{
|
if( pdFALSE == SAMD21U_closeFile() )
|
{
|
FMChildPage = DSPMessageBoxNull;
|
DSPMessageBox3(USBErrorText[1], 17, MB_OK, FlashUPStop);
|
// Config_M64USART1(192);
|
return;
|
}
|
}
|
|
// Config_M64USART1(192);
|
|
Delay_MS(1000);
|
wdt_reset(); //ι¹·
|
Delay_MS(1000);
|
wdt_reset(); //ι¹·
|
|
BackColorCH();
|
GB_SYS_State.CurrentPage();
|
}
|
}
|
|
|
void DeleteFile(unsigned char filehandle)
|
{
|
unsigned char index = 0;
|
//------------------ ²Á³ý¶ÔÓ¦µÄÎļþ¾ä±ú±í²¢±£´æ ----------------------
|
for(index=0; index<SSTBlockSum; index++)
|
{
|
if(ReadByte_SST25VF(SSTBlockSize*index) == filehandle)
|
{
|
Erase32K_SST25VF(SSTBlockSize*index);
|
}
|
}
|
|
DSPFileList();//ÖØÐÂË¢ÐÂÎļþÁбí
|
}
|
//
|
|
/********************** END OF FILE (FileManage.c)*************************/
|