mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 14:57:16 +00:00
Increase SR04 max sensor detection distance
Increase SR04 max sensor detection distance to 500 (#11372)
This commit is contained in:
parent
c87a4df7e9
commit
be46611f57
@ -673,6 +673,7 @@
|
||||
#define STARTING_OFFSET 30 // Turn on NovaSDS XX-seconds before tele_period is reached
|
||||
//#define USE_HPMA // Add support for Honeywell HPMA115S0 particle concentration sensor (+1k4)
|
||||
//#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
|
||||
#define SR04_MAX_SENSOR_DISTANCE 500 // Set sensor max detection distance
|
||||
//#define USE_DYP // Add support for DYP ME-007 ultrasonic distance sensor, serial port version (+0k5 code)
|
||||
#define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code)
|
||||
//#define USE_TCP_BRIDGE // Add support for Serial to TCP bridge (+1.3k code)
|
||||
|
@ -29,7 +29,11 @@
|
||||
* - https://www.dfrobot.com/wiki/index.php/Weather-proof_Ultrasonic_Sensor_SKU_:_SEN0207
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XSNS_22 22
|
||||
#define XSNS_22 22
|
||||
|
||||
#ifndef SR04_MAX_SENSOR_DISTANCE
|
||||
#define SR04_MAX_SENSOR_DISTANCE 500
|
||||
#endif
|
||||
|
||||
uint8_t sr04_type = 1;
|
||||
real64_t distance;
|
||||
@ -64,7 +68,7 @@ uint8_t Sr04TModeDetect(void)
|
||||
if (-1 == sr04_trig_pin) {
|
||||
sr04_trig_pin = Pin(GPIO_SR04_ECHO); // if GPIO_SR04_TRIG is not configured use single PIN mode with GPIO_SR04_ECHO only
|
||||
}
|
||||
sonar = new NewPing(sr04_trig_pin, sr04_echo_pin, 300);
|
||||
sonar = new NewPing(sr04_trig_pin, sr04_echo_pin, SR04_MAX_SENSOR_DISTANCE);
|
||||
} else {
|
||||
if (sonar_serial->hardwareSerial()) {
|
||||
ClaimSerial();
|
||||
|
Loading…
x
Reference in New Issue
Block a user