Merge pull request #8189 from VanillaFord/development

enable single PIN mode for SR04 sensor
This commit is contained in:
Theo Arends 2020-04-18 15:17:51 +02:00 committed by GitHub
commit b36ce0d048
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)) {