diff options
Diffstat (limited to 'config/sample-macros.cfg')
-rw-r--r-- | config/sample-macros.cfg | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/config/sample-macros.cfg b/config/sample-macros.cfg index 5f965fb1..3b92e34b 100644 --- a/config/sample-macros.cfg +++ b/config/sample-macros.cfg @@ -115,3 +115,35 @@ gcode: G91 G1 E-50 F1000 RESTORE_GCODE_STATE NAME=M600_state + +###################################################################### +# BME280 Environmental Sensor +###################################################################### + +# The macro below assumes you have a BME280 sensor_type defined in one +# of the applicable sections in printer.cfg, such as: +# +#[temperature_sensor my_sensor] +#sensor_type: BME280 +#gcode_id: AMB +# +# Note the format of the parameter SENSOR in the macro below. The BME280 +# sensor status can be accessed using the format "bme280 <section_name>". +# The example section above is named "my_sensor", thus the bme280 can be +# queried as follows: +# +# QUERY_BME280 SENSOR='bme280 my_sensor' +# +# Since a default parameter is defined one could simply enter QUERY_BME280 +# as well. + +[gcode_macro QUERY_BME280] +default_parameter_SENSOR: bme280 my_sensor +gcode: + {printer.gcode.action_respond_info( + "Temperature: %.2f C\n" + "Pressure: %.2f hPa\n" + "Humidity: %.2f%%" % ( + printer[SENSOR].temperature, + printer[SENSOR].pressure, + printer[SENSOR].humidity))} |