Startup Test Design Specification¶
This document specifies the design of the startup test sequence that provides visual feedback during system initialization, demonstrating hardware functionality.
Document Version: 2.0 Last Updated: 2025-11-12
Overview¶
The startup test executes a sequential LED pattern after LED controller initialization, providing users immediate visual confirmation that the device is booting properly and all LEDs are functional.
Integration Architecture¶
Design: Startup test executes after LED controller initialization in main() function. Implementation:
Architecture Flow: main() → led_controller_init() → led_running_test_single_cycle() → normal_operation()
Validation: LED controller must be successfully initialized before startup test can execute. |
Test Algorithm¶
Design: Single moving LED pattern implemented using sequential clear-set-show operations. Core Algorithm ( for (uint16_t i = 0; i < led_count; i++) {
// Clear previous LED (wrap around for first LED)
if (i > 0) {
led_clear_pixel(i - 1);
} else {
led_clear_pixel(led_count - 1); // Clear last LED on first iteration
}
// Set current LED
led_set_pixel(i, color);
led_show(); // Update physical LEDs
vTaskDelay(pdMS_TO_TICKS(delay_ms)); // Timing control
}
Design Characteristics:
Current Implementation:
Validation: LEDs light sequentially from first to last position with visible timing. |
Startup Integration¶
Design: One-time execution pattern with proper LED state management. Integration Pattern (from main.c): // 1. Initialize LED controller
led_controller_init(&led_config);
// 2. Clear initial state
led_clear_all();
led_show();
// 3. Execute startup test
ESP_LOGI(TAG, "Running one-time LED hardware test...");
led_running_test_single_cycle(LED_COLOR_GREEN, 50);
ESP_LOGI(TAG, "Hardware test completed");
// 4. Clean up for normal operation
led_clear_all();
led_show();
// 5. Continue with normal initialization
Design Characteristics:
Performance:
Validation: Test completes within reasonable time, all LEDs cleared after completion. |
Component Structure¶
Design: Minimal component structure with clear API and dependencies. Component Structure: main/components/startup_tests/
├── led_running_test.h // Public API
├── led_running_test.c // Implementation
└── CMakeLists.txt // Build config
API Design:
Alternative Patterns:
Validation: Component structure clean, API minimal, dependencies clear, alternative patterns available for diagnostics. |