ht9045-motor-home

Diagnose and fix motor auto-home failures in HT9045 C++ firmware.

Updated May 28, 2026
One-click install
npx skills add https://github.com/HPI-Jimmy-Chiu/HT904_V899 --skill ht9045-motor-home-hpi-jimmy-chiu
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ht9045-motor-home
Source: https://github.com/HPI-Jimmy-Chiu/HT904_V899/tree/main/.agents/skills/ht9045-motor-home
Command: npx skills add https://github.com/HPI-Jimmy-Chiu/HT904_V899 --skill ht9045-motor-home-hpi-jimmy-chiu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Motor auto-home sequences in HT9045 firmware fail with 30-second timeouts or stuck HomeFlag states when code calls Home() instead of MotorHome(false), leaving axes unhomed and blocking downstream motion tasks. ## Core Features & Use Cases - HomeFlag State Machine Reference: Documents the 0/1/2 semantics of MOT[i].HomeFlag and the correct checks for in-progress, success, and failure states. - Standard Auto-Home Flow: Provides the canonical ENTRY_TASK / AUTO_HOME_WAIT / AUTO_HOME_RUN state pattern with sensor sanity checks, 30s timeout, and error reporting. - Anti-Pattern Catalog: Lists common mistakes such as calling Home() without updating HomeFlag, treating HomeFlag==2 as success, and restoring speed from GetSpeed() which returns RPM rather than a percentage. - HomeClass Batch Homing: Explains THomeClass registration, FIRST/SECOND/THREE_HOME ordering, and index alignment with MOT[] for multi-axis homing. - Use Case: When an MLoaderY axis times out during auto-home in cTrayMapping case 10/15/20, use this Skill to rewrite the sequence to call MotorHome(false) and check HomeFlag==1 for completion. ## Quick Start Ask the assistant to review the auto-home code for the MLoaderY axis and fix the 30-second timeout using the standard MotorHome pattern.

Frequently Asked Questions about ht9045-motor-home

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a motor auto-home 30s timeout in HT9045 firmware?▼

Replace calls to MOT[i].Home() with MOT[i].MotorHome(false) and check HomeFlag==1 for completion. Home() never updates HomeFlag, so the state machine loops until the external 30-second timer expires.

What do HomeFlag values 0, 1, and 2 mean?▼

HomeFlag 0 means initial or homing in progress, 1 means home completed successfully, and 2 means home failed after retry or timeout. Check ==1 for success, ==2 for failure, and !=0 to detect that homing has finished.

Why does motor speed behave wrong after restoring with GetSpeed?▼

GetSpeed returns Motor->ReadSpeed() in RPM, not the configured percentage, so restoring that value can set speed to zero. Use SetSpeed(100) or another known-good configured value instead.

How does batch Home All ordering work with HomeClass?▼

ProcessMotorHome runs three passes ordered FIRST_HOME, SECOND_HOME, then THREE_HOME, homing only axes whose THomeOrder matches the current pass and whose THomeFlag is enabled. Z axes home first, then XY, then tray and magazine axes.

When should MotorInitial be called before homing?▼

Call MotorInitial before each new homing attempt to reset Task, set HomeFlag=0, and arm the retry timer. If a previous home failed with HomeFlag=2, MotorInitial is required before MotorHome can run again.