setup sdkconfig and clean main

This commit is contained in:
2026-07-20 16:31:52 -05:00
parent 67a85f2c11
commit 8ce58f411e
4 changed files with 25 additions and 142 deletions
+7 -5
View File
@@ -1,12 +1,14 @@
dependencies: dependencies:
atanisoft/esp_lcd_ili9488: atanisoft/esp_lcd_ili9488:
component_hash: 1bbdbec8ae5b5c32db45ace2c19a8d79c0eaa919209ce190a0be3dada703ddcf
dependencies: dependencies:
- name: idf - name: idf
require: private
version: '>=4.4.2' version: '>=4.4.2'
source: source:
path: ..\esp_lcd_ili9488 registry_url: https://components.espressif.com/
type: local type: service
version: 1.1.0 version: 1.1.1
espressif/led_strip: espressif/led_strip:
component_hash: 28621486f77229aaf81c71f5e15d6fbf36c2949cf11094e07090593e659e7639 component_hash: 28621486f77229aaf81c71f5e15d6fbf36c2949cf11094e07090593e659e7639
dependencies: dependencies:
@@ -20,7 +22,7 @@ dependencies:
idf: idf:
source: source:
type: idf type: idf
version: 6.0.0 version: 6.0.2
lvgl/lvgl: lvgl/lvgl:
component_hash: d7c1ac037ae6e85d94897f807d6e7ba0946a83e720074fc95a4f6241da9f9f53 component_hash: d7c1ac037ae6e85d94897f807d6e7ba0946a83e720074fc95a4f6241da9f9f53
dependencies: [] dependencies: []
@@ -33,6 +35,6 @@ direct_dependencies:
- espressif/led_strip - espressif/led_strip
- idf - idf
- lvgl/lvgl - lvgl/lvgl
manifest_hash: 5310bc9c053335562a91430b060b867c038be3618c4dd8d268b10627680fe2d0 manifest_hash: 7282d42cdeb16392146e8acc67acc4625ae6ba6cba2b36852bd0e96432388883
target: esp32s3 target: esp32s3
version: 3.0.0 version: 3.0.0
+1 -137
View File
@@ -1,35 +1,10 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include <stdio.h>
#include <inttypes.h>
#include "esp_wifi_types_generic.h"
#include "freertos/projdefs.h"
#include "sdkconfig.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"
#include "blk_box.h" #include "blk_box.h"
#include "blk_box_drivers/i2c.h"
#include "blk_box_drivers/inputs.hpp"
#include "blk_box_drivers/leds.hpp"
#include "blk_box_drivers/char_lcd.hpp" #include "blk_box_drivers/char_lcd.hpp"
#include "blk_box_drivers/ssegs.hpp"
#include "blk_box_drivers/helpers.hpp" #include "blk_box_drivers/helpers.hpp"
#include "blk_box_drivers/tft.hpp"
#include "blk_box_drivers/bbnow.hpp"
#include <lvgl.h> #include <lvgl.h>
#include "esp_log.h"
#include "esp_event.h"
#include "esp_netif.h"
#include "esp_wifi.h"
#include "esp_log.h"
#include "esp_mac.h"
#include "esp_now.h"
#include "esp_crc.h"
#include "nvs_flash.h"
const static char TAG[] = "main"; const static char TAG[] = "main";
extern "C" void app_main(void) { extern "C" void app_main(void) {
@@ -39,117 +14,6 @@ extern "C" void app_main(void) {
LCDController::set_backlight(true); LCDController::set_backlight(true);
lcd_do_splash(); lcd_do_splash();
lvgl_lock(portMAX_DELAY);
// Get the default screen
lv_obj_t * scr = lv_scr_act();
// Create a title label
lv_obj_t * title = lv_label_create(scr);
lv_label_set_text(title, "Display Test");
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 10);
lv_obj_set_style_text_font(title, &lv_font_montserrat_24, 0);
// Create a status label
lv_obj_t * status = lv_label_create(scr);
lv_label_set_text(status, "Testing display...");
lv_obj_align(status, LV_ALIGN_CENTER, 0, -20);
// Create a progress bar
lv_obj_t * bar = lv_bar_create(scr);
lv_obj_set_size(bar, 200, 20);
lv_obj_align(bar, LV_ALIGN_CENTER, 0, 30);
lv_bar_set_value(bar, 50, LV_ANIM_OFF);
// Create a button with callback
lv_obj_t * btn = lv_btn_create(scr);
lv_obj_set_size(btn, 100, 40);
lv_obj_align(btn, LV_ALIGN_BOTTOM_MID, 0, -20);
lv_obj_t * btn_label = lv_label_create(btn);
lv_label_set_text(btn_label, "Test");
lv_obj_center(btn_label);
// Create a color test area
lv_obj_t * color_test = lv_obj_create(scr);
lv_obj_set_size(color_test, 80, 60);
lv_obj_align(color_test, LV_ALIGN_BOTTOM_LEFT, 10, -20);
lv_obj_set_style_bg_color(color_test, lv_color_hex(0xFF0000), 0); // Red
lvgl_unlock();
LCDController::set_resting_cursor_mode(CursorMode::Show);
LCDController::set_resting_cursor_pos(0, 0);
SSegController::enable_game_timer();
SSegController::enable_module_timer();
// uint8_t mac[6];
// ESP_ERROR_CHECK(esp_wifi_get_mac(WIFI_IF_STA, mac));
// ESP_LOGI(TAG, "My MAC: %02X:%02X:%02X:%02X:%02X:%02X",
// mac[0], mac[1], mac[2],
// mac[3], mac[4], mac[5]);
// BBNowPubPacket tens_discovery_packet = BBNowPubPacket::new_discovery(BlkBoxNowPubDiscoveryData {
// .expantion_type = BlkBoxExpantion::TENS,
// });
// while (1) {
// auto buf = tens_discovery_packet.serialize();
// ESP_LOGI(TAG, "sending packet of size %d from main", buf.size());
// ESP_ERROR_CHECK(esp_now_send(BROADCAST_MAC, buf.data(), buf.size()));
// vTaskDelay(pdMS_TO_TICKS(1000));
// }
uint32_t i = 0;
while (1) {
if (InputsController::has_button_press()) {
Button b = InputsController::wait_button_press();
printf("Button pressed: %d\n", raw_value(b));
if (b == Button::GREEN) {
LEDController::set_indicator(static_cast<IndicatorLED>(i + LED_SHAPE_COUNT), LEDColor::GREEN);
LEDController::flush();
} else if (b == Button::YELLOW) {
LEDController::set_indicator(static_cast<IndicatorLED>(i + LED_SHAPE_COUNT), LEDColor::YELLOW);
LEDController::flush();
} else if (b == Button::RED) {
i = (i + 1) % LED_INDICATOR_COUNT;
LCDController::set_resting_cursor_pos(0, i % 20);
} else if (b == Button::BLUE) {
i = (i + LED_INDICATOR_COUNT - 1) % LED_INDICATOR_COUNT;
LCDController::set_resting_cursor_pos(0, i % 20);
}
}
if (InputsController::has_switch_flip()) {
SwitchFlip flip = InputsController::wait_switch_flip();
printf("Switch flipped: %d, new state: %d\n", raw_value(flip.get_switch()), flip.is_up());
if (flip.get_switch() == Switch::S1) {
SSegController::set_game_time(SSegController::get_game_time() + 10000);
}
if (flip.get_switch() == Switch::S2) {
SSegController::set_module_time(SSegController::get_module_time() + 10000);
}
if (flip.get_switch() == Switch::S3) {
SSegController::start_game_timer();
}
if (flip.get_switch() == Switch::S4) {
if (flip.is_up()) {
SSegController::start_module_timer();
} else {
SSegController::stop_module_timer();
}
}
}
if (InputsController::has_keypad_press()) {
KeypadKey k = InputsController::wait_keypad_press();
printf("Keypad key pressed: %c\n", keypad_key_to_char(k));
LEDController::flush();
}
vTaskDelay(10 / portTICK_PERIOD_MS);
}
// TODO: impl P001DM
} }
+8
View File
@@ -0,0 +1,8 @@
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,,0x4000,
otadata,data,ota,,0x2000,
phy_init,data,phy,,0x1000,
factory,app,factory,,0x11000,
ota_0,app,ota_0,,3M,
ota_1,app,ota_1,,3M,
1 # ESP-IDF Partition Table
2 # Name, Type, SubType, Offset, Size, Flags
3 nvs,data,nvs,,0x4000,
4 otadata,data,ota,,0x2000,
5 phy_init,data,phy,,0x1000,
6 factory,app,factory,,0x11000,
7 ota_0,app,ota_0,,3M,
8 ota_1,app,ota_1,,3M,
+9
View File
@@ -0,0 +1,9 @@
# This file was generated using idf.py save-defconfig or menuconfig [D] key. It can be edited manually.
# Espressif IoT Development Framework (ESP-IDF) 6.0.2 Project Minimal Configuration
#
# default:
CONFIG_IDF_TARGET="esp32s3"
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_LV_FONT_MONTSERRAT_24=y