Refactor project structure and update display logic

Reorganized source files into new directories for config, drivers, sensors, emotion engine, and UI. Removed legacy assets and code related to previous eye animation implementation. Added new display and touch drivers, emotion manager, shake detector, and UI components. Updated CMake project name to 'irobot_display'.
This commit is contained in:
2026-01-24 15:21:50 +05:30
parent 2c731c72e3
commit 8aeaed8a15
69 changed files with 2650 additions and 10338 deletions

View File

@@ -0,0 +1,107 @@
/**
* @file emotion_manager.c
* @brief Central emotion coordination system implementation
*
* This module coordinates all emotion animations. Currently supports
* the blink emotion, with architecture ready for additional emotions.
*/
#include "emotion-engine/emotion_manager.h"
#include "drivers/display_driver.h"
#include "emotion-engine/blink/blink_emotion.h"
#include "esp_log.h"
static const char *TAG = "emotion_manager";
// ----------------------------------------------------------------------------
// Private State
// ----------------------------------------------------------------------------
static EmotionType currentEmotion = EMOTION_IDLE;
static bool initialized = false;
// ----------------------------------------------------------------------------
// Public API Implementation
// ----------------------------------------------------------------------------
bool emotionManagerInit(void) {
ESP_LOGI(TAG, "Initializing emotion manager");
// Initialize blink emotion
if (!blinkEmotionInit()) {
ESP_LOGE(TAG, "Failed to initialize blink emotion");
return false;
}
// Future: Initialize other emotions here
// surprisedEmotionInit();
// sadEmotionInit();
// angryEmotionInit();
initialized = true;
currentEmotion = EMOTION_IDLE;
ESP_LOGI(TAG, "Emotion manager initialized");
return true;
}
void emotionManagerStart(void) {
if (!initialized) {
ESP_LOGE(TAG, "Emotion manager not initialized");
return;
}
ESP_LOGI(TAG, "Starting emotion engine with idle state");
// Start the blink animation (idle state with natural blinking)
blinkEmotionPlay();
currentEmotion = EMOTION_IDLE;
}
void emotionManagerSetEmotion(EmotionType emotion) {
if (!initialized) {
ESP_LOGE(TAG, "Emotion manager not initialized");
return;
}
ESP_LOGI(TAG, "Setting emotion: %d", emotion);
currentEmotion = emotion;
// Handle emotion transitions
switch (emotion) {
case EMOTION_IDLE:
case EMOTION_BLINK:
// Play blink animation
blinkEmotionPlay();
break;
case EMOTION_SURPRISED:
case EMOTION_SAD:
case EMOTION_ANGRY:
// Future: Implement other emotion animations
// For now, trigger a blink as visual feedback
ESP_LOGI(TAG, "Emotion %d not yet implemented, using blink", emotion);
blinkEmotionPlay();
break;
default:
ESP_LOGW(TAG, "Unknown emotion type: %d", emotion);
break;
}
}
EmotionType emotionManagerGetCurrent(void) { return currentEmotion; }
void emotionManagerStop(void) {
if (!initialized) {
return;
}
ESP_LOGI(TAG, "Stopping emotion manager");
blinkEmotionStop();
// Future: Stop other emotions
initialized = false;
}