添加file is ok对应的逻辑,防止激活期间收到数据而触发延时关机

sendfile 更新mutex逻辑,可以多线程但依次发送
This commit is contained in:
CSSC-WORK\murmur 2023-09-10 11:35:17 +08:00
parent b23b4bf6c2
commit d28d1c53ae
2 changed files with 15 additions and 6 deletions

View File

@ -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]);
}

View File

@ -447,7 +447,7 @@ void openWindow(int t)
setManualWindow(t);
//开启TT
initTT();
setWindowMode();
// setWindowMode();
//手动开窗优先级最高,自动开窗其次,高优先级会屏蔽低优先级
stopAlarm();
if (!t) {