mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8189 from VanillaFord/development
enable single PIN mode for SR04 sensor
This commit is contained in:
commit
b36ce0d048
|
@ -43,7 +43,7 @@ uint8_t Sr04TModeDetect(void)
|
|||
if (99 == pin[GPIO_SR04_ECHO]) { return sr04_type; }
|
||||
|
||||
int sr04_echo_pin = pin[GPIO_SR04_ECHO];
|
||||
int sr04_trig_pin = (pin[GPIO_SR04_TRIG] < 99) ? pin[GPIO_SR04_TRIG] : -1;
|
||||
int sr04_trig_pin = (pin[GPIO_SR04_TRIG] < 99) ? pin[GPIO_SR04_TRIG] : pin[GPIO_SR04_ECHO]; // if GPIO_SR04_TRIG is not configured use single PIN mode with GPIO_SR04_ECHO only
|
||||
sonar_serial = new TasmotaSerial(sr04_echo_pin, sr04_trig_pin, 1);
|
||||
|
||||
if (sonar_serial->begin(9600,1)) {
|
||||
|
|
Loading…
Reference in New Issue