aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorLucio Tarantino <lucio.tarantino@gmail.com>2020-05-04 00:47:24 +0200
committerGitHub <noreply@github.com>2020-05-03 18:47:24 -0400
commitdac42efbd9236cfdeea6baefe65bbd3ab46abcdb (patch)
tree06823885e06d40b914af9f9165f453e6824c7fda /config
parentf8649b4ba9347bde03191bb0820ab23142a0b429 (diff)
downloadkutter-dac42efbd9236cfdeea6baefe65bbd3ab46abcdb.tar.gz
kutter-dac42efbd9236cfdeea6baefe65bbd3ab46abcdb.tar.xz
kutter-dac42efbd9236cfdeea6baefe65bbd3ab46abcdb.zip
htu21d: Support for HTI21D family sensor on I2C bus (#2803)
Signed-off-by: Lucio Tarantino <lucio.tarantino@gmail.com>
Diffstat (limited to 'config')
-rw-r--r--config/example-extras.cfg34
-rw-r--r--config/sample-macros.cfg29
2 files changed, 63 insertions, 0 deletions
diff --git a/config/example-extras.cfg b/config/example-extras.cfg
index 830381ce..7463051c 100644
--- a/config/example-extras.cfg
+++ b/config/example-extras.cfg
@@ -966,6 +966,40 @@
# The I2C speed (in Hz) to use when communicating with the sensor. Default
# is 100000. On some MCUs changing this value has no effect.
+# HTU21D family 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) and relative humidity.
+# See sample-macros.cfg for a gcode_macro that may be used to report 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 HTU21D family sensor parameters.
+#sensor_type:
+# Must be "HTU21D" , "SI7013", "SI7020", "SI7021" or "SHT21"
+#i2c_address:
+# Default is 64 (0x40).
+#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.
+#htu21d_hold_master:
+# If the sensor can hold the I2C buf while reading. If True no other bus
+# comunication can be performed while reading is in progress.Default is False
+#htu21d_resolution:
+# The resolution of temperature and humidity reading.
+# Valid values are:
+# 'TEMP14_HUM12' -> 14bit for Temp and 12bit for humidity
+# 'TEMP13_HUM10' -> 13bit for Temp and 10bit for humidity
+# 'TEMP12_HUM08' -> 12bit for Temp and 08bit for humidity
+# 'TEMP11_HUM11' -> 11bit for Temp and 11bit for humidity
+# Default is: "TEMP11_HUM11"
+#htu21d_report_time:
+# interval in seconds between readings. Default is 30
+
# Generic heaters (one may define any number of sections with a
# "heater_generic" prefix). These heaters behave similarly to standard
# heaters (extruders, heated beds). Use the SET_HEATER_TEMPERATURE
diff --git a/config/sample-macros.cfg b/config/sample-macros.cfg
index 3b92e34b..60ec51ec 100644
--- a/config/sample-macros.cfg
+++ b/config/sample-macros.cfg
@@ -147,3 +147,32 @@ gcode:
printer[SENSOR].temperature,
printer[SENSOR].pressure,
printer[SENSOR].humidity))}
+
+######################################################################
+# HTU21D family Environmental Sensor
+######################################################################
+
+# The macro below assumes you have a HTU21D sensor_type defined in one
+# of the applicable sections in printer.cfg, such as:
+#
+#[temperature_sensor my_sensor]
+#sensor_type: HTU21D
+#
+# Note the format of the parameter SENSOR in the macro below. The HTU21D
+# sensor status can be accessed using the format "htu21d <section_name>".
+# The example section above is named "my_sensor", thus the htu21d can be
+# queried as follows:
+#
+# QUERY_HTU21D SENSOR='htu21d my_sensor'
+#
+# Since a default parameter is defined one could simply enter QUERY_HTU21D
+# as well.
+
+[gcode_macro QUERY_HTU21D]
+default_parameter_SENSOR: htu21d my_sensor
+gcode:
+ {printer.gcode.action_respond_info(
+ "Temperature: %.2f C\n"
+ "Humidity: %.2f%%" % (
+ printer[SENSOR].temperature,
+ printer[SENSOR].humidity))}