From 5a1672ed415b34af0892cef0e83236cb48480f25 Mon Sep 17 00:00:00 2001 From: user Date: Sun, 13 Oct 2024 21:43:41 +0200 Subject: [PATCH] clean up apple.h --- embadet/main/apple.c | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/embadet/main/apple.c b/embadet/main/apple.c index 1b7f6c8..6d50c46 100644 --- a/embadet/main/apple.c +++ b/embadet/main/apple.c @@ -1,3 +1,4 @@ +#include "apple.h" #include "esp_log.h" #include @@ -8,61 +9,35 @@ #include #include -struct appldata; float getTemp(); int getUpTime(); void getmac(); struct appldata{ - uint8_t mac; + uint8_t mac[6]; float temp; float battaryVoltage; int upTime; }; -struct appldata app_main() { +int app_main() { //tiem delay - vTaskDelay(5000 / portTICK_PERIOD_MS); - - //creat var vor mac addres - uint8_t baseMac[6] = {0}; - getmac(baseMac,6); - //fill struct struct appldata send; - send.mac = baseMac ; + getmac(send.mac) ; send.upTime = getUpTime(); send.temp = getTemp(); send.battaryVoltage = 3.3; - - //print mac - printf("Station MAC: "); - for (int i = 0; i < 5; i++) { - printf("%02X:", (baseMac[i])); - } - printf("%02X\n", baseMac[5]); - - //print uptime - int uptime = getUpTime(); - printf("%d", uptime); - - //print temp - float temp = getTemp(); - printf("Temperature = %.4f\n", temp); - //end func - return send; + return 0; } - -void getmac(uint8_t *buf, int count){ - for(int i = 0; i < count; ++i) - buf[i] = i; +void getmac(uint8_t *buf){ // Get MAC address of the WiFi station interface esp_read_mac(buf, ESP_MAC_WIFI_STA); }