This commit is contained in:
zhangsheng 2024-11-25 19:00:15 +08:00
parent 6a80e9415f
commit a5618ac003
4 changed files with 19 additions and 20 deletions

View File

@ -712,7 +712,7 @@ void JsonData::DataNodeStatusCheck() {
} }
} }
} }
if (count == nSize && nodeOnline) { if (count == nSize && nodeOnline && count != 0) {
zlog_error(zct, "ALL Node offline,count = %d", count); zlog_error(zct, "ALL Node offline,count = %d", count);
exit(0); exit(0);
} }

View File

@ -118,7 +118,7 @@ void CheckThread() {
} }
} }
if (600 == online_check) { if (1800 == online_check) {
online_check = 0; online_check = 0;
int Count = sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), NULL); int Count = sqlite_db_ctrl::instance().GetTableRows(T_SENSOR_INFO(TNAME), NULL);
if (Count > 0) { if (Count > 0) {

View File

@ -374,13 +374,15 @@ void CleanLogFile(std::string log_dir, size_t retain) {
void DiskSpaceCheck() { void DiskSpaceCheck() {
std::string directory = "/opt/log"; std::string directory = "/opt/log";
std::string directory_data = "/opt/data";
while (1) { while (1) {
boost::filesystem::space_info si = boost::filesystem::space("/opt"); boost::filesystem::space_info si = boost::filesystem::space("/opt");
if (si.free <= 20000000) { if (si.free <= 512000000) {
zlog_warn(zct, "disk free space:%llu for /opt", si.free); zlog_warn(zct, "disk free space:%llu for /opt", si.free);
CleanLogFile(directory, 10); CleanLogFile(directory, 10);
CleanLogFile(directory_data, 100);
boost::filesystem::space_info si1 = boost::filesystem::space("/opt"); boost::filesystem::space_info si1 = boost::filesystem::space("/opt");
if (si1.free <= 20000000) { if (si1.free <= 512000000) {
zlog_warn(zct, "[DiskSpaceCheck] can not release enough space and clean more log file"); zlog_warn(zct, "[DiskSpaceCheck] can not release enough space and clean more log file");
CleanLogFile(directory, 5); CleanLogFile(directory, 5);
} }

View File

@ -22,9 +22,9 @@ std::vector<RecvData> g_VecWaveDataZ;
std::map<std::string, compressWaveChannel> g_mapCompress; std::map<std::string, compressWaveChannel> g_mapCompress;
std::map<std::string, WaveChannel> g_mapWaveChannel; std::map<std::string, WaveChannel> g_mapWaveChannel;
unsigned char data[1024 * 80] = {0x00}; unsigned char data[96000] = {0x00};
unsigned char outdata[1024 * 80] = {0x00}; unsigned char outdata[96000] = {0x00};
unsigned char dealdata[1024 * 80] = {0x00}; unsigned char dealdata[96000] = {0x00};
char mqttData[512000] = {0}; char mqttData[512000] = {0};
void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, std::string &nowTimetamp) { void Uart::RecordBattery(std::string &strLongAddr, DataRecvStatic &dataStatic, std::string &nowTimetamp) {
@ -772,6 +772,15 @@ void Uart::DealWave() {
wave_trans_ = false; wave_trans_ = false;
return; return;
} }
char localtimestamp[32] = {0};
GetTimeNet(localtimestamp, 1);
char insertSql[100] = {0x00};
char whereCon[50] = {0x00};
sprintf(whereCon, "MeasurementID='%s'",strMeasurementID.c_str());
memset(whereCon, 0x00, sizeof(whereCon));
sprintf(insertSql, "'%s','%02x%02x','%s',0,'1','%s' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
std::string ran = ""; std::string ran = "";
int n = 0; int n = 0;
int range = 0; int range = 0;
@ -814,18 +823,6 @@ void Uart::DealWave() {
g_VecWaveDataZ.clear(); g_VecWaveDataZ.clear();
VecWaveDataZ.clear(); VecWaveDataZ.clear();
} }
if (m_waveCountX > 0 || m_waveCountY > 0 || m_waveCountZ > 0)
{
char localtimestamp[32] = {0};
GetTimeNet(localtimestamp, 1);
char insertSql[100] = {0x00};
char whereCon[50] = {0x00};
sprintf(whereCon, "MeasurementID='%s'",strMeasurementID.c_str());
memset(whereCon, 0x00, sizeof(whereCon));
sprintf(insertSql, "'%s','%02x%02x','%s',0,'1','%s' ", strMeasurementID.c_str(),(wave_shortAddr >> 8) & 0xFF,wave_shortAddr & 0xFF,localtimestamp,"");
sqlite_db_ctrl::instance().InsertData(" receive_wave_status ", insertSql);
}
wave_trans_ = false; wave_trans_ = false;
} }