Skip to content
Open

otto #493

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/tuya.ai/your_otto_robot/app_default.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONFIG_PROJECT_VERSION="1.0.2"
CONFIG_APP_UI_EYES_240_240=y
CONFIG_TUYA_PRODUCT_ID="b05nl7xoijx4fwae"
CONFIG_APP_UI_EYES_160_160=y
CONFIG_BOARD_CHOICE_T5AI=y
CONFIG_BOARD_CHOICE_T5AI_OTTO=y
CONFIG_T5AI_OTTO_EX_MODULE_ST7789=y
CONFIG_T5AI_OTTO_EX_MODULE_GC9D01=y
CONFIG_ENABLE_LIBLVGL=y
8 changes: 4 additions & 4 deletions apps/tuya.ai/your_otto_robot/src/otto/oscillator.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void oscillator_attach(int idx, int pin, bool rev)
osc->rev = rev;
osc->pwm_channel = (TUYA_PWM_NUM_E)pin;

// 打印初始化信息
// Print initialization information
PR_DEBUG("oscillator_attach: idx=%d, pin=%d, pwm_channel=%d, rev=%s",
idx, pin, osc->pwm_channel, rev ? "true" : "false");

Expand Down Expand Up @@ -277,13 +277,13 @@ void oscillator_write(int idx, int position)

angle = MIN(MAX(angle, 0), 180);

// 计算占空比
// Calculate duty cycle
uint32_t duty = (uint32_t)((0.5 + angle / 180.0 * 2.0) * 10000 / 20);

// 计算占空比百分比 (duty/10000 * 100)
// Calculate duty cycle percentage (duty/10000 * 100)
//float duty_percent = (float)duty / 100.0f;

// 合并的占空比打印信息 - 显示百分比
// Combined duty cycle print information - display percentage
// PR_DEBUG("oscillator_write: idx=%d, pin=%d, pwm_channel=%d, pos=%d->angle=%d(trim:%d), duty=%d, duty_percent=%.1f%%",
// idx, osc->pin, osc->pwm_channel, position, angle, osc->trim, duty, duty_percent);

Expand Down
8 changes: 4 additions & 4 deletions apps/tuya.ai/your_otto_robot/src/otto/otto_movements.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ static unsigned long millis()
}

/**
* @brief 重置所有振荡器相位到初始状态
* 解决相位累积导致的不协调问题
* @brief Reset all oscillator phases to initial state
* Resolves coordination issues caused by phase accumulation
*/
static void otto_reset_all_oscillators(void)
{
Expand Down Expand Up @@ -246,7 +246,7 @@ void otto_execute(int amplitude[SERVO_COUNT], int offset[SERVO_COUNT], int perio
g_otto.is_otto_resting = false;
}

// 关键修复:在开始执行前重置所有振荡器相位,确保每次运动都从相同初始状态开始
// Critical fix: Reset all oscillator phases before starting execution to ensure each movement starts from the same initial state
otto_reset_all_oscillators();

int cycles = (int)steps;
Expand All @@ -269,7 +269,7 @@ void otto_home(bool hands_down)

// if (g_otto.is_otto_resting == false) { // Go to rest position only if necessary

// 关键修复:在回到home位置前,先重置所有振荡器相位,确保状态完全重置
// Critical fix: Reset all oscillator phases before returning to home position to ensure complete state reset
otto_reset_all_oscillators();

int homes[SERVO_COUNT];
Expand Down
Loading