Skip to content

ESP8266: astyle fixes #9893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .astyleignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ rtos/TARGET_CORTEX/rtx5
TESTS/mbed_hal/trng/pithy
targets
components/802.15.4_RF
components/wifi
components/TARGET_PSA/TARGET_TFM
tools
components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/tfm_impl
Expand Down
50 changes: 25 additions & 25 deletions components/wifi/esp8266-driver/ESP8266/ESP8266.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool ESP8266::at_available()

_smutex.lock();
// Might take a while to respond after HW reset
for(int i = 0; i < 5; i++) {
for (int i = 0; i < 5; i++) {
ready = _parser.send("AT")
&& _parser.recv("OK\n");
if (ready) {
Expand Down Expand Up @@ -195,7 +195,7 @@ bool ESP8266::start_uart_hw_flow_ctrl(void)

if (done) {
// Start board's flow control
_serial.set_flow_control(SerialBase::RTSCTS, _serial_rts, _serial_cts);
_serial.set_flow_control(SerialBase::RTSCTS, _serial_rts, _serial_cts);
}

} else if (_serial_rts != NC) {
Expand Down Expand Up @@ -591,7 +591,7 @@ nsapi_error_t ESP8266::send(int id, const void *data, uint32_t amount)
// Data stream can be truncated
if (amount > 2048 && _sock_i[id].proto == NSAPI_TCP) {
amount = 2048;
// Datagram must stay intact
// Datagram must stay intact
} else if (amount > 2048 && _sock_i[id].proto == NSAPI_UDP) {
tr_debug("UDP datagram maximum size is 2048");
return NSAPI_ERROR_PARAMETER;
Expand All @@ -606,7 +606,7 @@ nsapi_error_t ESP8266::send(int id, const void *data, uint32_t amount)
goto END;
}

if(!_parser.recv(">")) {
if (!_parser.recv(">")) {
tr_debug("ESP8266::send(): didn't get \">\"");
ret = NSAPI_ERROR_WOULD_BLOCK;
goto END;
Expand Down Expand Up @@ -657,7 +657,7 @@ void ESP8266::_oob_packet_hdlr()
return;
}

if(_tcp_passive && _sock_i[id].open == true && _sock_i[id].proto == NSAPI_TCP) {
if (_tcp_passive && _sock_i[id].open == true && _sock_i[id].proto == NSAPI_TCP) {
if (_parser.recv("%d\n", &amount)) {
_sock_i[id].tcp_data_avbl = amount;

Expand Down Expand Up @@ -726,7 +726,7 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t
_process_oob(timeout, true);

if (_sock_i[id].tcp_data_avbl != 0) {
_sock_i[id].tcp_data = (char*)data;
_sock_i[id].tcp_data = (char *)data;
_sock_i[id].tcp_data_rcvd = NSAPI_ERROR_WOULD_BLOCK;
_sock_active_id = id;

Expand All @@ -735,7 +735,7 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t

// NOTE: documentation v3.0 says '+CIPRECVDATA:<data_len>,' but it's not how the FW responds...
bool done = _parser.send("AT+CIPRECVDATA=%d,%lu", id, amount)
&& _parser.recv("OK\n");
&& _parser.recv("OK\n");

_sock_i[id].tcp_data = NULL;
_sock_active_id = -1;
Expand Down Expand Up @@ -972,26 +972,26 @@ bool ESP8266::_recv_ap(nsapi_wifi_ap_t *ap)

if (FW_AT_LEAST_VERSION(_at_v.major, _at_v.minor, _at_v.patch, 0, ESP8266_AT_VERSION_WIFI_SCAN_CHANGE)) {
ret = _parser.recv("+CWLAP:(%d,\"%32[^\"]\",%hhd,\"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx\",%hhu,%d,%d,%d,%d,%d,%d)\n",
&sec,
ap->ssid,
&ap->rssi,
&ap->bssid[0], &ap->bssid[1], &ap->bssid[2], &ap->bssid[3], &ap->bssid[4], &ap->bssid[5],
&ap->channel,
&dummy,
&dummy,
&dummy,
&dummy,
&dummy,
&dummy);
&sec,
ap->ssid,
&ap->rssi,
&ap->bssid[0], &ap->bssid[1], &ap->bssid[2], &ap->bssid[3], &ap->bssid[4], &ap->bssid[5],
&ap->channel,
&dummy,
&dummy,
&dummy,
&dummy,
&dummy,
&dummy);
} else {
ret = _parser.recv("+CWLAP:(%d,\"%32[^\"]\",%hhd,\"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx\",%hhu,%d,%d)\n",
&sec,
ap->ssid,
&ap->rssi,
&ap->bssid[0], &ap->bssid[1], &ap->bssid[2], &ap->bssid[3], &ap->bssid[4], &ap->bssid[5],
&ap->channel,
&dummy,
&dummy);
&sec,
ap->ssid,
&ap->rssi,
&ap->bssid[0], &ap->bssid[1], &ap->bssid[2], &ap->bssid[3], &ap->bssid[4], &ap->bssid[5],
&ap->channel,
&dummy,
&dummy);

}

Expand Down
16 changes: 8 additions & 8 deletions components/wifi/esp8266-driver/ESP8266Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void ESP8266Interface::_connect_async()
_connect_event_id = _global_event_queue->call_in(ESP8266_CONNECT_TIMEOUT, callback(this, &ESP8266Interface::_connect_async));
if (!_connect_event_id) {
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_ENOMEM), \
"ESP8266Interface::_connect_async(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
"ESP8266Interface::_connect_async(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
}
}
_cmutex.unlock();
Expand Down Expand Up @@ -227,7 +227,7 @@ int ESP8266Interface::connect()

if (!_connect_event_id) {
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_ENOMEM), \
"connect(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
"connect(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
}

while (_if_blocking && (_conn_status_to_error() != NSAPI_ERROR_IS_CONNECTED)
Expand Down Expand Up @@ -582,12 +582,12 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
status = _esp.send(socket->id, data, size);

if (status == NSAPI_ERROR_WOULD_BLOCK
&& socket->proto == NSAPI_TCP
&& core_util_atomic_cas_u8(&_cbs[socket->id].deferred, &expect_false, true)) {
&& socket->proto == NSAPI_TCP
&& core_util_atomic_cas_u8(&_cbs[socket->id].deferred, &expect_false, true)) {
tr_debug("Postponing SIGIO from the device");
if (!_global_event_queue->call_in(50, callback(this, &ESP8266Interface::event_deferred))) {
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_ENOMEM), \
"socket_send(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
"socket_send(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
}

} else if (status == NSAPI_ERROR_WOULD_BLOCK && socket->proto == NSAPI_UDP) {
Expand Down Expand Up @@ -741,7 +741,7 @@ void ESP8266Interface::event()
_oob_event_id = _global_event_queue->call_in(50, callback(this, &ESP8266Interface::proc_oob_evnt));
if (!_oob_event_id) {
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_ENOMEM), \
"ESP8266Interface::event(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
"ESP8266Interface::event(): unable to add event to queue. Increase \"events.shared-eventsize\"\n");
}
}

Expand Down Expand Up @@ -821,8 +821,8 @@ void ESP8266Interface::refresh_conn_state_cb()

void ESP8266Interface::proc_oob_evnt()
{
_oob_event_id = 0; // Allows creation of a new event
_esp.bg_process_oob(ESP8266_RECV_TIMEOUT, true);
_oob_event_id = 0; // Allows creation of a new event
_esp.bg_process_oob(ESP8266_RECV_TIMEOUT, true);
}

nsapi_error_t ESP8266Interface::_conn_status_to_error()
Expand Down