Skip to content

Commit 02aeab2

Browse files
author
Veijo Pesonen
committed
[ESP8266] powers down the modem on disconnect
1 parent 8415e49 commit 02aeab2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

components/wifi/esp8266-driver/ESP8266Interface.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ ESP8266Interface::~ESP8266Interface()
109109
if (_oob_event_id) {
110110
_global_event_queue->cancel(_oob_event_id);
111111
}
112+
113+
// Power down the modem
114+
_rst_pin.assert();
112115
}
113116

114117
ESP8266Interface::ResetPin::ResetPin(PinName rst_pin) : _rst_pin(mbed::DigitalOut(rst_pin, 1))
@@ -119,9 +122,6 @@ void ESP8266Interface::ResetPin::assert()
119122
{
120123
if (_rst_pin.is_connected()) {
121124
_rst_pin = 0;
122-
// If you happen to use Pin7 CH_EN as reset pin, not needed otherwise
123-
// https://www.espressif.com/sites/default/files/documentation/esp8266_hardware_design_guidelines_en.pdf
124-
wait_us(200);
125125
tr_debug("HW reset asserted");
126126
}
127127
}
@@ -269,6 +269,9 @@ int ESP8266Interface::disconnect()
269269
}
270270
}
271271

272+
// Power down the modem
273+
_rst_pin.assert();
274+
272275
return ret;
273276
}
274277

@@ -375,6 +378,9 @@ nsapi_error_t ESP8266Interface::_init(void)
375378
void ESP8266Interface::_hw_reset()
376379
{
377380
_rst_pin.assert();
381+
// If you happen to use Pin7 CH_EN as reset pin, not needed otherwise
382+
// https://www.espressif.com/sites/default/files/documentation/esp8266_hardware_design_guidelines_en.pdf
383+
wait_us(200);
378384
_rst_pin.deassert();
379385
}
380386

0 commit comments

Comments
 (0)