feat: 新增全功率运行时间段(FPO)功能
- bsp.h: LayoutPara_t 新增 FPOTimeStart/FPOTime 字段, 移除BOM, 声明TimeGet - main.h: 声明 IsFullPowerTime - main.c: 新增 IsFullPowerTime() 判断函数(支持跨天), 睡眠条件加FPO检查, AppInit中FPO参数初始化与校验 - SGCP.h: 新增 GWTOMD_CMD_SET_FPO=0x0A, GW_STATUS_SET_FPO 枚举, 声明 ToGWSetFPORes - SGCP.c: 实现 ToGWSetFPORes() 回应帧, GWTOMD_CMD_SET_FPO 接收处理(校验/存Flash), 两个GwRevLoopHandler新增GW_STATUS_SET_FPO case - UartDebug.c: 新增 fpocfg 调试命令(配置后向网关发送0x0A通知), para输出FPO信息, DEBUG_CMD_CNT 17->18 - bsp.c: TimeGet 去除UTC+8偏移(RTC已存本地时间)
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
#if (USE_DEBUG != 0)
|
||||
#define DEBUG_CMD_CNT 17
|
||||
#define DEBUG_CMD_CNT 18
|
||||
const DBGFunType DebugFun[DEBUG_CMD_CNT];
|
||||
|
||||
volatile DebugChannel_e gDebugChannel = DBG_CH_RS485_1;//上电默认调试口
|
||||
@@ -214,6 +214,10 @@ static void DebugCmdGetPara(int argc, char *argv[])
|
||||
DBG_LOG("Lora: ch %d, rp %d, fc %d\r\n", App.Para.Lora.ucChannel, App.Para.Lora.RegPreamble, App.Para.Lora.FreqCent);
|
||||
DBG_LOG("LpCfg: CI:%dsec, RI:%dmin, EI:%dmin, ET:%dmin\r\n",
|
||||
App.Para.Layout.CollectTime*30, App.Para.Layout.ReportInterval/2, App.Para.Layout.ERInterval/2, App.Para.Layout.ERTime/2);
|
||||
DBG_LOG("FpoCfg: Start:%02d:00, Dur:%dh, End:%02d:00, %s\r\n",
|
||||
App.Para.Layout.FPOTimeStart, App.Para.Layout.FPOTime,
|
||||
(App.Para.Layout.FPOTimeStart + App.Para.Layout.FPOTime) % 24,
|
||||
(IsFullPowerTime() == true) ? "FullPower" : "LowPower");
|
||||
DBG_LOG("Laser: %s, AutoOff: %dmin\r\n",
|
||||
(SGCP.LaserOnOff == true) ? "ON" : "OFF", SGCP.LaserTimerMinutes);
|
||||
struct tm *stime;
|
||||
@@ -739,6 +743,58 @@ static void DebugCmdLPConfig(int argc, char *argv[])
|
||||
DBG_LOG("The low-power device is configured.\r\n");
|
||||
}
|
||||
/*****************************************************************************************
|
||||
* 函数名称: DebugCmdFPOConfig
|
||||
* 功能描述: 全功率运行时间段配置
|
||||
* 参 数: argc, 输入参数数量
|
||||
argv, 输入参数
|
||||
* 返 回 值: 无
|
||||
*****************************************************************************************/
|
||||
static void DebugCmdFPOConfig(int argc, char *argv[])
|
||||
{
|
||||
DBG_LOG("\r\n");
|
||||
if(argc < 2)
|
||||
return;
|
||||
|
||||
if(strcmp(argv[1], "?") == 0) {
|
||||
DBG_LOG("Debug Cmd: fpocfg arg1 arg2\r\n");
|
||||
DBG_LOG(" brief --> Configure full-power work period.\r\n");
|
||||
DBG_LOG(" arg1 --> Full-power work start hour. (0~23 hour)\r\n");
|
||||
DBG_LOG(" arg2 --> Full-power work duration. (0~24 hour, 0=off)\r\n\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(argc < 3)
|
||||
return;
|
||||
|
||||
uint8_t FPOTimeStart = (uint8_t)atoi(argv[1]);
|
||||
uint8_t FPOTime = (uint8_t)atoi(argv[2]);
|
||||
if(FPOTimeStart > 23) {
|
||||
DBG_LOG("FPOTimeStart Para Error! (0~23)\r\n");
|
||||
return;
|
||||
}
|
||||
if(FPOTime > 24) {
|
||||
DBG_LOG("FPOTime Para Error! (0~24)\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
App.Para.Layout.FPOTimeStart = FPOTimeStart;
|
||||
App.Para.Layout.FPOTime = FPOTime;
|
||||
SAVE_APP_PARA((uint32_t *)&App.Para);
|
||||
DBG_LOG("The full-power work period is configured. Start:%02d:00, Dur:%dh, End:%02d:00\r\n",
|
||||
App.Para.Layout.FPOTimeStart, App.Para.Layout.FPOTime,
|
||||
(App.Para.Layout.FPOTimeStart + App.Para.Layout.FPOTime) % 24);
|
||||
|
||||
if(SGCP.LoginOk)
|
||||
{
|
||||
ToGWSetFPORes();
|
||||
DBG_LOG("FPO config update sent to gateway.\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_LOG("Gateway not logged in, skip sending FPO config update.\r\n");
|
||||
}
|
||||
}
|
||||
/*****************************************************************************************
|
||||
* 函数名称: DebugLaserConfig
|
||||
* 功能描述: 激光控制
|
||||
* 参 数: argc, 输入参数数量
|
||||
@@ -1062,6 +1118,16 @@ void DebugCmdHelp(int argc, char *argv[])
|
||||
}
|
||||
DebugCmdLPConfig(argc1, argv1);
|
||||
|
||||
memset(Data, 0x00, 10);
|
||||
len = strlen("fpocfg ?\0");
|
||||
memcpy(Data, "fpocfg ?\0", len);
|
||||
token = strtok(Data, " "); // 假设分隔符是空格
|
||||
for(argc1 = 0; (token != NULL && argc1 < 10); argc1++) {
|
||||
argv1[argc1] = token;
|
||||
token = strtok(NULL, " ");
|
||||
}
|
||||
DebugCmdFPOConfig(argc1, argv1);
|
||||
|
||||
memset(Data, 0x00, 10);
|
||||
len = strlen("laser ?\0");
|
||||
memcpy(Data, "laser ?\0", len);
|
||||
@@ -1134,6 +1200,7 @@ const DBGFunType DebugFun[DEBUG_CMD_CNT] = {
|
||||
"rs485", DebugCmdRS485Ctrl,
|
||||
"lora", DebugLoraConfig,
|
||||
"lpcfg", DebugCmdLPConfig,
|
||||
"fpocfg", DebugCmdFPOConfig,
|
||||
"laser", DebugLaserConfig,
|
||||
"res", DebugCmdRestoreFactory,
|
||||
"dch", DebugCmdChannel,
|
||||
|
||||
Reference in New Issue
Block a user