Deploying to gh-pages from @ Klipper3d/klipper@9323a5dfe2 🚀

This commit is contained in:
KevinOConnor
2025-07-17 00:06:19 +00:00
parent efffd67cc9
commit 0ba73903e0
78 changed files with 3767 additions and 567 deletions

View File

@@ -1577,6 +1577,7 @@
</ul>
</li>
<li>如果使用者配置中存在錯誤,應在<code>load_config()</code>或連線事件connect event中拋出異常。使用 <code>raise config.error("my error")</code><code>raise printer.config_error("my error")</code> 進行告警。</li>
<li>Do not store a reference to the <code>config</code> object in a class member variable (nor in any similar location that may persist past initial module loading). The <code>config</code> object is a reference to a "config loading phase" class and it is not valid to invoke its methods after the "config loading phase" has completed.</li>
<li>使用"pins"模組對微控制器的引腳進行定義,例如<code>printer.lookup_object("pins").setup_pin("pwm", config.get("my_pin"))</code>。此後,執行時,可通過返回的對象對針腳進行控制。</li>
<li>如果印表機對像中定義了 <code>get_status()</code> 方法,則在模組中可以通過<a href="Command_Templates.html"></a><a href="API_Server.html">API服務</a>輸出<a href="Status_Reference.html">狀態資訊</a><code>get_status()</code> 必須返回一個Python字典對象其鍵需要為字串而值應為整形、浮點數、列表、字典、True、False或者None。元組或命名元組也可以作為值它們在API服務中將被視為列表。列表和字典的輸出值必須為「不可變的immutable即在函式內如果 <code>get_status()</code> 需要輸出上述型別的實例則需要新建或者進行深層複製否則API服務會識別出輸出值中的內容變更。</li>
<li>如果模組需要使用系統時鐘或外部檔案描述符,可通過<code>printer.get_reactor()</code>對獲取全域性事件反應器進行訪問event reactor。通過該反應器類可以部署定時器等待檔案描述符輸入或者「掛起」上位機程式。</li>