SolarEnergy/esp32_device/main/main.c

37 lines
628 B
C
Executable File

#include <stdio.h>
#include "esp_system.h"
#include "dev_name.h"
#include "storage.h"
#include "system.h"
#include "crypto.h"
void app_main(void)
{
printf("\n");
if (storage_init() == false)
{
printf("Failed to init storage!\n");
reboot();
}
if (dev_generate_name())
{
printf("Generated a new device name\n");
}
char *name = dev_name();
printf("Dev name: %s\n", name);
free(name);
if (crypto_gen_priv_key())
{
printf("Generated device private key!\n");
}
printf("Device private key:\n");
crypto_print_priv_key();
reboot();
}