@@ -39,47 +39,47 @@ void app_main()
3939 size_t mp_task_heap_size = mp_preallocate_heap ();
4040 ESP_LOGI (TAG , "Heap size: %d" , mp_task_heap_size );
4141
42- // logo();
43- // bool is_first_boot = nvs_init();
42+ logo ();
43+ bool is_first_boot = nvs_init ();
4444
4545 fflush (stdout );
4646 platform_init ();
4747
48- // if (is_first_boot) {
49- // #ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
50- // driver_framebuffer_fill(NULL, COLOR_BLACK);
51- // driver_framebuffer_print(NULL, "Extracting ZIP...\n", 0, 0, 1, 1, COLOR_WHITE, &roboto_12pt7b);
52- // driver_framebuffer_flush(0);
53- // #endif
54- // printf("Attempting to unpack FAT initialization ZIP file...\b");
55- // if (unpack_first_boot_zip() != ESP_OK) { //Error
56- // #ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
57- // driver_framebuffer_fill(NULL, COLOR_BLACK);
58- // driver_framebuffer_print(NULL, "ZIP error!\n", 0, 0, 1, 1, COLOR_WHITE, &roboto_12pt7b);
59- // driver_framebuffer_flush(0);
60- // #endif
61- // printf("An error occured while unpacking the ZIP file!");
62- // nvs_write_zip_status(false);
63- // } else {
64- // nvs_write_zip_status(true);
65- // }
66- // esp_restart();
67- // }
48+ if (is_first_boot ) {
49+ #ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
50+ driver_framebuffer_fill (NULL , COLOR_BLACK );
51+ driver_framebuffer_print (NULL , "Extracting ZIP...\n" , 0 , 0 , 1 , 1 , COLOR_WHITE , & roboto_12pt7b );
52+ driver_framebuffer_flush (0 );
53+ #endif
54+ printf ("Attempting to unpack FAT initialization ZIP file...\b" );
55+ if (unpack_first_boot_zip () != ESP_OK ) { //Error
56+ #ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
57+ driver_framebuffer_fill (NULL , COLOR_BLACK );
58+ driver_framebuffer_print (NULL , "ZIP error!\n" , 0 , 0 , 1 , 1 , COLOR_WHITE , & roboto_12pt7b );
59+ driver_framebuffer_flush (0 );
60+ #endif
61+ printf ("An error occured while unpacking the ZIP file!" );
62+ nvs_write_zip_status (false);
63+ } else {
64+ nvs_write_zip_status (true);
65+ }
66+ esp_restart ();
67+ }
6868
69- // int magic = get_magic();
69+ int magic = get_magic ();
7070
71- // switch(magic) {
72- // case MAGIC_OTA:
73- // // This triggers an Over-the-Air firmware update
74- // badge_ota_update();
75- // break;
76- // case MAGIC_FACTORY_RESET:
77- // // This clears any FAT data partitions
78- // factory_reset();
79- // break;
80- // default:
81- // // This starts the MicroPython FreeRTOS task
82- start_mp ();
83- // while(1){}
84- // }
71+ switch (magic ) {
72+ case MAGIC_OTA :
73+ // This triggers an Over-the-Air firmware update
74+ badge_ota_update ();
75+ break ;
76+ case MAGIC_FACTORY_RESET :
77+ // This clears any FAT data partitions
78+ factory_reset ();
79+ break ;
80+ default :
81+ // This starts the MicroPython FreeRTOS task
82+ start_mp ();
83+ while (1 ){}
84+ }
8585}
0 commit comments