fix debug mode bugs

This commit is contained in:
zhangsheng 2026-03-10 10:24:03 +08:00
parent 44f506de9b
commit 3770680271
6 changed files with 37 additions and 5 deletions

BIN
Cidn-SH

Binary file not shown.

View File

@ -9,6 +9,7 @@ INCLUDES = -I../Tools/GatewayThirdParty/boost/include \
-I../Tools/GatewayThirdParty/jsoncpp/include \ -I../Tools/GatewayThirdParty/jsoncpp/include \
-I../Tools/GatewayThirdParty/sqlite/include/ \ -I../Tools/GatewayThirdParty/sqlite/include/ \
-I../Tools/GatewayThirdParty/curl/include/ \ -I../Tools/GatewayThirdParty/curl/include/ \
-I../Tools/GatewayThirdParty/zlog/include/ \
-I ./ \ -I ./ \
LIBS = -L../Tools/renesas_thirdparty/lib \ LIBS = -L../Tools/renesas_thirdparty/lib \

View File

@ -1485,7 +1485,7 @@ std::string JsonData::JsonCmd_Cgi_67(Param_67 &param){
char whereCon[512] = {0}; char whereCon[512] = {0};
char updateSql[256] = {0}; char updateSql[256] = {0};
sprintf(whereCon, " MeasurementID = '%s' ", param.measurementID[i].c_str()); sprintf(whereCon, " MeasurementID = '%s' ", param.measurementID[i].c_str());
sprintf(updateSql, " status = '%d' ", 1);// 0 未调试1 调试中2 调试完成 sprintf(updateSql, " status = '%d' ", 1);// 0 未调试1 调试中2 调试完成,3 停止调试
sqlite_db_ctrl::instance().UpdateTableData("t_debug_info", updateSql, whereCon); sqlite_db_ctrl::instance().UpdateTableData("t_debug_info", updateSql, whereCon);
uint16_t short_addr; uint16_t short_addr;
char *end_ptr = NULL; char *end_ptr = NULL;
@ -1499,7 +1499,7 @@ std::string JsonData::JsonCmd_Cgi_67(Param_67 &param){
char whereCon[512] = {0}; char whereCon[512] = {0};
char updateSql[256] = {0}; char updateSql[256] = {0};
sprintf(whereCon, " status = '1' "); sprintf(whereCon, " status = '1' ");
sprintf(updateSql, " status = '%d' ", 0);// 0 未调试1 调试中2 调试完成 sprintf(updateSql, " status = '%d' ", 3);// 0 未调试1 调试中2 调试完成,3 停止调试
sqlite_db_ctrl::instance().UpdateTableData("t_debug_info", updateSql, whereCon); sqlite_db_ctrl::instance().UpdateTableData("t_debug_info", updateSql, whereCon);
scheduler::instance().CloseDebugMode(); scheduler::instance().CloseDebugMode();
} }
@ -1585,7 +1585,7 @@ std::string JsonData::JsonCmd_Cgi_69(Param_69 &param){
memset(updateSql,0,sizeof(updateSql)); memset(updateSql,0,sizeof(updateSql));
sprintf(whereCon, " MeasurementID = '%s' ", param.vecParam69[i].measurementID.c_str()); sprintf(whereCon, " MeasurementID = '%s' ", param.vecParam69[i].measurementID.c_str());
sprintf(updateSql, " status = '%d',trigerType = '%d',statisticType = '%d', threshold = '%f'",param.vecParam69[i].status,param.vecParam69[i].trigerType,param.vecParam69[i].statisticType,param.vecParam69[i].threshold); sprintf(updateSql, " status = '%d',trigerType = '%d',statisticType = '%d', threshold = '%f'",param.vecParam69[i].status,param.vecParam69[i].trigerType,param.vecParam69[i].statisticType,param.vecParam69[i].threshold);
sqlite_db_ctrl::instance().UpdateTableData(" t_waveTriger_info ", updateSql, whereCon); sqlite_db_ctrl::instance().UpdateTableData(" t_wave_triger_info ", updateSql, whereCon);
} }
} }
} else if (param.mMode == 0) { } else if (param.mMode == 0) {

View File

@ -489,7 +489,7 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
std::string productNo = res[17]; std::string productNo = res[17];
compressWaveChannel tempchannel; compressWaveChannel tempchannel;
if ((compareVersions(softVersion, "2.6") == -1 && productNo == "02") || productNo == "01"){ // DN101所有版本和DN102 2.6以前版本 if ((compareVersions(softVersion, "2.6") == -1 && productNo == "02") || productNo == "01"){ // DN101所有版本和DN102 2.6以前版本
ScheduleStatus schedule_status = scheduler::instance().GetScheduleStatus(); schedule_status = scheduler::instance().GetScheduleStatus();
if(schedule_status == kScheduleStatusDebug || schedule_status == kScheduleStatusUpgrade){ if(schedule_status == kScheduleStatusDebug || schedule_status == kScheduleStatusUpgrade){
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status); zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
scheduler::instance().WaveSuccess(ushortAdd,true); scheduler::instance().WaveSuccess(ushortAdd,true);
@ -511,7 +511,7 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
scheduler::instance().WaveSuccess(ushortAdd,true); scheduler::instance().WaveSuccess(ushortAdd,true);
return 1; return 1;
}else{ }else{
ScheduleStatus schedule_status = scheduler::instance().GetScheduleStatus(); schedule_status = scheduler::instance().GetScheduleStatus();
if(schedule_status == kScheduleStatusUpgrade){ if(schedule_status == kScheduleStatusUpgrade){
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status); zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
scheduler::instance().WaveSuccess(ushortAdd,true); scheduler::instance().WaveSuccess(ushortAdd,true);
@ -563,6 +563,15 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
memset(whereCon,0,sizeof(whereCon)); memset(whereCon,0,sizeof(whereCon));
sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str()); sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str());
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
if(schedule_status == kScheduleStatusDebug){
memset(whereCon,0,sizeof(whereCon));
memset(updateSql,0,sizeof(updateSql));
memset(tableName,0,sizeof(tableName));
sprintf(tableName, "t_debug_info");
sprintf(updateSql, " datanodeRSSI = '%s' ", sensor_rssi);
sprintf(whereCon, "shortAddr = '%02x%02x' ",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
}
} }
zlog_warn(zct, "count X = %d,Y = %d,Z = %d,vol X = %d,vol Y = %d,vol Z = %d short_add = %s", tempchannel.CountX, tempchannel.CountY, tempchannel.CountZ,tempchannel.CountVolX,tempchannel.CountVolY,tempchannel.CountVolZ,strShortAddr.c_str()); zlog_warn(zct, "count X = %d,Y = %d,Z = %d,vol X = %d,vol Y = %d,vol Z = %d short_add = %s", tempchannel.CountX, tempchannel.CountY, tempchannel.CountZ,tempchannel.CountVolX,tempchannel.CountVolY,tempchannel.CountVolZ,strShortAddr.c_str());
@ -1565,6 +1574,15 @@ int Uart::FindRecvPackage(int bytesRead, char *mUartRecvBuf, char *head) {
sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str()); sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str());
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon); sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
if(schedule_status == kScheduleStatusDebug){
memset(whereCon,0,sizeof(whereCon));
memset(updateSql,0,sizeof(updateSql));
memset(tableName,0,sizeof(tableName));
sprintf(tableName, "t_debug_info");
sprintf(updateSql, " gatewayRSSI = '%02d' ", UartRecvBuf[i+6]&0xFF);
sprintf(whereCon, "MeasurementID = '%s' ",(char*)vecDataNodeNo[0].c_str());
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
}
// zigbeeRSSIType = 1 网关获取传感器信号强度 // zigbeeRSSIType = 1 网关获取传感器信号强度

View File

@ -8,6 +8,7 @@
#include "common/global.hpp" #include "common/global.hpp"
#include "dbaccess/sql_db.hpp" #include "dbaccess/sql_db.hpp"
#include "utility/calculation.hpp" #include "utility/calculation.hpp"
#include "scheduler/status_mgr.hpp"
typedef void (*pTestRecvCallBack)(int Status); typedef void (*pTestRecvCallBack)(int Status);
@ -285,6 +286,8 @@ private:
long last_time; long last_time;
bool current_z; bool current_z;
std::map<uint16_t, std::vector<uint8_t>> map_send_data; std::map<uint16_t, std::vector<uint8_t>> map_send_data;
ScheduleStatus schedule_status;
}; };
typedef boost::container::dtl::singleton_default<Uart> uart_inst; typedef boost::container::dtl::singleton_default<Uart> uart_inst;

View File

@ -86,6 +86,16 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s
sprintf(updateSql,"RSSI = '%f'", comprehensiveRSSI); sprintf(updateSql,"RSSI = '%f'", comprehensiveRSSI);
sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon); sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon);
zlog_info(zct, "dataNodeNo='%s',zigbeeSignal=%d,zigbeeSignalNode=%d,actualRate=%f,comprehensiveRSSI=%f", strLongAddr.c_str(), zigbeeSignal, zigbeeSignalNode, actualRate, comprehensiveRSSI); zlog_info(zct, "dataNodeNo='%s',zigbeeSignal=%d,zigbeeSignalNode=%d,actualRate=%f,comprehensiveRSSI=%f", strLongAddr.c_str(), zigbeeSignal, zigbeeSignalNode, actualRate, comprehensiveRSSI);
if (schedule_status == kScheduleStatusDebug)
{
char localtimestamp[32] = { 0 };
GetTimeNet(localtimestamp, 1);
memset(updateSql,0,sizeof(updateSql));
memset(tableName,0,sizeof(tableName));
sprintf(tableName, "t_debug_info");
sprintf(updateSql, " comprehensiveRSSI = '%f',minnumVoltage = '%d',status = '2',timeStamp = '%s' ", comprehensiveRSSI,dataStatic.instantaneousBatteryVoltage,localtimestamp);
sqlite_db_ctrl::instance().UpdateTableData(tableName, updateSql, whereCon);
}
} }
} }
void Uart::DealTriger(uint16_t ushortAdd,std::string & measurementID){ void Uart::DealTriger(uint16_t ushortAdd,std::string & measurementID){