All checks were successful
ci/woodpecker/push/build Pipeline was successful
Add error checking for gpio_hold_en()/gpio_hold_dis() return values with warnings logged on failure. Add CONFIG_CLEARGROW_PM_GPIO_HOLD option (default y) to enable/disable GPIO hold for testing wake-from-sleep. Document which peripherals require GPIO hold vs ESP-IDF driver handling: - REQUIRED: SD_CS, RCP_RESET (must hold to prevent glitches) - RECOMMENDED: LCD_BACKLIGHT (LEDC preserves, but hold is safer) - NOT REQUIRED: Touch I2C (driver reinits, but hold prevents corruption) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
172 lines
5.9 KiB
Plaintext
172 lines
5.9 KiB
Plaintext
# ClearGrow Controller - Default SDK Configuration
|
|
# Target: ESP32-S3 with 16MB Flash, 8MB PSRAM
|
|
|
|
# Target
|
|
CONFIG_IDF_TARGET="esp32s3"
|
|
|
|
# Flash Configuration
|
|
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
|
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
|
|
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
|
|
|
# PSRAM Configuration (Octal PSRAM)
|
|
CONFIG_SPIRAM=y
|
|
CONFIG_SPIRAM_MODE_OCT=y
|
|
CONFIG_SPIRAM_SPEED_80M=y
|
|
CONFIG_SPIRAM_BOOT_INIT=y
|
|
CONFIG_SPIRAM_USE_MALLOC=y
|
|
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096
|
|
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
|
|
|
|
# Partition Table
|
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
|
|
|
# FreeRTOS Configuration
|
|
CONFIG_FREERTOS_HZ=1000
|
|
CONFIG_FREERTOS_UNICORE=n
|
|
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3072
|
|
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
|
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=n
|
|
|
|
# WiFi Configuration
|
|
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=16
|
|
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=32
|
|
CONFIG_ESP_WIFI_TX_BUFFER_TYPE=1
|
|
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=32
|
|
|
|
# LWIP Configuration
|
|
CONFIG_LWIP_MAX_SOCKETS=16
|
|
CONFIG_LWIP_TCP_SND_BUF_DEFAULT=16384
|
|
CONFIG_LWIP_TCP_WND_DEFAULT=32768
|
|
|
|
# HTTP/HTTPS Server
|
|
CONFIG_ESP_HTTPS_SERVER_ENABLE=y
|
|
CONFIG_HTTPD_WS_SUPPORT=y
|
|
|
|
# OpenThread (Border Router)
|
|
CONFIG_OPENTHREAD_ENABLED=y
|
|
CONFIG_OPENTHREAD_BORDER_ROUTER=y
|
|
CONFIG_OPENTHREAD_FTD=y
|
|
|
|
# mbedTLS DTLS Configuration (required for OpenThread)
|
|
CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
|
|
CONFIG_MBEDTLS_SSL_DTLS_HELLO_VERIFY=y
|
|
CONFIG_MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE=y
|
|
CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID=y
|
|
CONFIG_MBEDTLS_KEY_EXCHANGE_ECJPAKE=y
|
|
CONFIG_MBEDTLS_ECJPAKE_C=y
|
|
CONFIG_MBEDTLS_HKDF_C=y
|
|
|
|
# LVGL (Display)
|
|
CONFIG_LV_COLOR_DEPTH_16=y
|
|
CONFIG_LV_DISP_DEF_REFR_PERIOD=16
|
|
CONFIG_LV_INDEV_DEF_READ_PERIOD=10
|
|
|
|
# LVGL Fonts - ClearGrow UI requires multiple sizes
|
|
# See docs/UI_Guidelines.md Section 3 for typography hierarchy
|
|
CONFIG_LV_FONT_MONTSERRAT_14=y
|
|
CONFIG_LV_FONT_MONTSERRAT_16=y
|
|
CONFIG_LV_FONT_MONTSERRAT_18=y
|
|
CONFIG_LV_FONT_MONTSERRAT_20=y
|
|
CONFIG_LV_FONT_MONTSERRAT_22=y
|
|
CONFIG_LV_FONT_MONTSERRAT_24=y
|
|
CONFIG_LV_FONT_MONTSERRAT_32=y
|
|
CONFIG_LV_FONT_MONTSERRAT_40=y
|
|
CONFIG_LV_FONT_MONTSERRAT_48=y
|
|
|
|
# Power Management
|
|
# Enable automatic light sleep and dynamic frequency scaling (DFS)
|
|
CONFIG_PM_ENABLE=y
|
|
CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y
|
|
CONFIG_PM_RESTORE_CACHE_TAGMEM_AFTER_LIGHT_SLEEP=y
|
|
CONFIG_PM_POWER_DOWN_TAGMEM_IN_LIGHT_SLEEP=y
|
|
CONFIG_PM_DFS_INIT_AUTO=y
|
|
|
|
# GPIO Peripheral Power-Down in Light Sleep
|
|
# Enable GPIO hold functionality to preserve pin states during light sleep.
|
|
# Critical for:
|
|
# - LCD backlight (GPIO 38) - prevents flicker/state loss
|
|
# - Touch I2C (GPIO 19/20) - maintains SDA/SCL state
|
|
# - SD card CS (GPIO 39) - keeps chip select high
|
|
# - RCP reset (GPIO 40) - keeps nRF52840 in active state
|
|
# GPIO hold is managed by screen manager before/after sleep transitions.
|
|
CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP=y
|
|
|
|
# ClearGrow GPIO Hold for Light Sleep
|
|
# Enables explicit GPIO hold calls in screen manager for critical peripherals.
|
|
# Set to 'n' to test wake-from-sleep behavior without GPIO hold protection.
|
|
# See components/ui/src/cg_screen_mgr.c for detailed peripheral analysis.
|
|
CONFIG_CLEARGROW_PM_GPIO_HOLD=y
|
|
|
|
# Logging
|
|
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
|
|
CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
|
|
|
|
# Watchdog Configuration
|
|
# Task watchdog monitors registered tasks for stalls (default 10s)
|
|
CONFIG_ESP_TASK_WDT=y
|
|
CONFIG_ESP_TASK_WDT_TIMEOUT_S=10
|
|
|
|
# Interrupt watchdog monitors CPU starvation (300ms default)
|
|
CONFIG_ESP_INT_WDT=y
|
|
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
|
|
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
|
|
|
|
# Panic Handler - Auto-reboot on panic for production recovery
|
|
# This allows the device to recover from crashes without manual intervention
|
|
CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y
|
|
|
|
# Coredump Configuration - Save to flash on panic/watchdog
|
|
CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y
|
|
CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y
|
|
CONFIG_ESP_COREDUMP_CHECKSUM_CRC32=y
|
|
CONFIG_ESP_COREDUMP_CAPTURE_DRAM=y
|
|
|
|
# ============================================================================
|
|
# Security - Secure Boot & Flash Encryption
|
|
# ============================================================================
|
|
# IMPORTANT: These features are DISABLED by default for development.
|
|
#
|
|
# For PRODUCTION deployments, you MUST enable these security features:
|
|
#
|
|
# CONFIG_SECURE_BOOT=y
|
|
# - Verifies firmware signature at boot using hardware-protected keys
|
|
# - Prevents execution of unsigned/tampered firmware
|
|
# - WARNING: Enabling this is a ONE-WAY operation - cannot be disabled later
|
|
# - Requires signing keys to be properly configured
|
|
#
|
|
# CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
|
# - Encrypts flash contents using hardware AES engine
|
|
# - Protects firmware and sensitive data from physical readout
|
|
# - WARNING: Enabling this is a ONE-WAY operation - cannot be disabled later
|
|
# - Flash can only be decrypted by the specific device that encrypted it
|
|
#
|
|
# DO NOT enable these features during development as they will permanently
|
|
# modify the device's eFuse configuration and can brick the device if not
|
|
# configured correctly. Test thoroughly before production deployment.
|
|
#
|
|
# See ESP-IDF Security documentation:
|
|
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/security/secure-boot-v2.html
|
|
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/security/flash-encryption.html
|
|
#
|
|
# CONFIG_SECURE_BOOT=y
|
|
# CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
|
|
|
# ============================================================================
|
|
# TinyML Configuration
|
|
# ============================================================================
|
|
# TensorFlow Lite Micro for anomaly detection is DISABLED by default.
|
|
# The feature requires a trained model file (models/anomaly_detector.tflite)
|
|
# which must be generated from real sensor data.
|
|
#
|
|
# To enable ML inference:
|
|
# 1. Train autoencoder model on grow room sensor data
|
|
# 2. Convert to TFLite format and place in models/anomaly_detector.tflite
|
|
# 3. Enable: CONFIG_CLEARGROW_ENABLE_ML=y
|
|
# 4. Rebuild and flash
|
|
#
|
|
# See docs/project/assessments/findings/controller/tinyml_inference.md
|
|
#
|
|
CONFIG_CLEARGROW_ENABLE_ML=n
|