From d28d1c53ae177f63ccb10c971f743ebe0f5793e3 Mon Sep 17 00:00:00 2001 From: "CSSC-WORK\\murmur" Date: Sun, 10 Sep 2023 11:35:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0file=20is=20ok=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=E6=BF=80=E6=B4=BB=E6=9C=9F=E9=97=B4=E6=94=B6=E5=88=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=80=8C=E8=A7=A6=E5=8F=91=E5=BB=B6=E6=97=B6=E5=85=B3?= =?UTF-8?q?=E6=9C=BA=20sendfile=20=E6=9B=B4=E6=96=B0mutex=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=A4=9A=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E4=BD=86=E4=BE=9D=E6=AC=A1=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/core.c | 19 ++++++++++++++----- applications/func/func.c | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/applications/core.c b/applications/core.c index 5571a8b..0d16d04 100644 --- a/applications/core.c +++ b/applications/core.c @@ -39,7 +39,8 @@ rt_sem_t okToreport = RT_NULL;//配置信息ACK static rt_thread_t initThread=RT_NULL; static rt_thread_t deinitThread=RT_NULL; static rt_timer_t tmrToPNTT=RT_NULL; -static uint8_t isWindowMode=0;//自动或手动引起TT开机 +static uint8_t isWindowMode=0;//RTC引起TT开机 +static uint8_t isFileMode=0;//file is ok //void TTisReady(void) //{ // rt_sem_release(TTReady); @@ -274,6 +275,7 @@ void timerIsReady(void) void fileIsReady(void) { rt_event_send(&chkSta, FILE_IS_OK); + isFileMode = 1; stopTM(); } void TTIsReady(void) @@ -336,6 +338,11 @@ void resetTM(void) LOG_W("TIMEOUT stopped.[isManualMode]"); return; } + if (isFileMode) { + stopTM(); + LOG_W("TIMEOUT stopped.[isFileMode]"); + return; + } rt_tick_t t= rt_tick_from_millisecond(scfg.timeout*60*1000); rt_timer_control(tmrToPNTT, RT_TIMER_CTRL_SET_TIME,(void*) &t); @@ -415,7 +422,7 @@ static void upSendFile_thread_entry(void *parameter) { FILE_INFO *f = RT_NULL; f = (FILE_INFO *) parameter; - + rt_mutex_take(okTosend, RT_WAITING_FOREVER); static rt_uint8_t d[BUFFER_ROW][200] = { };//need static? static rt_uint8_t s[BUFFER_ROW] = { }; if (!getFileSize(f->fname)) { @@ -467,7 +474,8 @@ static void upSendFile_thread_entry(void *parameter) */ void upSendFile(const char *f, int index) { - + resetTM(); + isFileMode=0;//逻辑不是很准确 static FILE_INFO info; rt_memset(&info, 0, sizeof(FILE_INFO)); strcpy(info.fname, f); @@ -507,7 +515,7 @@ void getAndSendFile() if (getFileSize(fnow)) {//有数据才发 updateCacheFileName(); LOG_I("send latest data first"); - rt_mutex_take(okTosend, RT_WAITING_FOREVER); +// rt_mutex_take(okTosend, RT_WAITING_FOREVER); upSendFile(fnow,0); // rt_mutex_release(okTosend);//由upSendFile释放 } @@ -534,7 +542,8 @@ void getAndSendFile() { // LOG_D("f[%d]=%s",i,f[i]); // continue; - if (rt_mutex_take(okTosend, RT_WAITING_FOREVER) == RT_EOK) { +// if (rt_mutex_take(okTosend, RT_WAITING_FOREVER) == RT_EOK) + { rt_thread_mdelay(1000);//thread close upSendFile(f[i],index[i]); } diff --git a/applications/func/func.c b/applications/func/func.c index 985680c..3f3affc 100644 --- a/applications/func/func.c +++ b/applications/func/func.c @@ -447,7 +447,7 @@ void openWindow(int t) setManualWindow(t); //开启TT initTT(); - setWindowMode(); +// setWindowMode(); //手动开窗优先级最高,自动开窗其次,高优先级会屏蔽低优先级 stopAlarm(); if (!t) {