From ababc351d74b485fa733fdb6b17a7172ab012220 Mon Sep 17 00:00:00 2001 From: MadDoct <32080323+MadDoct@users.noreply.github.com> Date: Tue, 4 Sep 2018 09:45:26 +0100 Subject: [PATCH 1/3] prepare to allow h801 tx and rx pins to be gpio_user --- sonoff/sonoff.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 8d82efc18..12aea14e9 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2362,7 +2362,7 @@ void GpioInit() if (mpin) pin[mpin] = i; } - if (2 == pin[GPIO_TXD]) Serial.set_tx(2); + if ((2 == pin[GPIO_TXD]) || (Settings.module == 20)) Serial.set_tx(2); analogWriteRange(Settings.pwm_range); // Default is 1023 (Arduino.h) analogWriteFreq(Settings.pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c) From a8b673487b631a8b2f3ffdd4962dcffe93b9db93 Mon Sep 17 00:00:00 2001 From: MadDoct <32080323+MadDoct@users.noreply.github.com> Date: Tue, 4 Sep 2018 09:56:43 +0100 Subject: [PATCH 2/3] h801 tx and rx user selectable --- sonoff/sonoff_template.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sonoff/sonoff_template.h b/sonoff/sonoff_template.h index 8d3fac176..f2fe93003 100644 --- a/sonoff/sonoff_template.h +++ b/sonoff/sonoff_template.h @@ -550,8 +550,8 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { { "H801", // Lixada H801 Wifi (ESP8266) GPIO_USER, // GPIO00 E-FW Button GPIO_LED1, // GPIO01 Green LED - GPIO_TXD, // GPIO02 RX - Pin next to TX on the PCB - GPIO_RXD, // GPIO03 TX - Pin next to GND on the PCB + GPIO_USER, // GPIO02 RX and Optional sensor - Pin next to TX on the PCB + GPIO_USER, // GPIO03 TX and Optional sensor - Pin next to GND on the PCB GPIO_PWM5, // GPIO04 W2 - PWM5 GPIO_LED2_INV, // GPIO05 Red LED 0, 0, 0, 0, 0, 0, // Flash connection @@ -1019,4 +1019,4 @@ const mytmplt kModules[MAXMODULE] PROGMEM = { } */ -#endif // _SONOFF_TEMPLATE_H_ \ No newline at end of file +#endif // _SONOFF_TEMPLATE_H_ From e7ae727c659b5471fbc2713d20e9341dba36560f Mon Sep 17 00:00:00 2001 From: MadDoct <32080323+MadDoct@users.noreply.github.com> Date: Tue, 4 Sep 2018 18:53:44 +0100 Subject: [PATCH 3/3] Update sonoff.ino --- sonoff/sonoff.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonoff/sonoff.ino b/sonoff/sonoff.ino index 12aea14e9..9ada9f656 100755 --- a/sonoff/sonoff.ino +++ b/sonoff/sonoff.ino @@ -2362,7 +2362,7 @@ void GpioInit() if (mpin) pin[mpin] = i; } - if ((2 == pin[GPIO_TXD]) || (Settings.module == 20)) Serial.set_tx(2); + if ((2 == pin[GPIO_TXD]) || (H801 == Settings.module)) Serial.set_tx(2); analogWriteRange(Settings.pwm_range); // Default is 1023 (Arduino.h) analogWriteFreq(Settings.pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c)