add:记录cpu温度;

This commit is contained in:
tangchao0503
2023-10-25 15:34:19 +08:00
parent d0b67b47c1
commit 7467f9ccf9
2 changed files with 19 additions and 2 deletions

View File

@ -3,7 +3,7 @@
int main(int argc, char *argv[])
{
std::cout<<"ximeaAirborneSystem 版本:"<< "40." <<std::endl;
std::cout<<"ximeaAirborneSystem 版本:"<< "41." <<std::endl;
QCoreApplication a(argc, argv);
//UdpServer* x=new UdpServer();

View File

@ -940,10 +940,27 @@ void RecordXimeaTemperature::recordTemperature(QString filePath= nullptr)
system("/home/300tc/projects/udpClient/udpClient 127.0.0.1 2");
}
// 获取剩余硬盘空间和剩余采集时间
FILE *fp;
char buffer[128];
fp = popen("cat /sys/devices/virtual/thermal/thermal_zone1/temp", "r");
if (fp == NULL) {
perror("popen");
}
// 读取输出并处理
unsigned long long temper;
if (fgets(buffer, sizeof(buffer), fp) != NULL)
{
temper = strtoull(buffer, NULL, 10);
// printf("CPU温度: %.2f;\n", (float)temper/1000);
}
pclose(fp);
QDateTime curDateTime = QDateTime::currentDateTime();
QString currentTime = curDateTime.toString("yyyy/MM/dd hh:mm:ss");
ximeaTemperatureFile << currentTime.toStdString() << "," << temp << "\n";
ximeaTemperatureFile << currentTime.toStdString() << "," << temp << "," << (float)temper/1000 << "\n";
// std::cout<<"RecordXimeaTemperature::recordTemperature----------------:ximea Temperature is "<< temp <<std::endl;
// std::cout<<"RecordXimeaTemperature::recordTemperature----------------:ximea state is "<< m_ximeaImager->getImagerState() <<std::endl;