fix debug mode bugs

This commit is contained in:
zhangsheng 2026-03-10 09:27:50 +08:00
parent 04c8983442
commit a31550c604
4 changed files with 20 additions and 46 deletions

View File

@ -1481,7 +1481,7 @@ std::string JsonData::JsonCmd_Cgi_67(Param_67 &param){
char whereCon[512] = {0};
char updateSql[256] = {0};
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);
uint16_t short_addr;
char *end_ptr = NULL;
@ -1495,7 +1495,7 @@ std::string JsonData::JsonCmd_Cgi_67(Param_67 &param){
char whereCon[512] = {0};
char updateSql[256] = {0};
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);
scheduler::instance().CloseDebugMode();
}

View File

@ -573,49 +573,6 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
g_mapCompress[strShortAddr] = tempchannel;
if (!strcmp(sensor_rssi, "00") || !strcmp(sensor_rssi, "0")) {
char errorInfo[100] = {0x00};
sprintf(errorInfo, "No RSSI %s", sensor_rssi);
zlog_error(zct, errorInfo);
} else {
char tableName[100] = {0x00};
char whereCon[100] = {0};
char updateSql[100] = {0};
sprintf(whereCon, "zigbeeShortAddr='%02x%02x'", UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
vec_t vecDataNodeNo = sqlite_db_ctrl::instance().GetDataSingleLine(T_SENSOR_INFO(TNAME), " MeasurementID,RSSI ", whereCon);
sprintf(tableName, "t_dataStatic_%s", (char *)vecDataNodeNo[0].c_str());
memset(whereCon,0,sizeof(whereCon));
sprintf(whereCon, "dataNodeNo='%s' order by timeStamp desc limit 1", vecDataNodeNo[0].c_str());
std::string timestamp_last = sqlite_db_ctrl::instance().GetData(tableName, " timeStamp ", whereCon);
sprintf(updateSql, "zigbeeSignalNode = '%02d' ",atoi(sensor_rssi));
memset(whereCon,0,sizeof(whereCon));
sprintf(whereCon, "dataNodeNo='%s' and timeStamp = '%s'", (char*)vecDataNodeNo[0].c_str(),timestamp_last.c_str());
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_info(zct, "compress X = %d,Y = %d,Z = %d ", tempchannel.compressChannelX, tempchannel.compressChannelY, tempchannel.compressChannelZ);
zlog_info(zct, "compress vol X = %d,vol Y = %d,vol Z = %d ", tempchannel.compressChannelVolX, tempchannel.compressChannelVolY, tempchannel.compressChannelVolZ);
zlog_info(zct, "samplerate X = %d,Y = %d,Z = %d ", tempchannel.samplerateX, tempchannel.samplerateY, tempchannel.samplerateZ);
zlog_info(zct, "samplerate vol X = %d,vol Y = %d,vol Z = %d ", tempchannel.samplerateVolX, tempchannel.samplerateVolY, tempchannel.samplerateVolZ);
return 0;
}
int Uart::DealSensorRSSI(const char *pData,uint16_t ushortAdd){
//传感器获取网关信号强度
zlog_info(zct, "DealSensorRSSI ushortAdd = %02x%02x",UINT16_HIGH(ushortAdd),UINT16_LOW(ushortAdd));
mssleep(200000);
ScheduleTask scheduleTask;
now_task = WAVE_CMD;
scheduleTask.cmd = WAVE_CMD;
scheduleTask.shortAddr = ushortAdd;
TaskResp(scheduleTask);
char localtimestamp[32] = {0};
GetTimeNet(localtimestamp, 1);
char sensor_rssi[10] = {0x00};
sprintf(sensor_rssi, "%02d", pData[7] & 0xFF);
if (!strcmp(sensor_rssi, "00") || !strcmp(sensor_rssi, "0")) {
char errorInfo[100] = {0x00};
sprintf(errorInfo, "No RSSI %s", sensor_rssi);
@ -643,9 +600,16 @@ int Uart::DealSensorRSSI(const char *pData,uint16_t ushortAdd){
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_info(zct, "compress X = %d,Y = %d,Z = %d ", tempchannel.compressChannelX, tempchannel.compressChannelY, tempchannel.compressChannelZ);
zlog_info(zct, "compress vol X = %d,vol Y = %d,vol Z = %d ", tempchannel.compressChannelVolX, tempchannel.compressChannelVolY, tempchannel.compressChannelVolZ);
zlog_info(zct, "samplerate X = %d,Y = %d,Z = %d ", tempchannel.samplerateX, tempchannel.samplerateY, tempchannel.samplerateZ);
zlog_info(zct, "samplerate vol X = %d,vol Y = %d,vol Z = %d ", tempchannel.samplerateVolX, tempchannel.samplerateVolY, tempchannel.samplerateVolZ);
return 0;
}
int Uart::DealUpgrade(uint16_t ushortAdd,int status){
char updateSql[100] = {0};

View File

@ -188,7 +188,6 @@ public:
int DealReviveDuration(uint16_t ushortAdd);
int DealConfig(uint16_t ushortAdd);
int DealWaveCompress(const char *pData,uint16_t ushortAdd);
int DealSensorRSSI(const char *pData,uint16_t ushortAdd);
int DealUpgrade(uint16_t ushortAdd,int status);
void GetLocalZigbeeRSSI(uint16_t ushortAdd);
int WaveSendCondition(char* shortAddr);

View File

@ -87,6 +87,17 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s
sprintf(updateSql,"RSSI = '%f'", comprehensiveRSSI);
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);
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){