clean up apple.h

This commit is contained in:
user 2024-10-13 21:43:41 +02:00
parent cb9a85a9e8
commit 5a1672ed41

View file

@ -1,3 +1,4 @@
#include "apple.h"
#include "esp_log.h"
#include <stdio.h>
@ -8,61 +9,35 @@
#include <esp_wifi.h>
#include <FreeRTOSConfig.h>
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);
}