Support EC2x PWRKEY set as no connect

pull/12624/head
Chih-Chiang Chang 2020-03-13 13:46:24 +08:00
parent 0699ac4e7e
commit 73b96c1cbc
1 changed files with 6 additions and 4 deletions

View File

@ -97,10 +97,12 @@ CellularDevice *CellularDevice::get_default_instance()
nsapi_error_t QUECTEL_EC2X::press_power_button(uint32_t timeout) nsapi_error_t QUECTEL_EC2X::press_power_button(uint32_t timeout)
{ {
_pwr_key = _active_high; if (_pwr_key.is_connected()) {
ThisThread::sleep_for(timeout); _pwr_key = _active_high;
_pwr_key = !_active_high; ThisThread::sleep_for(timeout);
ThisThread::sleep_for(100); _pwr_key = !_active_high;
ThisThread::sleep_for(100);
}
return NSAPI_ERROR_OK; return NSAPI_ERROR_OK;
} }