Skip to content

Commit

Permalink
Major improvements
Browse files Browse the repository at this point in the history
Serial communications are now MUCH faster!

- The original method induced a 1-second delay after every command; now, after a command is sent, it awaits a response of either “Done” or “Error” so that it can return instantly.

- Now that sending commands involves checking for a “Done” or “Error” response, all configuration methods now return boolean to indicate whether the change was successful.

- Reading presence status via serial is now almost as fast as `digitalRead()`

New methods:

- `configBegin()` and `configEnd()` allow you to make multiple configuration changes with only a single call to `stop()`, `saveConfig()` and `start()`

- `setTriggerLatency()` allows you to configure delays on confirmation (amount of time that continuous presence activity must be detected before asserting a presence state) and disappearance (amount of time that must not contain any presence activity before deasserting a presence state).

- `begin()` doesn’t currently do anything, but reserved for future use.

Removed methods related to auto-start since there’s not a straightforward way to determine whether the sensor is running.  Factory default is for the sensor to automatically start on power-up, so it’s safer to operate around that assumption.  I may restore these methods at a later date, especially if I decide on what `begin()` will do.
  • Loading branch information
MaffooClock committed Nov 9, 2023
1 parent 0030243 commit fcde099
Show file tree
Hide file tree
Showing 5 changed files with 365 additions and 169 deletions.
3 changes: 2 additions & 1 deletion examples/Basic-DigitalTrigger/Basic-DigitalTrigger.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* This is a basic example of how to instantiate a DFR_Radar object using
* the second UART available on most Arduino boards. This example is almost
* identical to the Basic.ino, except this one uses a digital input to check
* for presence triggering instead of querying over serial -- much faster!
* for presence triggering instead of querying over serial, which could be
* somewhat faster.
*
* The detection area and sensitivity are set quite low to make it easier
* to test the unit right in front of you (too high and it'll just stay
Expand Down
5 changes: 1 addition & 4 deletions examples/Basic-SoftwareSerial/Basic-SoftwareSerial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ void loop()
* be missed.
*/

// Query the presence detection status -- this is
// kind of slow since it communicates via serial.
// This can slow your loop down up to 100ms per
// iteration or more.
// Query the presence detection status
bool presence = sensor.checkPresence();

// If presence == true, turn on the built-in LED.
Expand Down
5 changes: 1 addition & 4 deletions examples/Basic/Basic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ void loop()
* be missed.
*/

// Query the presence detection status -- this is
// kind of slow since it communicates via serial.
// This can slow your loop down up to 100ms per
// iteration or more.
// Query the presence detection status
bool presence = sensor.checkPresence();

// If presence == true, turn on the built-in LED.
Expand Down
Loading

0 comments on commit fcde099

Please sign in to comment.