Generate device name
This commit is contained in:
		@@ -1,9 +1,29 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include "esp_system.h"
 | 
			
		||||
 | 
			
		||||
#include "dev_name.h"
 | 
			
		||||
#include "storage.h"
 | 
			
		||||
 | 
			
		||||
void app_main(void)
 | 
			
		||||
{
 | 
			
		||||
    printf("\n\n\nhello world and bye\n\n\n");
 | 
			
		||||
    printf("\n");
 | 
			
		||||
 | 
			
		||||
    if (storage_init() == false)
 | 
			
		||||
    {
 | 
			
		||||
        printf("Failed to init storage!\n");
 | 
			
		||||
        fflush(stdout);
 | 
			
		||||
        esp_restart();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (dev_generate_name_if_required())
 | 
			
		||||
    {
 | 
			
		||||
        printf("Generated a new device name\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    char *name = dev_name();
 | 
			
		||||
    printf("Dev name: %s\n", name);
 | 
			
		||||
    free(name);
 | 
			
		||||
 | 
			
		||||
    fflush(stdout);
 | 
			
		||||
    esp_restart();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user