Loading README.md +7 −3 Original line number Diff line number Diff line Loading @@ -64,13 +64,17 @@ If desired, **sds011.lua** can be used to configure the SDS011 sensor. Currently, the following commands are supported * `port:write(sds011.set_report_mode(active))` * active == nil: request current mode; do not change it. The mode can be read from `sds011.active_mode` after a few milliseconds. * active == true: periodically report PM2.5 and PM10 values via UART * active == false: only report PM2.5 and PM10 values when queried * `port:write(sds011.sleep(sleep))` * sleep == true: put sensor into sleep mode. The fan is turned off, no further measurements are performed * sleep == false: wake up sensor. * sleep == true: put sensor into sleep mode. The fan is turned off, no further measurements are performed. * sleep == false: wake up sensor * `port:write(sds011.set_work_period(period))` * period == nil: request current work period; does not change it * period == nil: request current work period; do not change it. The work period can be read from `sds011.work_period` after a few milliseconds. * period == 0: continuous operation (about one measurement per second) * 0 < *period* ≤ 30: about one measurement every *period* minutes; fan turned off in-between Loading sds011.lua +6 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ local c_sleep = 0x00 local c_work = 0x01 local c_workperiod = 0x08 sds011.work_period = 0 sds011.work_period = nil sds011.active_mode = nil function sds011.finish_cmd(cmd) cmd = cmd .. string.char(0xff, 0xff) Loading Loading @@ -90,8 +91,10 @@ function sds011.parse_frame(data) sds011.pm10i = pm10 / 10 sds011.pm10f = pm10 % 10 return true end if command == 0xc5 and pm25l == 0x08 then elseif command == 0xc5 and pm25l == 0x02 then sds011.active_mode = pm10l == 0 return true elseif command == 0xc5 and pm25l == 0x08 then sds011.work_period = pm10l return true end Loading Loading
README.md +7 −3 Original line number Diff line number Diff line Loading @@ -64,13 +64,17 @@ If desired, **sds011.lua** can be used to configure the SDS011 sensor. Currently, the following commands are supported * `port:write(sds011.set_report_mode(active))` * active == nil: request current mode; do not change it. The mode can be read from `sds011.active_mode` after a few milliseconds. * active == true: periodically report PM2.5 and PM10 values via UART * active == false: only report PM2.5 and PM10 values when queried * `port:write(sds011.sleep(sleep))` * sleep == true: put sensor into sleep mode. The fan is turned off, no further measurements are performed * sleep == false: wake up sensor. * sleep == true: put sensor into sleep mode. The fan is turned off, no further measurements are performed. * sleep == false: wake up sensor * `port:write(sds011.set_work_period(period))` * period == nil: request current work period; does not change it * period == nil: request current work period; do not change it. The work period can be read from `sds011.work_period` after a few milliseconds. * period == 0: continuous operation (about one measurement per second) * 0 < *period* ≤ 30: about one measurement every *period* minutes; fan turned off in-between Loading
sds011.lua +6 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,8 @@ local c_sleep = 0x00 local c_work = 0x01 local c_workperiod = 0x08 sds011.work_period = 0 sds011.work_period = nil sds011.active_mode = nil function sds011.finish_cmd(cmd) cmd = cmd .. string.char(0xff, 0xff) Loading Loading @@ -90,8 +91,10 @@ function sds011.parse_frame(data) sds011.pm10i = pm10 / 10 sds011.pm10f = pm10 % 10 return true end if command == 0xc5 and pm25l == 0x08 then elseif command == 0xc5 and pm25l == 0x02 then sds011.active_mode = pm10l == 0 return true elseif command == 0xc5 and pm25l == 0x08 then sds011.work_period = pm10l return true end Loading