Add shake emotion with persistent state and calibration
Introduces a new shake emotion animation with a shake-stop transition, including embedded Lottie animation data and a state machine for emotion transitions. Adds a non-volatile storage (NVS) driver for persistent state management, including first-boot detection, boot count, and IMU calibration storage. Updates emotion manager and related headers to support new shake emotion states, and integrates new UI components for calibration and loading animations.
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
#include "emotion-engine/emotion_manager.h"
|
||||
#include "drivers/display_driver.h"
|
||||
#include "emotion-engine/blink/blink_emotion.h"
|
||||
#include "emotion-engine/shake/shake_emotion.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
|
||||
static const char *TAG = "emotion_manager";
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -34,6 +34,12 @@ bool emotionManagerInit(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize shake emotion
|
||||
if (!shakeEmotionInit()) {
|
||||
ESP_LOGE(TAG, "Failed to initialize shake emotion");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Future: Initialize other emotions here
|
||||
// surprisedEmotionInit();
|
||||
// sadEmotionInit();
|
||||
@@ -72,17 +78,27 @@ void emotionManagerSetEmotion(EmotionType emotion) {
|
||||
switch (emotion) {
|
||||
case EMOTION_IDLE:
|
||||
case EMOTION_BLINK:
|
||||
// Play blink animation
|
||||
// Stop any other animations and play blink
|
||||
shakeEmotionStop();
|
||||
blinkEmotionPlay();
|
||||
break;
|
||||
|
||||
case EMOTION_SHAKING:
|
||||
// Stop blink and play shaking animation
|
||||
blinkEmotionPause();
|
||||
shakeEmotionPlay();
|
||||
break;
|
||||
|
||||
case EMOTION_SHAKE_STOPPING:
|
||||
// Begin the shake-stop transition sequence
|
||||
shakeEmotionBeginStop();
|
||||
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();
|
||||
ESP_LOGI(TAG, "Emotion %d not yet implemented", emotion);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user