Skip to content

Commit 10e0315

Browse files
committed
Smaller main platform for dev
1 parent 76faba4 commit 10e0315

File tree

5 files changed

+158
-243
lines changed

5 files changed

+158
-243
lines changed

firmware/main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set(srcs
1010
)
1111

1212
idf_component_register(SRCS "${srcs}"
13-
INCLUDE_DIRS "./")
13+
INCLUDE_DIRS ".")
1414

1515
add_custom_command(
1616
OUTPUT "${COMPONENT_DIR}/platform_gen.c"

firmware/main/include/platform.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef PLATFORM_H
22
#define PLATFORM_H
33

4-
#include "include/system.h"
54
#include "include/nvs_init.h"
65

76
#include "esp_log.h"

firmware/main/main.c

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "include/nvs_init.h"
22
#include "include/platform.h"
3+
#include "include/system.h"
34
#include "include/ota_update.h"
45
#include "include/factory_reset.h"
56
#include "driver_framebuffer.h"
@@ -12,6 +13,7 @@
1213
#include "nvs.h"
1314
#include "micropython_main.h"
1415

16+
1517
extern void micropython_entry(void);
1618

1719
extern esp_err_t unpack_first_boot_zip(void);
@@ -36,45 +38,47 @@ void app_main()
3638
size_t mp_task_heap_size = mp_preallocate_heap();
3739
ESP_LOGI("MP", "Heap size: %d", mp_task_heap_size);
3840

39-
logo();
40-
bool is_first_boot = nvs_init();
41+
// logo();
42+
// bool is_first_boot = nvs_init();
4143

44+
fflush(stdout);
4245
platform_init();
4346

44-
if (is_first_boot) {
45-
#ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
46-
driver_framebuffer_fill(NULL, COLOR_BLACK);
47-
driver_framebuffer_print(NULL, "Extracting ZIP...\n", 0, 0, 1, 1, COLOR_WHITE, &roboto_12pt7b);
48-
driver_framebuffer_flush(0);
49-
#endif
50-
printf("Attempting to unpack FAT initialization ZIP file...\b");
51-
if (unpack_first_boot_zip() != ESP_OK) { //Error
52-
#ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
53-
driver_framebuffer_fill(NULL, COLOR_BLACK);
54-
driver_framebuffer_print(NULL, "ZIP error!\n", 0, 0, 1, 1, COLOR_WHITE, &roboto_12pt7b);
55-
driver_framebuffer_flush(0);
56-
#endif
57-
printf("An error occured while unpacking the ZIP file!");
58-
nvs_write_zip_status(false);
59-
} else {
60-
nvs_write_zip_status(true);
61-
}
62-
esp_restart();
63-
}
47+
// if (is_first_boot) {
48+
// #ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
49+
// driver_framebuffer_fill(NULL, COLOR_BLACK);
50+
// driver_framebuffer_print(NULL, "Extracting ZIP...\n", 0, 0, 1, 1, COLOR_WHITE, &roboto_12pt7b);
51+
// driver_framebuffer_flush(0);
52+
// #endif
53+
// printf("Attempting to unpack FAT initialization ZIP file...\b");
54+
// if (unpack_first_boot_zip() != ESP_OK) { //Error
55+
// #ifdef CONFIG_DRIVER_FRAMEBUFFER_ENABLE
56+
// driver_framebuffer_fill(NULL, COLOR_BLACK);
57+
// driver_framebuffer_print(NULL, "ZIP error!\n", 0, 0, 1, 1, COLOR_WHITE, &roboto_12pt7b);
58+
// driver_framebuffer_flush(0);
59+
// #endif
60+
// printf("An error occured while unpacking the ZIP file!");
61+
// nvs_write_zip_status(false);
62+
// } else {
63+
// nvs_write_zip_status(true);
64+
// }
65+
// esp_restart();
66+
// }
6467

65-
int magic = get_magic();
68+
// int magic = get_magic();
6669

67-
switch(magic) {
68-
case MAGIC_OTA:
69-
// This triggers an Over-the-Air firmware update
70-
badge_ota_update();
71-
break;
72-
case MAGIC_FACTORY_RESET:
73-
// This clears any FAT data partitions
74-
factory_reset();
75-
break;
76-
default:
77-
// This starts the MicroPython FreeRTOS task
78-
start_mp();
79-
}
70+
// switch(magic) {
71+
// case MAGIC_OTA:
72+
// // This triggers an Over-the-Air firmware update
73+
// badge_ota_update();
74+
// break;
75+
// case MAGIC_FACTORY_RESET:
76+
// // This clears any FAT data partitions
77+
// factory_reset();
78+
// break;
79+
// default:
80+
// // This starts the MicroPython FreeRTOS task
81+
start_mp();
82+
// while(1){}
83+
// }
8084
}

firmware/main/platform.c

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
#include "include/platform_gen.h"
33
#include "driver_framebuffer.h"
44
#include <driver/gpio.h>
5+
#include <esp_event.h>
6+
#include <esp_system.h>
7+
#include <esp_wifi.h>
8+
#include <esp_spi_flash.h>
9+
#include <esp_partition.h>
10+
#include <esp_vfs.h>
11+
#include <esp_vfs_fat.h>
12+
#include <esp_log.h>
13+
#include "buses.h"
514

615
#define TAG "platform"
716

@@ -48,40 +57,13 @@ void fatal_error(const char *message) {
4857

4958
void platform_init()
5059
{
51-
if (isr_init() != ESP_OK) restart();
60+
//if (isr_init() != ESP_OK) restart();
5261
//Static inits can be performed here
62+
start_buses();
63+
64+
//Init generated modules
5365
platform_gen_init();
54-
/*
55-
INIT_DRIVER(vspi , "VSPI BUS" ) //Generic VSPI bus driver
56-
INIT_DRIVER(i2c , "I2C BUS" ) //Generic I2C bus driver
57-
INIT_DRIVER(hub75 , "HUB75" ) //LED matrix as found on the CampZone 2019 badge
58-
INIT_DRIVER(erc12864 , "ERC12864" ) //128x64 LCD screen as found on the Disobey 2019 badge
59-
INIT_DRIVER(ssd1306 , "SSD1306" ) //128x64 OLED screen as found on the Disobey 2020 badge
60-
INIT_DRIVER(eink , "E-INK" ) //296x128 e-ink display as found on the SHA2017 and HackerHotel 2019 badges
61-
INIT_DRIVER(gxgde0213b1 , "GXGDE0213B1") //E-ink on OHS badge
62-
INIT_DRIVER(nokia6100 , "NOKIA6100" ) //Nokia 6100 LCD
63-
INIT_DRIVER(flipdotter , "FLIPDOTTER" ) //Otter flipdot display
64-
INIT_DRIVER(ili9341 , "ILI9341" ) //LCD display on wrover kit
65-
INIT_DRIVER(fri3d , "FRI3D" ) //LEDs on the Fri3d camp 2018 badge
66-
INIT_DRIVER(st7735 , "ST7735" ) //Color display
67-
INIT_DRIVER(st7789v , "ST7789V" ) //Color display
68-
INIT_DRIVER(ledmatrix , "LEDMATRIX" ) //Ledmatrix display
69-
INIT_DRIVER(i2c_display , "I2C DISPLAY") //Generic i2c display
70-
INIT_DRIVER(framebuffer , "FRAMEBUFFER") //Framebuffer driver with basic drawing routines
71-
fbReady = true; //Notify the error handler that framebuffer support is now available
72-
73-
INIT_DRIVER(mpr121 , "MPR121" ) //I/O expander with touch inputs as found on the SHA2017 and HackerHotel 2019 badges
74-
INIT_DRIVER(pca9555 , "PCA9555" ) //16-bit I/O expander found on the Troopers 2020 badge
75-
INIT_DRIVER(disobey_samd , "SAMD" ) //I/O via the SAMD co-processor on the Disobey 2019 badge
76-
INIT_DRIVER(neopixel , "NEOPIXEL" ) //Addressable LEDs as found on the SHA2017 and HackerHotel 2019 badges
77-
INIT_DRIVER(microphone , "MICROPHONE" ) //Microphone driver
78-
INIT_DRIVER(mpu6050 , "MPU6050" ) //Accelerometer driver
79-
INIT_DRIVER(sdcard , "SDCARD" ) //SD card driver
80-
INIT_DRIVER(lora , "LORA" ) //LoRa modem driver
81-
INIT_DRIVER(am2320 , "AM2320" ) //AM2320 sensor driver
82-
INIT_DRIVER(touchbuttons , "TOUCHBUTTONS" ) //ESP32 touchbuttons driver
83-
INIT_DRIVER(fsoveruart , "FSOVERUART")
84-
*/
66+
8567
fflush(stdout);
8668
vTaskDelay(100 / portTICK_PERIOD_MS); //Give things time to settle.
8769
}

0 commit comments

Comments
 (0)