FreeRTOS Add Boot Time
This commit is contained in:
@@ -189,6 +189,7 @@ int loop(int fd, CONF *conf, DATA *DATA)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// CO
|
||||
if (strstr(receivedString, "CO")) {
|
||||
|
||||
@@ -246,6 +247,14 @@ int loop(int fd, CONF *conf, DATA *DATA)
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
// Boot Time
|
||||
if (strstr(receivedString, "Boot Time")) {
|
||||
if (1 == (sscanf(receivedString, "Boot Time: %llu seconds\n", &DATA->boot_time_))) {
|
||||
printf("Boot Time: %llu seconds\n", DATA->boot_time_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
receivedString[0] = '\0';
|
||||
@@ -360,6 +369,7 @@ int main()
|
||||
data->co_1st = 1;
|
||||
data->co2_1st = 1;
|
||||
data->_time = 180;
|
||||
data->boot_time_ = 0;
|
||||
|
||||
redirect_stdout_to_file(logfd, "hc-12.log");
|
||||
pthread_mutex_init(&mutex, NULL); // 初始化互斥锁
|
||||
|
@@ -48,6 +48,9 @@ typedef struct DATA {
|
||||
float co2;
|
||||
float ch4_;
|
||||
|
||||
// boot time
|
||||
long long unsigned int boot_time_;
|
||||
|
||||
// 超过阈值次数
|
||||
int ds18b20_num;
|
||||
int ch4_num;
|
||||
|
Reference in New Issue
Block a user