16d3e235db
tcpdemo.c 交换接收发送顺序 添加xh值99处理逻辑
85 lines
1.8 KiB
C
85 lines
1.8 KiB
C
|
|
|
|
#include <rtthread.h>
|
|
#define LOG_TAG "tool"
|
|
#define LOG_LVL LOG_LVL_DBG
|
|
#include <ulog.h>
|
|
//#include <cJSON.h>
|
|
#include <dfs_file.h>
|
|
#include <usrcfg.h>
|
|
|
|
#ifdef _CFGALL
|
|
int sendInterval =60;
|
|
int maxTTWaitTime = 4;
|
|
int maxTTRetryCnt = 3;
|
|
int minTTPeriCnt=5;
|
|
int minTTsinal=5;
|
|
/**
|
|
* 以HEX显示文件内容
|
|
*/
|
|
void hex()
|
|
{
|
|
|
|
}
|
|
|
|
/**
|
|
* 更新全局参数
|
|
*/
|
|
void updatecfg(void)
|
|
{
|
|
//因为不知原因,采用事件集独立更新配置出错
|
|
//独立响应单个参数更新事件,程序上更复杂也没特别必要
|
|
//现采用事件通知、统一全部重新加载
|
|
while(1)
|
|
{
|
|
maxTTWaitTime = get_cfg("maxTTWaitTime");
|
|
maxTTRetryCnt = get_cfg("maxTTRetryCnt");
|
|
static int minTTPeriCnt=5;
|
|
static int minTTsinal=5;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
|
|
void sDemo()
|
|
{
|
|
// extern struct rt_event sw_check;//软件条件
|
|
// rt_event_send(&sw_check, FILE_IS_OK);
|
|
void upSWflag(void);
|
|
upSWflag();
|
|
}
|
|
|
|
MSH_CMD_EXPORT(sDemo,喂文件数据);
|
|
|
|
static struct rt_thread infoTT_thread;
|
|
void ttinfoInit()
|
|
{
|
|
static CFG cfg;
|
|
memset(&cfg, 0, sizeof(CFG));
|
|
|
|
cfg.s = 1;
|
|
cfg.cnt = 10; //避免通信异常
|
|
extern void getTTinfo_thread_entry(void* parameter);
|
|
// extern void getTTinfo_thread_entry(void* parameter);
|
|
// struct rt_thread infoTT_thread;
|
|
ALIGN(RT_ALIGN_SIZE)
|
|
static char thread2_stack[1024 * 3];
|
|
rt_thread_init(&infoTT_thread, "getTT", getTTinfo_thread_entry, (void *) &cfg, &thread2_stack[0],
|
|
sizeof(thread2_stack), 25, 10);
|
|
// rt_thread_startup(&infoTT_thread);
|
|
}
|
|
|
|
void startTTinfo(void)
|
|
{
|
|
if (&infoTT_thread == RT_NULL) {
|
|
//to Init
|
|
}
|
|
if ((infoTT_thread.stat & RT_THREAD_STAT_MASK) == RT_THREAD_INIT) {
|
|
|
|
}
|
|
rt_thread_startup(&infoTT_thread);
|
|
}
|
|
//MSH_CMD_EXPORT(ttinfoInit,init ttinfo);
|
|
//INIT_COMPONENT_EXPORT(ttinfoInit);
|
|
|