Fix Shelly Pro ethernet stability

This commit is contained in:
Theo Arends 2022-10-27 17:52:44 +02:00
parent cef18060a0
commit 90a9ebc3e1
3 changed files with 20 additions and 4 deletions

View File

@ -559,6 +559,7 @@ void setup(void) {
bitWrite(Settings->rule_enabled, i, 0); // Disable rules causing boot loop
}
}
Settings->flag4.network_wifi = 1; // Enable wifi if disabled
}
if (RtcReboot.fast_reboot_count > Settings->param[P_BOOT_LOOP_OFFSET] +2) { // Restarted 4 times
Settings->rule_enabled = 0; // Disable all rules

View File

@ -85,6 +85,18 @@ void ShellyProPreInit(void) {
}
}
void ShellyProInit(void) {
int pin_lan_reset = 5; // GPIO5 = LAN8720 nRST
// delay(30); // (t-purstd) This pin must be brought low for a minimum of 25 mS after power on
digitalWrite(pin_lan_reset, 0);
pinMode(pin_lan_reset, OUTPUT);
delay(1); // (t-rstia) This pin must be brought low for a minimum of 100 uS
digitalWrite(pin_lan_reset, 1);
AddLog(LOG_LEVEL_INFO, PSTR("HDW: Shelly Pro %d%s initialized"),
TasmotaGlobal.devices_present, (PinUsed(GPIO_ADE7953_CS))?"PM":"");
}
void ShellyProPower(void) {
SPro.power = XdrvMailbox.index &3;
ShellyProUpdate();
@ -147,6 +159,9 @@ bool Xdrv88(uint8_t function) {
case FUNC_LED_LINK:
ShellyProLedLink();
break;
case FUNC_INIT:
ShellyProInit();
break;
}
}
return result;

View File

@ -370,8 +370,8 @@ void Ade7953Init(void) {
Ade7953Write(0x0FE, 0x00AD); // Unlock register 0x120
Ade7953Write(0x120, 0x0030); // Configure optimum setting
#ifdef USE_ESP32_SPI
int32_t value = Ade7953Read(0x702); // Silicon version
AddLog(LOG_LEVEL_DEBUG, PSTR("ADE: Chip%d version %d"), chip +1, value);
// int32_t value = Ade7953Read(0x702); // Silicon version
// AddLog(LOG_LEVEL_DEBUG, PSTR("ADE: Chip%d version %d"), chip +1, value);
#endif // USE_ESP32_SPI
}
@ -645,8 +645,8 @@ void Ade7953DrvInit(void) {
}
} else {
#endif // USE_ESP32_SPI
if (!I2cSetDevice(ADE7953_ADDR)) {
return;
if (!I2cSetDevice(ADE7953_ADDR)) {
return;
}
I2cSetActiveFound(ADE7953_ADDR, "ADE7953");
#ifdef USE_ESP32_SPI