track uptime

This commit is contained in:
Johannes Jöns 2024-10-13 14:51:02 +02:00
parent a3879a5832
commit da3e4af9f2

View file

@ -6,6 +6,7 @@
#include <ds18b20.h> // Die Header-Datei mit DS18B20-Funktionen
#include <task.h>
#include <esp_wifi.h>
#include <FreeRTOSConfig.h>
struct appldata;
/*
@ -22,6 +23,8 @@ int app_main() {
// Variable to store the MAC address
uint8_t baseMac[6];
long uptime = (xTaskGetTickCount() * (1000/configTICK_RATE_HZ));
// Get MAC address of the WiFi station interface
esp_read_mac(baseMac, ESP_MAC_WIFI_STA);
printf("Station MAC: ");
@ -30,6 +33,8 @@ int app_main() {
}
printf("%02X\n", baseMac[5]);
printf( "Uptime = %d\n", (xTaskGetTickCount() * (1000/configTICK_RATE_HZ)));
@ -50,7 +55,8 @@ int app_main() {
temp = ds18b20_read_temp(&sensor);
vTaskDelay(5000 / portTICK_PERIOD_MS);
printf("\n");
printf( "Temperature = %.4f", temp);
printf( "Temperature = %.4f\n", temp);
printf( "Uptime = %d", (xTaskGetTickCount() * (1000/configTICK_RATE_HZ)));
};
// Print temperature with 4 decimal places