aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index b23b4361b..d7592ccba 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -49,7 +49,7 @@ FIL *UploadFileHandle = 0; //the system supports a single active file
FIL *DownloadFileHandle = 0; //the system supports a single active file
char FileHandleChar[5];
char ErrorMsg[100];
-#define MAX_CHUNK_LENGTH 3500
+#define MAX_CHUNK_LENGTH 5500
int32_t FileLength = 0;
int32_t FileReceivedLength = 0;
int32_t FileSentLength = 0;
@@ -158,14 +158,16 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
FIL *ReceivedFileHandle; //the system supports a single active file
+ uint32_t save_milisec = 0;
// if (request->uploadid == 1)
ReceivedFileHandle = UploadFileHandle;
// memcpy (&ReceivedFileHandle,request->uploadid,sizeof(ReceivedFileHandle));
//if (ReceivedFileHandle == FileHandle)
//{
- Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds
- GeneralHwReady = false;
+ //Control_WD(ENABLE,55); //activate heaters/dispenser watchdog, 0.5 seconds
+ //GeneralHwReady = false;
KeepAliveOneSecondCounter = 0;
+ save_milisec = msec_millisecondCounter;
Fresult = f_write(ReceivedFileHandle,request->buffer.data,request->buffer.len,&WrittenBytes );
lFresult = Fresult;
if(Fresult != FR_OK)
@@ -176,7 +178,7 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
else
{
FileReceivedLength += WrittenBytes;
- ReportWithPackageFilter(CommFilter,"Chunk received", __FILE__,WrittenBytes,FileReceivedLength, RpMessage,msec_millisecondCounter, 0);
+ ReportWithPackageFilter(CommFilter,"Chunk received", __FILE__,WrittenBytes,FileReceivedLength, RpMessage,msec_millisecondCounter-save_milisec, 0);
//REPORT_MSG (FileReceivedLength,"file upload chunk");
if (FileReceivedLength == FileLength)
@@ -226,12 +228,25 @@ uint32_t FileChunkUploadRequestFunc(MessageContainer* requestContainer)
if (FileDone == true)
{
Task_setPri(CommRxTaskHandle, 9);
- GeneralHwReady = true;
Semaphore_post(FFS_Sem);
//Report("Task_setPri", __FILE__, __LINE__, 9, RpWarning, (int)CommRxTaskHandle, 0);
}
return OK;
}
+void FileChunkUploadError(void)
+{
+ if (FileDone == false)
+ {
+ REPORT_MSG (FileReceivedLength,"file upload too much data!");
+ f_close(UploadFileHandle);
+ my_free (UploadFileHandle);
+ UploadFileHandle = 0;
+ FileReceivedLength = 0;
+ FileDone = true;
+ Task_setPri(CommRxTaskHandle, 9);
+ Semaphore_post(FFS_Sem);
+ }
+}
uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer)
{
//uint32_t status = OK;