狀態參考¶
本文件是可用於 Klipper 宏、顯示欄位以及API伺服器 的印表機狀態資訊的參考。
本文件中的欄位可能會發生變化 - 如果使用了任何欄位,在更新 Klipper 時,請務必檢視配置變化文件。
角度¶
angle some_name 對像中提供了以下信息:
temperature: The last temperature reading (in Celsius) from a tle5012b magnetic hall sensor. This value is only available if the angle sensor is a tle5012b chip and if measurements are in progress (otherwise it reportsNone).
bed_mesh¶
bed_mesh 對像中提供了以下資訊:
profile_name、mesh_min、mesh_max、probed_matrix、mesh_matrix:關於目前活躍的 bed_mesh 配置資訊。profiles:使用 BED_MESH_PROFILE 設置的當前定義的配置文件集。
bed_screws¶
The following information is available in the bed_screws object:
is_active: Returns True if the bed screws adjustment tool is currently active.state: The bed screws adjustment tool state. It is one of the following strings: "adjust", "fine".current_screw: The index for the current screw being adjusted.accepted_screws: The number of accepted screws.
canbus_stats¶
The following information is available in the canbus_stats some_mcu_name object (this object is automatically available if an mcu is configured to use canbus):
rx_error: The number of receive errors detected by the micro-controller canbus hardware.tx_error: The number of transmit errors detected by the micro-controller canbus hardware.tx_retries: The number of transmit attempts that were retried due to bus contention or errors.bus_state: The status of the interface (typically "active" for a bus in normal operation, "warn" for a bus with recent errors, "passive" for a bus that will no longer transmit canbus error frames, or "off" for a bus that will no longer transmit or receive messages).
Note that only the rp2XXX micro-controllers report a non-zero tx_retries field and the rp2XXX micro-controllers always report tx_error as zero and bus_state as "active".
configfile¶
configfile 對像中提供了以下資訊(該對像始終可用):
settings.<分段>.<選項>:返回最後一次軟體啟動或重啟時給定的配置檔案設定(或預設值)。(不會反映執行時的修改。)config.<分段>.<選項>:返回Klipper在上次軟體啟動或重啟時讀取的原始配置檔案設定。(不會反映執行時的修改。)所有值都以字串形式返回。save_config_pending:如果存在可以通過SAVE_CONFIG命令儲存到配置檔案的更新,則返回 True。save_config_pending_items: Contains the sections and options that were changed and would be persisted by aSAVE_CONFIG.warnings:有關配置選項的警告列表。列表中的每個條目都將是一個 dictionary,其中包含type和message欄位(都是字串)。根據警告型別,可能還有其他可用欄位。
display_status¶
display_status 對像中提供以下資訊(如果定義了 display 配置分段,則該對像自動可用):
progress:最後一個M73G程式碼命令報告的進度(如果沒有收到M73,則會用virtual_sdcard.progress替代)。message:最後一條M117G程式碼命令中包含的訊息。
endstop_phase¶
endstop_phase 對像中提供了以下資訊:
last_home.<步進電機名>.phase:最後一次歸為嘗試結束時步進電機的相位。last_home.<步進電機名稱>.phase:步進電機上可用的總相數。last_home.<步進電機名稱>.mcu_position:步進電機在上次歸位嘗試結束時的位置(由微控制器跟蹤)。該位置是自微控制器最後一次重啟以來,向前走的總步數減去反向走的總步數。
exclude_object¶
The following information is available in the exclude_object object:
-
objects: An array of the known objects as provided by theEXCLUDE_OBJECT_DEFINEcommand. This is the same information provided by theEXCLUDE_OBJECT VERBOSE=1command. Thecenterandpolygonfields will only be present if provided in the originalEXCLUDE_OBJECT_DEFINEHere is a JSON sample:
[
{
"polygon": [
[ 156.25, 146.2511675 ],
[ 156.25, 153.7488325 ],
[ 163.75, 153.7488325 ],
[ 163.75, 146.2511675 ]
],
"name": "CYLINDER_2_STL_ID_2_COPY_0",
"center": [ 160, 150 ]
},
{
"polygon": [
[ 146.25, 146.2511675 ],
[ 146.25, 153.7488325 ],
[ 153.75, 153.7488325 ],
[ 153.75, 146.2511675 ]
],
"name": "CYLINDER_2_STL_ID_1_COPY_0",
"center": [ 150, 150 ]
}
]
excluded_objects: An array of strings listing the names of excluded objects.current_object: The name of the object currently being printed.
extruder_stepper¶
The following information is available for extruder_stepper objects (as well as extruder objects):
pressure_advance: The current pressure advance value.smooth_time: The current pressure advance smooth time.motion_queue: The name of the extruder that this extruder stepper is currently synchronized to. This is reported asNoneif the extruder stepper is not currently associated with an extruder.
fan¶
fan、heater_fan some_name和controller_fan some_name對像提供了以下資訊:
speed:風扇速度,0.0和1.0之間的浮點數。rpm:如果風扇有一個 tachometer_pin,則測量的風扇速度,單位是每分鐘轉數。
filament_switch_sensor¶
filament_switch_sensor some_name 對像提供了以下資訊:
enabled:如果開關感測器目前已啟用,則返回True。filament_detected:如果感測器處於觸發狀態,則返回 True。
filament_motion_sensor¶
filament_motion_sensor 感測器名 對像提供了以下資訊:
enabled:如果目前啟用了運動感測器,則返回 True。filament_detected:如果感測器處於觸發狀態,則返回 True。
firmware_retraction¶
firmware_retraction 對像提供了以下資訊:
retract_length、retract_speed、unretract_extra_length、unretract_speed:firmware_retraction 模組的當前設定。如果SET_RETRACTION命令改變它們,這些設定可能與配置檔案不同。
gcode¶
The following information is available in the gcode object:
commands: Returns a list of all currently available commands. For each command, if a help string is defined it will also be provided.
gcode_button¶
The following information is available in gcode_button some_name objects:
state: The current button state returned as "PRESSED" or "RELEASED"
gcode_macro¶
gcode_macro <名稱> 對像提供了以下資訊:
<變數名>:gcode_macro 變數 的當前值。
gcode_move¶
gcode_move 對像中提供了以下資訊(該對像始終可用):
gcode_position: The current position of the toolhead relative to the current G-Code origin. That is, positions that one might directly send to aG1command. This value is encoded as a coordinate.position: The last commanded position of the toolhead using the coordinate system specified in the config file. This value is encoded as a coordinate.homing_origin: The origin of the gcode coordinate system (relative to the coordinate system specified in the config file) to use after aG28command. TheSET_GCODE_OFFSETcommand can alter this position. This value is encoded as a coordinate.speed:在G1命令中最後一次設定的速度(單位:mm/s)。speed_factor:通過M220命令設定的"速度因子覆蓋"。這是一個浮點值,1.0 意味著沒有覆蓋,例如,2.0 將請求的速度翻倍。extrude_factor:由M221命令設定的"擠出倍率覆蓋" 。這是一個浮點值,1.0意味著沒有覆蓋,例如,2.0將使要求的擠出量翻倍。absolute_coordinates:如果在G90絕對座標模式下,則返回 True;如果在G91相對模式下,則返回 False。absolute_extrude:如果在M82絕對擠出模式,則返回True;如果在M83相對模式,則返回False。axis_map: Provides a mechanism for finding the coordinate component for a given G-Code id that is used inG1commands. See the Accessing Coordinates section for details.
hall_filament_width_sensor¶
hall_filament_width_sensor 對像提供了以下資訊:
- all items from filament_switch_sensor
is_active:如果感測器目前處於活動狀態,返回True。flow_compensation_enabled: Returns True if flow compensation is enabled.Diameter: Returns the last width reading in mm if the sensor is active or the nominal filament diameter if it is not.Raw:上一次感測器原始 ADC 讀數。
heater¶
加熱器對象,如extruder、heater_bed和heater_generic,提供了以下資訊:
temperature:給定加熱器最後報告的溫度(以攝氏度為單位的浮點數)。target:給定加熱器的當前目標溫度(以攝氏度為單位的浮點數)。power:與加熱器相關的 PWM 引腳的最後設定(0.0和1.0之間的數值)。can_extrude:擠出機是否可以擠出(由min_extrude_temp定義),僅可用於extruder
heaters¶
heaters 對像中提供以下資訊(如果定義了任何加熱器,則該對象可用):
available_heaters:返回所有當前可用加熱器的完整配置分段名稱,例如["extruder"、"heater_bed"、"heater_generic my_custom_heater"]。available_sensors:返回所有當前可用的溫度感測器的完整配置分段名稱列表,例如:["extruder", "heater_bed", "heater_generic my_custom_heater", "temperature_sensor electronics_temp"]。available_monitors: Returns a list of all currently available temperature monitors by their full config section names, e.g.["tmc2240 stepper_x"]. While a temperature sensor is always available to read, a temperature monitor may not be available and will return null in such case.
idle_timeout¶
idle_timeout 對像中提供了以下資訊(該對像始終可用):
state:由 idle_timeout 模組跟蹤的印表機的當前狀態。它可以是以下字串之一:"Idle", "Printing", "Ready"。printing_time:印表機處於「Printing」狀態的時間(以秒為單位)(由 idle_timeout 模組跟蹤)。idle_timeout: The current 'timeout' (in seconds) to wait for the gcode to be triggered. (as set by SET_IDLE_TIMEOUT)
led¶
The following information is available for each [led led_name], [neopixel led_name], [dotstar led_name], [pca9533 led_name], and [pca9632 led_name] config section defined in printer.cfg:
color_data: A list of color lists containing the RGBW values for a led in the chain. Each value is represented as a float from 0.0 to 1.0. Each color list contains 4 items (red, green, blue, white) even if the underlying LED supports fewer color channels. For example, the blue value (3rd item in color list) of the second neopixel in a chain could be accessed atprinter["neopixel <config_name>"].color_data[1][2].
load_cell¶
The following information is available for each [load_cell name]:
is_calibrated: True/False whether the load cell is calibrated.counts_per_gram: The number of raw sensor counts that equals 1 gram of force.reference_tare_counts: The reference number of raw sensor counts for 0 force.tare_counts: The current number of raw sensor counts for 0 force.force_g: The force in grams, averaged over the last polling period.min_force_g: The minimum force in grams, over the last polling period.max_force_g: The maximum force in grams, over the last polling period.errors: The number of sensor errors detected since the last start of measurements.overflows: The number of data buffer overflows detected since the last start of measurements.sample_rate: The sensor's sample rate in samples per second.
load_cell_probe¶
The following information is available for [load_cell_probe]:
- all items from load_cell
- all items from probe
endstop_tare_counts: The load cell probe keeps a tare value independent of the load cell. This is re-set at the start of each probe.last_trigger_time: Timestamp of the last homing trigger.last_z_result: The Z position result of the last tap.is_last_tap_valid: True if the last tap result is valid.
manual_probe¶
The following information is available in the manual_probe object:
is_active: Returns True if a manual probing helper script is currently active.z_position: The current height of the nozzle (as the printer currently understands it).z_position_lower: Last probe attempt just lower than the current height.z_position_upper: Last probe attempt just greater than the current height.
mcu¶
mcu和mcu some_name對像提供了以下資訊:
mcu_version:由微控制器報告的 Klipper 程式碼版本。mcu_build_versions:有關用於產生微控制器程式碼的構建工具的資訊(由微控制器報告)。mcu_constants.<常量名>:由微控制器報告編譯時使用的常量。可用的常量在不同的微控制器架構和每個程式碼修訂版中可能有所不同。last_stats.<統計資訊名>:關於微控制器連線的統計資訊。
motion_report¶
motion_report 對像提供了以下資訊(如果定義了任何步進器配置分段,則該對像自動可用):
live_position: The requested toolhead position interpolated to the current time. This value is encoded as a coordinate.live_velocity:目前請求的列印頭速度(以毫米/秒為單位)。live_extruder_velocity:目前請求的擠出機速度(單位:mm/s)。
output_pin¶
The following information is available in output_pin some_name and pwm_tool some_name objects:
value:由SET_PIN指令設定的引腳「值」。
palette2¶
palette2 對像提供了以下資訊:
ping。最後一次報告的Palette 2 ping值(百分比)。remaining_load_length:當開始一個使用 Palette 2 的列印時,這是需要載入到擠出機中的耗材長度。is_splicing:當Palette 2正在拼接耗材時為 True。
pause_resume¶
palette2 對像提供了以下資訊:
is_paused:如果執行了 PAUSE 命令而沒有執行 RESUME,則返回 True。
print_stats¶
print_stats 對像提供了以下資訊(如果定義了 virtual_sdcard 配置分段,則此對像自動可用):
filename、total_duration、print_duration、filament_used、state、message:virtual_sdcard 列印處於活動狀態時有關目前列印的估測。info.total_layer: The total layer value of the lastSET_PRINT_STATS_INFO TOTAL_LAYER=<value>G-Code command.info.current_layer: The current layer value of the lastSET_PRINT_STATS_INFO CURRENT_LAYER=<value>G-Code command.
probe¶
probe 對像中提供了以下資訊(如果定義了 bltouch 配置分段,則此對象也可用):
name: Returns the name of the probe in use.last_query:如果探針在上一個 QUERY_PROBE 命令期間報告為"已觸發",則返回 True。請注意,如果在宏中使用它,根據模板展開的順序,必須在包含此引用的宏之前執行 QUERY_PROBE 命令。last_probe_position: The results of the lastPROBEcommand. This value is encoded as a coordinate. The probe hardware estimates that if one were to command the toolhead to XY positionlast_probe_position.x,last_probe_position.yand descend then the tip of the toolhead would first contact the bed at a Z height oflast_probe_position.z. These coordinates are relative to the frame (that is, they use the coordinate system specified in the config file). Note, if this is used in a macro, due to the order of template expansion, thePROBEcommand must be run prior to the macro containing this reference.last_z_result: This value is deprecated; it will be removed in the near future.
pwm_cycle_time¶
The following information is available in pwm_cycle_time some_name objects:
value:由SET_PIN指令設定的引腳「值」。
quad_gantry_level¶
quad_gantry_level 對像提供了以下資訊(如果定義了 quad_gantry_level,則該對象可用):
applied:如果龍門調平已執行併成功完成,則為 True。
query_endstops¶
query_endstops 對像提供以下資訊(如果定義了任何限位,則該對象可用):
last_query["<限位>"]:如果在最後一次 QUERY_ENDSTOP 命令中,給定的 endstop 處於「觸發」狀態,則返回 True。注意,如果在宏中使用,由於模板擴充套件的順序,QUERY_ENDSTOP 命令必須在包含這個引用的宏之前執行。
screws_tilt_adjust¶
The following information is available in the screws_tilt_adjust object:
error: Returns True if the most recentSCREWS_TILT_CALCULATEcommand included theMAX_DEVIATIONparameter and any of the probed screw points exceeded the specifiedMAX_DEVIATION.max_deviation: Return the lastMAX_DEVIATIONvalue of the most recentSCREWS_TILT_CALCULATEcommand.results["<screw>"]: A dictionary containing the following keys:z: The measured Z height of the screw location.sign: A string specifying the direction to turn to screw for the necessary adjustment. Either "CW" for clockwise or "CCW" for counterclockwise.adjust: The number of screw turns to adjust the screw, given in the format "HH:MM," where "HH" is the number of full screw turns and "MM" is the number of "minutes of a clock face" representing a partial screw turn. (E.g. "01:15" would mean to turn the screw one and a quarter revolutions.)is_base: Returns True if this is the base screw.
servo¶
servo some_name 對像提供了以下資訊:
printer["servo <配置名>"].value:與指定伺服相關 PWM 引腳的上一次設定的值(0.0 和 1.0 之間的值)。
skew_correction.py¶
The following information is available in the skew_correction object (this object is available if any skew_correction is defined):
current_profile_name: Returns the name of the currently loaded SKEW_PROFILE.
stepper_enable¶
The following information is available in the stepper_enable object (this object is available if any stepper is defined):
steppers["<stepper>"]: Returns True if the given stepper is enabled.
system_stats¶
system_stats 對像提供了以下資訊(該對像始終可用):
sysload、cputime、memavail:關於主機操作系統和程序負載的資訊。
溫度感測器¶
以下資訊可在
bme280 config_section_name, htu21d config_section_name, sht3x config_section_name, lm75 config_section_name, temperature_host config_section_name and temperature_combined config_section_name objects:
temperature:上一次從感測器讀取的溫度。humidity,pressure,gas: The last read values from the sensor (only on bme280, htu21d, sht3x and lm75 sensors).
temperature_fan¶
temperature_fan some_name 對像提供了以下資訊:
temperature:上一次從感測器讀取的溫度。target:風扇目標溫度。
temperature_sensor¶
temperature_sensor some_name 對像提供了以下資訊:
temperature:上一次從感測器讀取的溫度。measured_min_temp和measured_max_temp:自Klipper主機軟體上次重新啟動以來,感測器測量的最低和最高溫度。
tmc 驅動¶
TMC 步進驅動對像(例如,[tmc2208 stepper_x])提供了以下資訊:
mcu_phase_offset:微控制器步進位置與驅動器的"零"相位的相對位置。如果相位偏移未知,則此欄位可能為空。phase_offset_position:對應電機「零」相位的「指令位置」。如果相位偏移未知,則該欄位可以為空。drv_status:上次驅動狀態查詢結果。(僅報告非零欄位。如果驅動沒有被啟用(因此沒有輪詢),則此欄位將為 null。temperature: The internal temperature reported by the driver. This field will be null if the driver is not enabled or if the driver does not support temperature reporting.run_current:目前設定的執行電流。hold_current:目前設定的保持電流。
toolhead¶
toolhead 對像提供了以下資訊(該對像始終可用):
position: The last commanded position of the toolhead relative to the coordinate system specified in the config file. This value is encoded as a coordinate.extruder:目前活躍的擠出機的名稱。例如,在宏中可以使用printer[printer.toolhead.extruder].target來獲取目前擠出機的目標溫度。homed_axes:目前被認為處於「已歸位」狀態的車軸。這是一個包含一個或多個"x"、"y"、"z"的字串。axis_minimum,axis_maximum: The axis travel limits (mm) after homing. This value is encoded as a coordinate.- For Delta printers the
cone_start_zis the max z height at maximum radius (printer.toolhead.cone_start_z). max_velocity,max_accel,minimum_cruise_ratio,square_corner_velocity: The current printing limits that are in effect. This may differ from the config file settings if aSET_VELOCITY_LIMIT(orM204) command alters them at run-time.stalls:由於工具頭移動速度快于從 G 程式碼輸入讀取的移動速度,因此印表機必須暫停的總次數(自上次重新啟動以來)。extra_axes: Provides a mechanism for finding the coordinate component for extra axes available in standardG1type move commands. See the Accessing Coordinates section for details.
dual_carriage¶
The following information is available in dual_carriage on a cartesian, hybrid_corexy or hybrid_corexz robot
carriage_0: The mode of the carriage 0. Possible values are: "INACTIVE" and "PRIMARY".carriage_1: The mode of the carriage 1. Possible values are: "INACTIVE", "PRIMARY", "COPY", and "MIRROR".
On a generic_cartesian kinematic, the following information is available in dual_carriage:
carriages["<carriage>"]: The mode of the carriage<carriage>. Possible values are "INACTIVE" and "PRIMARY" for the primary carriage and "INACTIVE", "PRIMARY", "COPY", and "MIRROR" for the dual carriage.
virtual_sdcard¶
virtual_sdcard對像提供了以下資訊:
is_active:如果正在從檔案進行列印,則返回 True。progress:對當前列印進度的估計(基於檔案大小和檔案位置)。file_path:目前載入的檔案的完整路徑。file_position:目前列印的位置(以位元組為單位)。file_size:目前載入的檔案的大小(以位元組為單位)。
webhooks¶
system_stats 對像提供了以下資訊(該對像始終可用):
state:返回一個表示目前 Klipper 狀態的字串。可能的值為:"ready"、"startup"、"shutdown"和"error"。state_message:提供了一個包含目前 Klipper 狀態和上下文的可讀字串。
z_thermal_adjust¶
The following information is available in the z_thermal_adjust object (this object is available if z_thermal_adjust is defined).
enabled: Returns True if adjustment is enabled.temperature: Current (smoothed) temperature of the defined sensor. [degC]measured_min_temp: Minimum measured temperature. [degC]measured_max_temp: Maximum measured temperature. [degC]current_z_adjust: Last computed Z adjustment [mm].z_adjust_ref_temperature: Current reference temperature used for calculation of Zcurrent_z_adjust[degC].
z_tilt¶
z_tilt 對像提供了以下資訊(如果定義了 z_tilt,則該對象可用):
applied:如果 z 傾斜調平過程已執行併成功完成,則為 True。
Accessing Coordinates¶
Some status fields provide a "coordinate". For macro users these fields may be accessed by component name (eg,{printer.toolhead.position.x}), where the component name may be "x", "y", or "z".
For developers using the Klipper API Server these fields are transmitted as a list - for example: {"toolhead": {"position": [1.0, 2.0, 3.0, 7.3, 19.2]}} . The first three components of the list correspond with the x, y, and z axes.
A coordinate will typically have at least 3 components (x, y, and z), however there may also be additional components. Care should be taken when accessing any of these additional components as the ordering and number of components may change at run-time.
One may use {printer.gcode_move.axis_map} and/or {printer.toolhead.extra_axes} to determine the number of components and the ordering of components. For example, to access the "E" component one could use {printer.toolhead.position[printer.gcode_move.axis_map.E]}. Or, if one wanted to find the component associated with the "extruder" object, one could use {printer.toolhead.position[printer.toolhead.extra_axes.extruder]}.