From dac42efbd9236cfdeea6baefe65bbd3ab46abcdb Mon Sep 17 00:00:00 2001 From: Lucio Tarantino Date: Mon, 4 May 2020 00:47:24 +0200 Subject: htu21d: Support for HTI21D family sensor on I2C bus (#2803) Signed-off-by: Lucio Tarantino --- config/sample-macros.cfg | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'config/sample-macros.cfg') 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 ". +# 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))} -- cgit v1.2.3-70-g09d2