modify bugs
This commit is contained in:
parent
8ade412b42
commit
0fd318e05c
@ -333,9 +333,9 @@ std::string JsonData::JsonCmd_Cgi_10(Param_10 ¶m) {
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
|
||||
if (param.timeEnd == "") {
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' and nodeResend = 0 order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), 550, packgeNum);
|
||||
} else {
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
sprintf(whereCon, "channelID like '%%%s%%' and %s <> '' and nodeResend = 0 and timeStamp < '%s' and timeStamp > '%s' order by timeStamp asc LIMIT %d OFFSET %d", param.MeasurementID.c_str(), param.strStatic.c_str(), param.timeEnd.c_str(), param.timeStart.c_str(), 550, packgeNum);
|
||||
}
|
||||
array_t vecRes;
|
||||
|
||||
|
||||
@ -495,7 +495,8 @@ int SensorScheduler::GetNextDuration(uint16_t short_addr, bool &z, int &next_tas
|
||||
duration = 120;
|
||||
return duration;
|
||||
}
|
||||
zlog_debug(zbt, "[Nxt] [%d:%x] next duration is %d", id, short_addr, duration);
|
||||
zlog_debug(zbt, "[Nxt] [%d:%x] next duration is %d,next_task_id = %d,z = %d,ScheduleStatus = %d", id, short_addr, duration,next_task_id,z,GetScheduleStatus());
|
||||
|
||||
return duration;
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,6 @@ void CheckThread() {
|
||||
gpio_set(GlobalConfig::GPIO_G.commPower,1);
|
||||
zlog_warn(zct,"commPower End\n");
|
||||
sleep(2);
|
||||
char localtimestamp[32] = { 0 };
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
memset(insertSql,0,sizeof(insertSql));
|
||||
sprintf(insertSql, " '2','4G module reset','%s'",localtimestamp);
|
||||
@ -104,7 +103,6 @@ void CheckThread() {
|
||||
sleep(2);
|
||||
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
||||
zlog_warn(zct, "commPower End");
|
||||
char localtimestamp[32] = { 0 };
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
memset(insertSql,0,sizeof(insertSql));
|
||||
sprintf(insertSql, " '2','5G module reset','%s'",localtimestamp);
|
||||
@ -129,7 +127,6 @@ void CheckThread() {
|
||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
||||
sleep(5);
|
||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
||||
char localtimestamp[32] = { 0 };
|
||||
GetTimeNet(localtimestamp, 1);
|
||||
memset(insertSql,0,sizeof(insertSql));
|
||||
sprintf(insertSql, " '2','WiFi module reset','%s'",localtimestamp);
|
||||
|
||||
@ -379,7 +379,6 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
ScheduleTask scheduleTask;
|
||||
bool z = false;
|
||||
//taskID = scheduler::instance().StartSchedule(ushortAdd,next_duration,z, next_task_id);
|
||||
current_z = z;
|
||||
if (scheduler::instance().StartSchedule(ushortAdd,next_duration_,z, next_task_id) == kScheduleConfigSensor)
|
||||
{
|
||||
scheduleTask.cmd = CONFIG;
|
||||
@ -390,6 +389,7 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
mssleep(50000);
|
||||
UpdateConfig(ushortAdd);
|
||||
}
|
||||
current_z = z;
|
||||
uint16_t next_duration = scheduler::instance().GetNextDuration(ushortAdd,z,next_task_id);
|
||||
zlog_info(zct, "taskID = %d next_duration = %d next_task_id = %d,current_z = %d", taskID, next_duration, next_task_id,current_z);
|
||||
|
||||
@ -397,7 +397,7 @@ int Uart::DealAskTask(uint16_t ushortAdd){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.z = z;
|
||||
scheduleTask.z = current_z;
|
||||
scheduleTask.next_taskID = WAVE_CMD;
|
||||
TaskResp(scheduleTask);
|
||||
}else if (next_task_id == kScheduleEigenValue) {
|
||||
@ -459,6 +459,7 @@ int Uart::DealReviveDuration(uint16_t ushortAdd){
|
||||
scheduleTask.cmd = REVIVE_DURATION;
|
||||
scheduleTask.shortAddr = ushortAdd;
|
||||
scheduleTask.duration = next_duration;
|
||||
scheduleTask.z = z;
|
||||
scheduleTask.next_taskID = next_taskID & 0xFF;
|
||||
TaskResp(scheduleTask);
|
||||
return 0;
|
||||
@ -476,6 +477,11 @@ int Uart::DealConfig(uint16_t ushortAdd){
|
||||
}
|
||||
// 判断综合信号强度,低电量,停机状态,任一条件满足都不调度波形
|
||||
int Uart::WaveSendCondition(char* shortAddr){
|
||||
if (schedule_status == kScheduleStatusDebug)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lowSignal = -1, signalThreshold = -1, lowBatteryLevel = -1, batteryLevelThreshold = -1;
|
||||
char whereCon[100] = {0};
|
||||
std::string effect = "",rssi = "",batteryPower = "";
|
||||
@ -517,8 +523,8 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
|
||||
std::string softVersion = res[9];
|
||||
std::string productNo = res[17];
|
||||
compressWaveChannel tempchannel;
|
||||
schedule_status = scheduler::instance().GetScheduleStatus();
|
||||
if ((compareVersions(softVersion, "2.6") == -1 && productNo == "02") || productNo == "01"){ // DN101所有版本和DN102 2.6以前版本
|
||||
schedule_status = scheduler::instance().GetScheduleStatus();
|
||||
if(schedule_status == kScheduleStatusDebug || schedule_status == kScheduleStatusUpgrade){
|
||||
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
|
||||
scheduler::instance().WaveSuccess(ushortAdd,true);
|
||||
@ -541,7 +547,6 @@ int Uart::DealWaveCompress(const char *pData,uint16_t ushortAdd){
|
||||
scheduler::instance().WaveSuccess(ushortAdd,true);
|
||||
return 1;
|
||||
}else{
|
||||
schedule_status = scheduler::instance().GetScheduleStatus();
|
||||
if(schedule_status == kScheduleStatusUpgrade){
|
||||
zlog_warn(zct, "ScheduleStatus not meet condition ,shortAddr = %s,schedule_status = %d",shortAdd,schedule_status);
|
||||
scheduler::instance().WaveSuccess(ushortAdd,true);
|
||||
@ -1132,12 +1137,12 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
||||
StaticTime = '%d',WaveTime = '%d',BateryV = '%d',ProductNo = '%s',configFlag = '%d',startBrands = '%s',\
|
||||
stopBrands = '%s',featureInterVal = '%u',waveInterVal = '%d',samplingRate = '%d',scope = '%s',range = '%d',envelopeBandPass = '%s',faultFrequency = '%s',\
|
||||
zigbeePanId = '%s',zigbeeChannel = '%d',zigbeeShortAddr = '%s',zigbeeLongAddr = '%s',zigbeeDesAddr = '%s',\
|
||||
ZigbeePower = '%d',ZigbeeRetry = '%d',ZigbeeRetryGap = '%d',ACCSampleTime = '%d',status = '%s',timeStamp = '%s',viff = '%d',RSSI = '0,%d',UpdateFlag = 1",
|
||||
ZigbeePower = '%d',ZigbeeRetry = '%d',ZigbeeRetryGap = '%d',ACCSampleTime = '%d',status = '%s',timeStamp = '%s',viff = '%d',RSSI = '1',UpdateFlag = 1",
|
||||
dataNodeInfo.InitFlag, dataNodeInfo.AccFlag, dataNodeInfo.ZigbeeFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.TemBotFlag, dataNodeInfo.EquipSta, dataNodeInfo.HardVersion.c_str(), dataNodeInfo.SoftVersion.c_str(), dataNodeInfo.BpNo.c_str(),
|
||||
dataNodeInfo.SerialNo.c_str(), dataNodeInfo.FirstPowerTime.c_str(), dataNodeInfo.WakeupTime, dataNodeInfo.StaticTime, dataNodeInfo.WaveTime, dataNodeInfo.BateryV, dataNodeInfo.ProductNo.c_str(), dataNodeInfo.ConfigFlag, dataNodeInfo.StartBrands.c_str(),
|
||||
dataNodeInfo.StopBrands.c_str(), dataNodeInfo.FeatureInterVal, dataNodeInfo.WaveInterVal, dataNodeInfo.SamplingRate, "", dataNodeInfo.Range, dataNodeInfo.EnvelopeBandPass.c_str(), dataNodeInfo.FaultFrequency.c_str(), dataNodeInfo.ZigbeePanId.c_str(),
|
||||
dataNodeInfo.ZigbeeChannel, dataNodeInfo.ZigbeeShortAddr.c_str(), dataNodeInfo.ZigbeeLongAddr.c_str(), dataNodeInfo.ZigbeeDesAddr.c_str(), dataNodeInfo.ZigbeePower, dataNodeInfo.ZigbeeRetry, dataNodeInfo.ZigbeeRetryGap, dataNodeInfo.ACCSampleTime, "1",
|
||||
dataNodeInfo.ConfigDate.c_str(), dataNodeInfo.VIntegralFilterFrequency, dataNodeInfo.RSSI);
|
||||
dataNodeInfo.ConfigDate.c_str(), dataNodeInfo.VIntegralFilterFrequency);
|
||||
sprintf(whereCon, "dataNodeNo = '%s'", dataNodeInfo.ZigbeeLongAddr.c_str());
|
||||
res = sqlite_db_ctrl::instance().UpdateTableData(T_SENSOR_INFO(TNAME), updateSql, whereCon);
|
||||
if(res !=0 ){
|
||||
@ -1150,7 +1155,7 @@ void Uart::DealDataNodeInfo(const char *pData) {
|
||||
'%d','%d','%d','%s','%d','%s',\
|
||||
'%s','%u','%d','%d','%s','%d', '%s', '%s',\
|
||||
'%s','%d','%s','%s','%s',\
|
||||
'%d','%d','%d','%d','%s','%s', '%d', '0,%d','1','0,0','','','',0",
|
||||
'%d','%d','%d','%d','%s','%s', '%d', '0,%d','1','1','','','',0",
|
||||
dataNodeInfo.ZigbeeLongAddr.c_str(), " ", dataNodeInfo.InitFlag, dataNodeInfo.AccFlag, dataNodeInfo.ZigbeeFlag, dataNodeInfo.TemTopFlag, dataNodeInfo.TemBotFlag, dataNodeInfo.EquipSta, dataNodeInfo.HardVersion.c_str(), dataNodeInfo.SoftVersion.c_str(),
|
||||
dataNodeInfo.BpNo.c_str(), dataNodeInfo.SerialNo.c_str(), dataNodeInfo.FirstPowerTime.c_str(), dataNodeInfo.WakeupTime, dataNodeInfo.StaticTime, dataNodeInfo.WaveTime, dataNodeInfo.BateryV, dataNodeInfo.ProductNo.c_str(), dataNodeInfo.ConfigFlag,
|
||||
dataNodeInfo.StartBrands.c_str(), dataNodeInfo.StopBrands.c_str(), dataNodeInfo.FeatureInterVal, dataNodeInfo.WaveInterVal, dataNodeInfo.SamplingRate, "", dataNodeInfo.Range, dataNodeInfo.EnvelopeBandPass.c_str(), dataNodeInfo.FaultFrequency.c_str(),
|
||||
|
||||
@ -68,7 +68,7 @@ void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, s
|
||||
if (dataStatic.nodeSendTime > 0){
|
||||
actualRate = (wave_dataLen / 1024.0f) / (dataStatic.nodeSendTime / 1000.0f); //单位:KB/s
|
||||
}
|
||||
float comprehensiveRSSI = (zigbeeSignal + zigbeeSignalNode) * (actualRate / standardRate);
|
||||
float comprehensiveRSSI = (zigbeeSignal + zigbeeSignalNode) * (standardRate / actualRate);
|
||||
if (comprehensiveRSSI > 1.0f) {
|
||||
comprehensiveRSSI = 1.0f; //综合信号强度最大为1
|
||||
}
|
||||
@ -122,7 +122,13 @@ void Uart::DealTriger(uint16_t ushortAdd,std::string & measurementID){
|
||||
{
|
||||
zlog_warn(zct, "measurementID='%s' trigger activated, rmsValue=%f,ushortAdd %04x", measurementID.c_str(), rmsValue_f,ushortAdd);
|
||||
scheduler::instance().TriggerWave(ushortAdd, 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vecTrigger[4] == "0")
|
||||
{
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon,"MeasurementID = '%s'",measurementID.c_str());
|
||||
sqlite_db_ctrl::instance().UpdateTableData(" t_wave_triger_info ", " status = '0' ", whereCon);
|
||||
}
|
||||
}
|
||||
}else if (vecTrigger[3] == "1"){// 速度有效值
|
||||
@ -140,6 +146,12 @@ void Uart::DealTriger(uint16_t ushortAdd,std::string & measurementID){
|
||||
scheduler::instance().TriggerWave(ushortAdd, 1, 0);
|
||||
}
|
||||
}
|
||||
if (vecTrigger[4] == "0")
|
||||
{
|
||||
memset(whereCon, 0x00, sizeof(whereCon));
|
||||
sprintf(whereCon,"MeasurementID = '%s'",measurementID.c_str());
|
||||
sqlite_db_ctrl::instance().UpdateTableData(" t_wave_triger_info ", " status = '0' ", whereCon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1393,10 +1405,18 @@ void Uart::WriteDatFile(int sampleRate, std::string &strMeasurementID, int iChan
|
||||
outputData.push_back(outputData2[i]);
|
||||
}
|
||||
}else if(std::fabs(ACCSampleTime - 1.28) < epsilon){
|
||||
outSize = 32768;
|
||||
sampleRate = 25600;
|
||||
outputData = Calculation::fftInterpolate(vecData, outSize);
|
||||
zlog_info(zct, " outputData_size %zu ,ACCSampleTime %f", outputData.size(),ACCSampleTime);
|
||||
}else if(std::fabs(ACCSampleTime - 3.2) < epsilon){
|
||||
outSize = 8192;
|
||||
sampleRate = 2560;
|
||||
outputData = Calculation::fftInterpolate(vecData, outSize);
|
||||
zlog_info(zct, " outputData_size %zu ,ACCSampleTime %f", outputData.size(),ACCSampleTime);
|
||||
}else if(std::fabs(ACCSampleTime - 1.6) < epsilon){
|
||||
outSize = 5120;
|
||||
sampleRate = 5120;
|
||||
outputData = Calculation::fftInterpolate(vecData, outSize);
|
||||
zlog_info(zct, " outputData_size %zu ,ACCSampleTime %f", outputData.size(),ACCSampleTime);
|
||||
}
|
||||
|
||||
@ -593,7 +593,7 @@ int Uart::TaskResp(ScheduleTask scheduleTask){
|
||||
y = 1;
|
||||
z = 0;
|
||||
}
|
||||
zlog_info(zct,"wave x = %d,y = %d,z = %d\n",x,y,z);
|
||||
zlog_info(zct,"wave x = %d,y = %d,z = %d,scheduleTask.z = %d\n",x,y,z,scheduleTask.z);
|
||||
send_data[17] = x;
|
||||
send_data[18] = y;
|
||||
send_data[19] = z;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user