log2file.c 测试ok

定时发送测试ok
持续tt getinfo.c 待测试
This commit is contained in:
CSSC-WORK\murmur 2023-06-17 18:26:40 +08:00
parent 30286c7ad0
commit a8853d57b5
14 changed files with 245 additions and 130 deletions

30
.config
View File

@ -344,7 +344,7 @@ CONFIG_ULOG_OUTPUT_TAG=y
# end of log format # end of log format
CONFIG_ULOG_BACKEND_USING_CONSOLE=y CONFIG_ULOG_BACKEND_USING_CONSOLE=y
# CONFIG_ULOG_BACKEND_USING_FILE is not set CONFIG_ULOG_BACKEND_USING_FILE=y
# CONFIG_ULOG_USING_FILTER is not set # CONFIG_ULOG_USING_FILTER is not set
# CONFIG_ULOG_USING_SYSLOG is not set # CONFIG_ULOG_USING_SYSLOG is not set
# CONFIG_RT_USING_UTEST is not set # CONFIG_RT_USING_UTEST is not set
@ -574,27 +574,7 @@ CONFIG_PKG_CJSON_VER="v1.7.15"
# #
# tools packages # tools packages
# #
CONFIG_PKG_USING_CMBACKTRACE=y # CONFIG_PKG_USING_CMBACKTRACE is not set
# CONFIG_PKG_CMBACKTRACE_PLATFORM_M0_M0PLUS is not set
# CONFIG_PKG_CMBACKTRACE_PLATFORM_M3 is not set
CONFIG_PKG_CMBACKTRACE_PLATFORM_M4=y
# CONFIG_PKG_CMBACKTRACE_PLATFORM_M7 is not set
# CONFIG_PKG_CMBACKTRACE_PLATFORM_M33 is not set
# CONFIG_PKG_CMBACKTRACE_PLATFORM_NOT_SELECTED is not set
CONFIG_PKG_CMBACKTRACE_DUMP_STACK=y
# CONFIG_PKG_CMBACKTRACE_PRINT_ENGLISH is not set
# CONFIG_PKG_CMBACKTRACE_PRINT_CHINESE is not set
CONFIG_PKG_CMBACKTRACE_PRINT_CHINESE_UTF8=y
# CONFIG_CMB_USING_FAL_FLASH_LOG is not set
CONFIG_PKG_CMBACKTRACE_PATH="/packages/tools/CmBacktrace"
CONFIG_PKG_USING_CMBACKTRACE_V10401=y
# CONFIG_PKG_USING_CMBACKTRACE_V10400 is not set
# CONFIG_PKG_USING_CMBACKTRACE_V10300 is not set
# CONFIG_PKG_USING_CMBACKTRACE_V10202 is not set
# CONFIG_PKG_USING_CMBACKTRACE_V10200 is not set
# CONFIG_PKG_USING_CMBACKTRACE_LATEST_VERSION is not set
CONFIG_PKG_CMBACKTRACE_VER="v1.4.1"
CONFIG_PKG_CMBACKTRACE_VER_NUM=0x10401
# CONFIG_PKG_USING_EASYFLASH is not set # CONFIG_PKG_USING_EASYFLASH is not set
# CONFIG_PKG_USING_EASYLOGGER is not set # CONFIG_PKG_USING_EASYLOGGER is not set
# CONFIG_PKG_USING_SYSTEMVIEW is not set # CONFIG_PKG_USING_SYSTEMVIEW is not set
@ -719,9 +699,9 @@ CONFIG_PKG_SYSWATCH_VER="latest"
# CONFIG_PKG_USING_RAMDISK is not set # CONFIG_PKG_USING_RAMDISK is not set
CONFIG_PKG_USING_MININI=y CONFIG_PKG_USING_MININI=y
CONFIG_PKG_MININI_PATH="/packages/system/minIni" CONFIG_PKG_MININI_PATH="/packages/system/minIni"
CONFIG_PKG_USING_MININI_V120=y # CONFIG_PKG_USING_MININI_V120 is not set
# CONFIG_PKG_USING_MININI_LATEST_VERSION is not set CONFIG_PKG_USING_MININI_LATEST_VERSION=y
CONFIG_PKG_MININI_VER="v1.2.0" CONFIG_PKG_MININI_VER="latest"
# CONFIG_PKG_USING_QBOOT is not set # CONFIG_PKG_USING_QBOOT is not set
# CONFIG_PKG_USING_PPOOL is not set # CONFIG_PKG_USING_PPOOL is not set
# CONFIG_PKG_USING_OPENAMP is not set # CONFIG_PKG_USING_OPENAMP is not set

View File

@ -7,7 +7,8 @@
* Date Author Notes * Date Author Notes
* 2023-05-29 murmur the first version * 2023-05-29 murmur the first version
*/ */
#include "../packages/minIni-v1.2.0/dev/minIni.h" //#include "../packages/minIni-v1.2.0/dev/minIni.h"
#include "minIni.h"
#ifdef PKG_USING_MININI #ifdef PKG_USING_MININI
#define LJW_CFG_FILE_NAME "/cfg/cfg.ini" #define LJW_CFG_FILE_NAME "/cfg/cfg.ini"

View File

@ -1,5 +1,5 @@
[config] [config]
# V1.4 # V1.5
#发送间隔M以零点为基准时刻 #发送间隔M以零点为基准时刻
sendInterval=60 sendInterval=60
# 用于保存串口数据的单文件最大值Byte # 用于保存串口数据的单文件最大值Byte
@ -17,7 +17,7 @@ maxTTRetryCnt=3
# TT最低信号值 # TT最低信号值
minTTsinal=5 minTTsinal=5
# TT状态检测周期数 # TT状态检测周期数
minTTPeriCnt=5 minTTPeriCnt=2
compressType=1 compressType=1
encrytType=1 encrytType=1
# 开窗时间UTC+8,持续时间H。支持多组组与组之间采用【;】为分隔符 # 开窗时间UTC+8,持续时间H。支持多组组与组之间采用【;】为分隔符
@ -40,6 +40,11 @@ minActiveTime=0
maxActiveTime=0 maxActiveTime=0
# 平均激活时间,暂不考虑实现 # 平均激活时间,暂不考虑实现
meanActiveTime=0 meanActiveTime=0
# 总定时器超时次数
allCnt=0
# 发送成功次数
okCnt=0
[tosend] [tosend]
# 文件名=待发包。值为0表示全发。 # 文件名=待发包。值为0表示全发。
2023_05_22_11_27_12_245.txt=12 2023_05_22_11_27_12_245.txt=12

View File

@ -1,7 +1,7 @@
#include <board.h>
#include <rtthread.h> #include <rtthread.h>
//#include <../packages/webclient-v2.2.0/inc/webclient.h> //#include <../packages/webclient-v2.2.0/inc/webclient.h>
#include <webclient.h> #include <webclient.h>
@ -29,11 +29,7 @@
//#include <string.h> //#include <string.h>
char *infoH[] = { TT_SIM, TT_XH, TT_RW, TT_JH, TT_DW}; char *infoH[] = { TT_SIM, TT_XH, TT_RW, TT_JH, TT_DW};
//typedef struct
//{
// rt_uint8_t cnt;
// rt_uint8_t s;
//} CFG;
typedef struct typedef struct
{ {
@ -53,7 +49,7 @@ typedef struct
// char *ele; // 高度 // char *ele; // 高度
}TT; }TT;
TT tmp={.sim="0",.xh="0",.jh="0",.jd=":0.000000",.wd=":0.000000",.ele=":0.000000"}; TT tmp={.sim="-",.xh="-",.jh="-",.jd=":0.000000",.wd=":0.000000",.ele=":0.000000"};
//memset(&tmp,0x00,sizeof(TT)); //memset(&tmp,0x00,sizeof(TT));
TT *TTinfo=&tmp; TT *TTinfo=&tmp;
static rt_tick_t bootstamp=0; static rt_tick_t bootstamp=0;
@ -106,6 +102,7 @@ static int minActiveTime=0;
static int maxActiveTime=0; static int maxActiveTime=0;
//extern struct rt_event sw_check;//软件条件 //extern struct rt_event sw_check;//软件条件
extern void upTTflag(void); extern void upTTflag(void);
extern void upTTflagtmp(void);//临时demo
static void updatecfg() static void updatecfg()
{ {
minTTsinal = get_cfg("minTTsinal"); minTTsinal = get_cfg("minTTsinal");
@ -165,6 +162,7 @@ static void rulecheck(void)
//TT具备发送条件 //TT具备发送条件
// rt_event_send(&sw_check, TT_IS_OK); // rt_event_send(&sw_check, TT_IS_OK);
upTTflag(); upTTflag();
upTTflagtmp();
LOG_D("符合规则TT具备发送状态。"); LOG_D("符合规则TT具备发送状态。");
// updateSta(); // updateSta();
okCnt = minTTPeriCnt -1; okCnt = minTTPeriCnt -1;
@ -311,6 +309,12 @@ void getTTinfo_thread_entry(void* parameter)
} }
if (webclient_get_data(url) != RT_EOK) if (webclient_get_data(url) != RT_EOK)
{ {
strcpy(TTinfo->sim,"-");
strcpy(TTinfo->xh,"-");
strcpy(TTinfo->jh,"-");
strcpy(TTinfo->jd,"-");
strcpy(TTinfo->wd,"-");
strcpy(TTinfo->ele,"-");
break; break;
} }
web_free(url); web_free(url);
@ -348,9 +352,6 @@ void getTT(int argc, char **argv)
cfg.s = atoi(argv[2]); cfg.s = atoi(argv[2]);
} }
// LOG_D("cnt-%d",cfg.cnt);
// LOG_D("s-%d",cfg.s);
/* 创建 serial 线程 */ /* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("getTT", getTTinfo_thread_entry, (void *) &cfg, 1024 * 3, 25, 10); rt_thread_t thread = rt_thread_create("getTT", getTTinfo_thread_entry, (void *) &cfg, 1024 * 3, 25, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
@ -365,13 +366,63 @@ void getTT(int argc, char **argv)
return RT_ERROR; return RT_ERROR;
} }
// 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);
} }
/* 导出到自动初始化 */ /* 导出到自动初始化 */
MSH_CMD_EXPORT(getTT, "getTT 3 1" means try 3 times with 1 second interval.); MSH_CMD_EXPORT(getTT, "getTT 3 1" means try 3 times with 1 second interval.);
//MSH_CMD_EXPORT_ALIAS(webclient_get_data, gTTinfo, GET info of TT server.); //MSH_CMD_EXPORT_ALIAS(webclient_get_data, gTTinfo, GET info of TT server.);
int isTTon(void)
{
return !rt_pin_read(TT_EN);
}
void repGetTT_thread_entry(void* parameter)
{
while(!isTTon())//第一次运行时未上电则等待
{}
while(isTTon())//中间未上电则退出
{
for (size_t var = 0; var < (sizeof(infoH) / sizeof(infoH[0])); var++) //轮询每个参数
{
static char *url = RT_NULL;
url = web_strdup(*(infoH + var));
if (url == RT_NULL)
{
LOG_E("no memory for create getTT url buffer.\n");
// return -RT_ENOMEM;
}
if (webclient_get_data(url) != RT_EOK)
{
strcpy(TTinfo->sim,"-");
strcpy(TTinfo->xh,"-");
strcpy(TTinfo->jh,"-");
strcpy(TTinfo->jd,"-");
strcpy(TTinfo->wd,"-");
strcpy(TTinfo->ele,"-");
break;
}
web_free(url);
rt_thread_mdelay(100);
}
rulecheck();
rt_thread_mdelay(3 * 1000);//间隔3s更新一次数据
}
}
void repGetTT()
{
/* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("repGetTT", repGetTT_thread_entry, RT_NULL, 1024 * 3, 25, 10);
/* 创建成功则启动线程 */
if (thread != RT_NULL)
{
rt_thread_startup(thread);
// rt_kprintf("done");
}
else
{
LOG_E("thread 'repGetTT' create failure.");
return RT_ERROR;
}
}

72
applications/log2file.c Normal file
View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-06-16 murmur the first version
*/
#include <..\rt-thread\components\utilities\ulog\backend\ulog_be.h>
/*
*
*/
struct _log_file
{
const char *name; //文件名
ulog_backend_t backend;
struct ulog_file_be *file_be;
const char *dir_path; //保存路径
rt_size_t max_num; //保存最大文件数量
rt_size_t max_size; //保存最大文件大小
rt_size_t buf_size; //文件保存缓存大小
};
/*
*
*/
typedef enum
{
console_id,
sys_id,
motion_id,
}ulog_file_be_name;
#define ROOT_PATH "/log" //设置保存路径
#define FILE_SIZE 512 * 1024 //设置单个文件大小
#define BUFF_SIZE 512 //设备缓存区大小
static struct ulog_backend sys_log_backend;
static struct ulog_file_be sys_log_file;
static struct _log_file table[] =
{
{"motion" ,ROOT_PATH,5,FILE_SIZE,BUFF_SIZE},
{"sys" ,&sys_log_backend,&sys_log_file,ROOT_PATH,10,FILE_SIZE,BUFF_SIZE},
};
/* Private function prototypes -----------------------------------------------*/
/**
* @brief .
* @param None.
* @retval None.
* @note None.
*/
void sys_log_file_backend_init(void)
{
struct ulog_file_be *file_be = &sys_log_file;
uint8_t id = sys_id;
file_be->parent = sys_log_backend;
ulog_file_backend_init( file_be,
table[id].name,
table[id].dir_path,
table[id].max_num,
table[id].max_size,
table[id].buf_size);
ulog_file_backend_enable(file_be); //必须使能才能有效
}
MSH_CMD_EXPORT(sys_log_file_backend_init,log2file);
//INIT_APP_EXPORT(sys_log_file_backend_init);

View File

@ -18,8 +18,6 @@
//#include <cfg.h> //#include <cfg.h>
//static rt_uint8_t d[35][200] = { };
//static rt_uint8_t s[35] = { };
void pfdemo(void) void pfdemo(void)
{ {
// #define cmb_println(...) rt_kprintf(__VA_ARGS__);rt_kprintf("\r\n"); // #define cmb_println(...) rt_kprintf(__VA_ARGS__);rt_kprintf("\r\n");
@ -62,25 +60,11 @@ int main(void)
rt_pin_mode(TT_EN, PIN_MODE_OUTPUT); rt_pin_mode(TT_EN, PIN_MODE_OUTPUT);
// rt_pin_write(ETH_RESET_PIN, PIN_LOW);//关闭ETH // rt_pin_write(ETH_RESET_PIN, PIN_LOW);//关闭ETH
rt_pin_write(TT_EN, PIN_HIGH);//关闭TT // rt_pin_write(TT_EN, PIN_HIGH);//关闭TT
// rt_err_t ret = RT_EOK;
/* 设 置 日 期 */
// ret = set_date(2018, 12, 3);
// if (ret != RT_EOK)
// {
// rt_kprintf("set RTC date failed\n");
// return ret;
// }
// /* 设 置 时 间 */
// ret = set_time(11, 15, 50);
// if (ret != RT_EOK)
// {
// rt_kprintf("set RTC time failed\n");
//// return ret;
// }
// rt_kprintf("%d ms since boot.\n",rt_tick_get_millisecond());
while (1) while (1)
{ {
/* 拉低PIN脚 */ /* 拉低PIN脚 */

View File

@ -11,17 +11,20 @@
#include <rtthread.h> #include <rtthread.h>
#define LOG_TAG "repeadSend" #define LOG_TAG "repeatSend"
#define LOG_LVL LOG_LVL_DBG #define LOG_LVL LOG_LVL_DBG
#include <ulog.h> #include <ulog.h>
#include <ttTR.h> #include <ttTR.h>
#include <usrcfg.h>
/* 定时器的控制块 */ /* 定时器的控制块 */
static rt_timer_t timer1; static rt_timer_t timer1;
static struct rt_event readyToSend; static struct rt_event readyToSend;
#define TIME_IS_UP 1<<1 #define TIME_IS_UP 1<<1
void upTTflagtmp(void)
{
rt_event_send(&readyToSend, TT_IS_OK);
}
void repeatSend_thread_entry() void repeatSend_thread_entry()
{ {
while (1) while (1)
@ -29,22 +32,37 @@ void repeatSend_thread_entry()
if (rt_event_recv(&readyToSend, TIME_IS_UP, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER, if (rt_event_recv(&readyToSend, TIME_IS_UP, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, RT_WAITING_FOREVER,
RT_NULL) == RT_EOK) RT_NULL) == RT_EOK)
{ {
char *f = "2023_06_16_10_28_00_123.bin"; //记录次数
//此次数为总定时超时次数
add_val("allCnt");
if (rt_event_recv(&readyToSend, TT_IS_OK, RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
rt_tick_from_millisecond(1 * 60 * 1000),
RT_NULL) == RT_EOK)
{
LOG_D("TT is ready.");
char *f = "2023_06_17_16_30_00_000.bin";
static rt_uint8_t d[30][200] = { }; static rt_uint8_t d[30][200] = { };
static rt_uint8_t s[30] = { }; static rt_uint8_t s[30] = { };
rt_uint8_t len = 0; rt_uint8_t len = 0;
len = pack_File(f, 0, d, s); len = pack_File(f, 0, d, s);
if (len && (tcpInit() == RT_EOK)) if (len && (tcpInit() == RT_EOK))
{ {
// rt_event_send(&tcp_chk, TT_TCP_OK);
for (size_t var = 0; var < len; var++) for (size_t var = 0; var < len; var++)
{ {
sendMsg(d[var], s[var]); sendMsg(d[var], s[var]);
// LOG_D("i = %d", var); rt_thread_mdelay(1000);
LOG_HEX("d", 27, d[var], s[var]); // LOG_HEX("d", 27, d[var], s[var]);
} }
tcpClose(); tcpClose();
LOG_I("Done."); LOG_I("send msg Done.");
//记录次数
//此次数为发送成功次数
add_val("okCnt");
}
}
else
{
LOG_W("TT is not ready.");
} }
} }
} }
@ -53,7 +71,7 @@ void repeatSend_thread_entry()
static void timeout1(void *parameter) static void timeout1(void *parameter)
{ {
LOG_D("定时时间到,开始发送数据"); LOG_D("定时时间到,准备发送数据");
rt_event_send(&readyToSend, TIME_IS_UP); rt_event_send(&readyToSend, TIME_IS_UP);
} }
@ -64,8 +82,8 @@ void repeatSend_thread_entry()
void timer_demo() void timer_demo()
{ {
/* 创建定时器1 周期定时器 */ /* 创建定时器1 周期定时器 */
timer1 = rt_timer_create("repeadSendtimer", timeout1, timer1 = rt_timer_create("repeatSendtimer", timeout1,
RT_NULL, rt_tick_from_millisecond(30*1000), RT_NULL, rt_tick_from_millisecond(1*60*1000),
RT_TIMER_FLAG_PERIODIC); RT_TIMER_FLAG_PERIODIC);
/* 启动定时器1 */ /* 启动定时器1 */
@ -74,7 +92,7 @@ void repeatSend_thread_entry()
// rt_err_t result = rt_event_init(&readyToSend, "readyToSend", RT_IPC_FLAG_PRIO); // rt_err_t result = rt_event_init(&readyToSend, "readyToSend", RT_IPC_FLAG_PRIO);
/* 创建 serial 线程 */ /* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("send", repeatSend_thread_entry, RT_NULL, 1024*1, 25+1, 10); rt_thread_t thread = rt_thread_create("repsendT", repeatSend_thread_entry, RT_NULL, 1024*3, 25+1, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
if (thread != RT_NULL) if (thread != RT_NULL)
{ {
@ -88,6 +106,16 @@ void repeatSend_thread_entry()
MSH_CMD_EXPORT(timer_demo,) MSH_CMD_EXPORT(timer_demo,)
void inievt() void inievt()
{ {
rt_err_t result = rt_event_init(&readyToSend, "readyToSend", RT_IPC_FLAG_PRIO);
pwTT_thread_entry("1");
rt_err_t result = rt_event_init(&readyToSend, "repSend", RT_IPC_FLAG_PRIO);
rt_hw_stm32_eth_init();//激活网口
} }
INIT_APP_EXPORT(inievt); INIT_APP_EXPORT(inievt);
INIT_APP_EXPORT(timer_demo);
MSH_CMD_EXPORT(upTTflagtmp,);

View File

@ -121,25 +121,25 @@ MSH_CMD_EXPORT(hexFile,以HEX方式显示文件内容);
*/ */
int time2Str(char *str) int time2Str(char *str)
{ {
struct tm *tm, tm_tmp; // struct tm *tm, tm_tmp;
time_t now = time(RT_NULL); // time_t now = time(RT_NULL);
time_t t = (time_t)0; // time_t t = (time_t)0;
if (gettimeofday(&now, RT_NULL) >= 0)
{
// t = now.tv_sec;
}
tm = localtime_r(&t, &tm_tmp);
// static time_t now;
// static struct tm *tm, tm_tmp;
// //
// now = time(RT_NULL); // if (gettimeofday(&now, RT_NULL) >= 0)
// tm = gmtime_r(&now, &tm_tmp); // {
//// t = now.tv_sec;
// }
// tm = localtime_r(&t, &tm_tmp);
static time_t now;
static struct tm *tm, tm_tmp;
now = time(RT_NULL);
tm = localtime_r(&now, &tm_tmp);
/* show the time format MM-DD HH:MM:SS */ /* show the time format MM-DD HH:MM:SS */
size_t len = rt_snprintf(str, 20, "%04d_%02d_%02d_%02d_%02d_%02d_%03d", tm->tm_year, tm->tm_mon, size_t len = rt_snprintf(str, 30, "%04d_%02d_%02d_%02d_%02d_%02d_%03d", 2000+tm->tm_year-100, tm->tm_mon+1,
tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,tm->tm_sec);
str[len]='\0'; str[len]='\0';
return len; return len;
@ -148,8 +148,13 @@ int time2Str(char *str)
void tm2str(int argc, char **argv)
{
char s[30];
time2Str(s);
LOG_I("-is %s",s);
}
MSH_CMD_EXPORT(tm2str,)
void sDemo() void sDemo()
{ {

View File

@ -518,7 +518,7 @@ MSH_CMD_EXPORT(pmsg, 打包文件。);
void pwTT_thread_entry(void *parameter) void pwTT_thread_entry(void *parameter)
{ {
// LOG_I("--%s--",parameter); // LOG_I("--%s--",parameter);
if (strcmp(parameter,"NULL")==0)//无参数 if (strcmp(parameter,"NULL")==0)//无参数,状态翻转
{ {
// LOG_I("null"); // LOG_I("null");
int f = rt_pin_read(TT_EN); int f = rt_pin_read(TT_EN);
@ -526,9 +526,9 @@ void pwTT_thread_entry(void *parameter)
} }
else else
{ {
rt_bool_t flag = (rt_bool_t) atoi(parameter); rt_bool_t flag = !(rt_bool_t) atoi(parameter);
if ((rt_bool_t)rt_pin_read(TT_EN) != flag) {//目标状态与当前状态一致才响应 if ((rt_bool_t)rt_pin_read(TT_EN) != flag) {//目标状态与当前状态一致才响应
rt_pin_write(TT_EN, flag); rt_pin_write(TT_EN, flag);//
} }
} }
@ -536,13 +536,13 @@ void pwTT_thread_entry(void *parameter)
if (rt_pin_read(TT_EN))//检查设置后状态 if (rt_pin_read(TT_EN))//检查设置后状态
{ {
//#ifdef NO_RELAY //#ifdef NO_RELAY
LOG_I("set TT %s", "OFF"); LOG_I("set TT %s", "OFF");//高电平关断
//#endif //#endif
add_val("swCnt");//更新统计值 add_val("swCnt");//更新统计值
} }
else else
{ {
LOG_I("set TT %s", "ON"); LOG_I("set TT %s", "ON");//低电平开启
} }
} }
@ -592,7 +592,7 @@ void recTT_thread_entry()
static void recTT(void) static void recTT(void)
{ {
/* 创建 serial 线程 */ /* 创建线程 */
rt_thread_t thread = rt_thread_create("recTT", recTT_thread_entry, RT_NULL, 1024 * 12, 27, 10); rt_thread_t thread = rt_thread_create("recTT", recTT_thread_entry, RT_NULL, 1024 * 12, 27, 10);
/* 创建成功则启动线程 */ /* 创建成功则启动线程 */
if (thread != RT_NULL) if (thread != RT_NULL)

View File

@ -174,7 +174,7 @@ static int uart_dma_sample(int argc, char *argv[])
/* 创建定时器1 周期定时器 */ /* 创建定时器1 周期定时器 */
timer1 = rt_timer_create("rxtimer", timeout1, timer1 = rt_timer_create("rxtimer", timeout1,
RT_NULL, 60, RT_NULL, rt_tick_from_millisecond(40*1000),
RT_TIMER_FLAG_PERIODIC); RT_TIMER_FLAG_PERIODIC);

View File

@ -23,6 +23,7 @@ typedef struct
{ {
rt_uint8_t cnt; rt_uint8_t cnt;
rt_uint8_t s; rt_uint8_t s;
rt_uint8_t repeat;
} CFG; } CFG;

View File

@ -23,6 +23,7 @@
int rt_hw_spi_flash_init(void) int rt_hw_spi_flash_init(void)
{ {
rt_kprintf("SW Version: %s\n","1.3(temp)");
__HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE();
// __HAL_RCC_GPIOD_CLK_ENABLE(); // __HAL_RCC_GPIOD_CLK_ENABLE();
// rt_kprintf("sfud success.\n"); // rt_kprintf("sfud success.\n");
@ -34,10 +35,7 @@ int rt_hw_spi_flash_init(void)
rt_kprintf("sfud error.\n"); rt_kprintf("sfud error.\n");
return -RT_ERROR; return -RT_ERROR;
}; };
// rt_kprintf("--%d.\n",rt_tick_get_millisecond()-t); // rt_kprintf("sfud success.\n");
// rt_device_register(&(rtt_dev->flash_device), "W25Q128", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE);
rt_kprintf("sfud success.\n");
return RT_EOK; return RT_EOK;
} }
/* 导出到自动初始化 */ /* 导出到自动初始化 */
@ -51,7 +49,7 @@ void w25q128_mount(void)
dev = rt_device_find("W25Q128"); dev = rt_device_find("W25Q128");
if(dev != RT_NULL) { if(dev != RT_NULL) {
if(dfs_mount("W25Q128", "/", "elm", 0, 0) == 0){ if(dfs_mount("W25Q128", "/", "elm", 0, 0) == 0){
rt_kprintf("spi_flash mount to spi!\n"); // rt_kprintf("spi_flash mount to spi!\n");
} else { } else {
rt_kprintf("spi_flash mount to spi failed!\n"); rt_kprintf("spi_flash mount to spi failed!\n");
} }

View File

@ -9,11 +9,6 @@
"ver": "v1.7.15", "ver": "v1.7.15",
"name": "CJSON" "name": "CJSON"
}, },
{
"path": "/packages/tools/CmBacktrace",
"ver": "v1.4.1",
"name": "CMBACKTRACE"
},
{ {
"path": "/packages/system/syswatch", "path": "/packages/system/syswatch",
"ver": "latest", "ver": "latest",
@ -21,7 +16,7 @@
}, },
{ {
"path": "/packages/system/minIni", "path": "/packages/system/minIni",
"ver": "v1.2.0", "ver": "latest",
"name": "MININI" "name": "MININI"
}, },
{ {

View File

@ -49,7 +49,7 @@
#define RT_USING_DEVICE #define RT_USING_DEVICE
#define RT_USING_CONSOLE #define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLEBUF_SIZE 256
#define RT_CONSOLE_DEVICE_NAME "uart1" #define RT_CONSOLE_DEVICE_NAME "uart3"
/* end of Kernel Device Object */ /* end of Kernel Device Object */
#define RT_VER_NUM 0x40101 #define RT_VER_NUM 0x40101
/* end of RT-Thread Kernel */ /* end of RT-Thread Kernel */
@ -62,14 +62,14 @@
#define RT_USING_COMPONENTS_INIT #define RT_USING_COMPONENTS_INIT
#define RT_USING_USER_MAIN #define RT_USING_USER_MAIN
#define RT_MAIN_THREAD_STACK_SIZE 2048*2 #define RT_MAIN_THREAD_STACK_SIZE 2048
#define RT_MAIN_THREAD_PRIORITY 10 #define RT_MAIN_THREAD_PRIORITY 10
#define RT_USING_MSH #define RT_USING_MSH
#define RT_USING_FINSH #define RT_USING_FINSH
#define FINSH_USING_MSH #define FINSH_USING_MSH
#define FINSH_THREAD_NAME "tshell" #define FINSH_THREAD_NAME "tshell"
#define FINSH_THREAD_PRIORITY 30 #define FINSH_THREAD_PRIORITY 20
#define FINSH_THREAD_STACK_SIZE 4096*2 #define FINSH_THREAD_STACK_SIZE 4096
#define FINSH_USING_HISTORY #define FINSH_USING_HISTORY
#define FINSH_HISTORY_LINES 5 #define FINSH_HISTORY_LINES 5
#define FINSH_USING_SYMTAB #define FINSH_USING_SYMTAB
@ -207,6 +207,7 @@
#define ULOG_OUTPUT_TAG #define ULOG_OUTPUT_TAG
/* end of log format */ /* end of log format */
#define ULOG_BACKEND_USING_CONSOLE #define ULOG_BACKEND_USING_CONSOLE
#define ULOG_BACKEND_USING_FILE
/* end of Utilities */ /* end of Utilities */
/* end of RT-Thread Components */ /* end of RT-Thread Components */
@ -269,12 +270,6 @@
/* tools packages */ /* tools packages */
//#define PKG_USING_CMBACKTRACE
//#define PKG_CMBACKTRACE_PLATFORM_M4
//#define PKG_CMBACKTRACE_DUMP_STACK
//#define PKG_CMBACKTRACE_PRINT_CHINESE_UTF8
//#define PKG_USING_CMBACKTRACE_V10401
//#define PKG_CMBACKTRACE_VER_NUM 0x10401
/* end of tools packages */ /* end of tools packages */
/* system packages */ /* system packages */
@ -307,7 +302,7 @@
#define SYSWATCH_WDT_TIMEOUT 5 #define SYSWATCH_WDT_TIMEOUT 5
#define PKG_USING_SYSWATCH_LATEST_VERSION #define PKG_USING_SYSWATCH_LATEST_VERSION
#define PKG_USING_MININI #define PKG_USING_MININI
#define PKG_USING_MININI_V120 #define PKG_USING_MININI_LATEST_VERSION
/* end of system packages */ /* end of system packages */
/* peripheral libraries and drivers */ /* peripheral libraries and drivers */