config: add BME280 documentation

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-01-11 20:17:14 -05:00 committed by KevinOConnor
parent 2159f398ea
commit b562328bd0
2 changed files with 53 additions and 0 deletions

View File

@ -821,6 +821,27 @@
# chips. The defaults for each parameter are next to the parameter # chips. The defaults for each parameter are next to the parameter
# name in the above list. # name in the above list.
# BME280 two wire interface (I2C) environmental sensor. Note that this
# sensor is not intended for use with extruders and heater beds, but rather
# for montitoring ambient temperature (C), pressure (hPa), and relative
# humidity. See sample-macros.cfg for a gcode_macro that may be used to report
# pressure and humidity in addition to temperature.
#[temperature_sensor my_sensor]
# See the "temperature_sensor" section below for a description of its
# parameters. The parameters below describe BME280 sensor parameters.
#sensor_type:
# Must be "BME280"
#i2c_address:
# Default is 118 (0x76). Some BME280 sensors have an address of 119 (0x77).
#i2c_mcu:
# MCU the sensor is connected to. Default is the primary mcu.
#i2c_bus:
# The I2C bus the sensor is connected to. On some MCU platforms the default
# is bus 0. On platforms without bus 0 this parameter is required.
#i2c_speed:
# The I2C speed (in Hz) to use when communicating with the sensor. Default
# is 100000. On some MCUs changing this value has no effect.
# Common temperature amplifiers. The following parameters are # Common temperature amplifiers. The following parameters are
# available in heater sections that use one of these sensors. # available in heater sections that use one of these sensors.
#[extruder] #[extruder]

View File

@ -115,3 +115,35 @@ gcode:
G91 G91
G1 E-50 F1000 G1 E-50 F1000
RESTORE_GCODE_STATE NAME=M600_state 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))}