mirror of https://github.com/ARMmbed/mbed-os.git
ESP8266 Unified Mbed trace prints.
All logs now: - start with a function name (it is not automatically logged by the logger) - do not contain class name (this can be inferred from log preamble) - message starts with a capital letter and ends with a full-stoppull/11460/head
parent
f5dd7db8c7
commit
66bf8bc97b
|
@ -116,7 +116,7 @@ bool ESP8266::at_available()
|
||||||
if (ready) {
|
if (ready) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tr_debug("waiting AT response");
|
tr_debug("at_available(): Waiting AT response.");
|
||||||
}
|
}
|
||||||
_smutex.unlock();
|
_smutex.unlock();
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ bool ESP8266::start_uart_hw_flow_ctrl(void)
|
||||||
_smutex.unlock();
|
_smutex.unlock();
|
||||||
|
|
||||||
if (!done) {
|
if (!done) {
|
||||||
tr_debug("Enable UART HW flow control: FAIL");
|
tr_debug("start_uart_hw_flow_ctrl(): Enable UART HW flow control: FAIL.");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (_serial_rts != NC || _serial_cts != NC) {
|
if (_serial_rts != NC || _serial_cts != NC) {
|
||||||
|
@ -268,7 +268,7 @@ bool ESP8266::reset(void)
|
||||||
set_timeout(ESP8266_RECV_TIMEOUT);
|
set_timeout(ESP8266_RECV_TIMEOUT);
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
if (!_parser.send("AT+RST") || !_parser.recv("OK\n")) {
|
if (!_parser.send("AT+RST") || !_parser.recv("OK\n")) {
|
||||||
tr_debug("reset(): AT+RST failed or no response");
|
tr_debug("reset(): AT+RST failed or no response.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ bool ESP8266::reset(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_debug("reset(): done: %s", done ? "OK" : "FAIL");
|
tr_debug("reset(): Done: %s.", done ? "OK" : "FAIL");
|
||||||
|
|
||||||
_clear_socket_packets(ESP8266_ALL_SOCKET_IDS);
|
_clear_socket_packets(ESP8266_ALL_SOCKET_IDS);
|
||||||
set_timeout();
|
set_timeout();
|
||||||
|
@ -484,7 +484,7 @@ int ESP8266::scan(WiFiAccessPoint *res, unsigned limit, scan_mode mode, unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(ret_parse_send && _parser.recv("OK\n"))) {
|
if (!(ret_parse_send && _parser.recv("OK\n"))) {
|
||||||
tr_warning("scan(): AP info parsing aborted");
|
tr_warning("scan(): AP info parsing aborted.");
|
||||||
// Lets be happy about partial success and not return NSAPI_ERROR_DEVICE_ERROR
|
// Lets be happy about partial success and not return NSAPI_ERROR_DEVICE_ERROR
|
||||||
if (!_scan_r.cnt) {
|
if (!_scan_r.cnt) {
|
||||||
_scan_r.cnt = NSAPI_ERROR_DEVICE_ERROR;
|
_scan_r.cnt = NSAPI_ERROR_DEVICE_ERROR;
|
||||||
|
@ -547,7 +547,7 @@ nsapi_error_t ESP8266::open_udp(int id, const char *addr, int port, int local_po
|
||||||
|
|
||||||
_smutex.unlock();
|
_smutex.unlock();
|
||||||
|
|
||||||
tr_debug("UDP socket %d opened: %s", id, (_sock_i[id].open ? "true" : "false"));
|
tr_debug("open_udp(): UDP socket %d opened: %s.", id, (_sock_i[id].open ? "true" : "false"));
|
||||||
|
|
||||||
return done ? NSAPI_ERROR_OK : NSAPI_ERROR_DEVICE_ERROR;
|
return done ? NSAPI_ERROR_OK : NSAPI_ERROR_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@ nsapi_error_t ESP8266::open_tcp(int id, const char *addr, int port, int keepaliv
|
||||||
|
|
||||||
_smutex.unlock();
|
_smutex.unlock();
|
||||||
|
|
||||||
tr_debug("TCP socket %d opened: %s", id, (_sock_i[id].open ? "true" : "false"));
|
tr_debug("open_tcp: TCP socket %d opened: %s . ", id, (_sock_i[id].open ? "true" : "false"));
|
||||||
|
|
||||||
return done ? NSAPI_ERROR_OK : NSAPI_ERROR_DEVICE_ERROR;
|
return done ? NSAPI_ERROR_OK : NSAPI_ERROR_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ nsapi_error_t ESP8266::send(int id, const void *data, uint32_t amount)
|
||||||
amount = 2048;
|
amount = 2048;
|
||||||
// Datagram must stay intact
|
// Datagram must stay intact
|
||||||
} else if (amount > 2048 && _sock_i[id].proto == NSAPI_UDP) {
|
} else if (amount > 2048 && _sock_i[id].proto == NSAPI_UDP) {
|
||||||
tr_debug("UDP datagram maximum size is 2048");
|
tr_debug("send(): UDP datagram maximum size is 2048 .");
|
||||||
return NSAPI_ERROR_PARAMETER;
|
return NSAPI_ERROR_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,12 +630,12 @@ nsapi_error_t ESP8266::send(int id, const void *data, uint32_t amount)
|
||||||
_busy = false;
|
_busy = false;
|
||||||
_error = false;
|
_error = false;
|
||||||
if (!_parser.send("AT+CIPSEND=%d,%" PRIu32, id, amount)) {
|
if (!_parser.send("AT+CIPSEND=%d,%" PRIu32, id, amount)) {
|
||||||
tr_debug("ESP8266::send(): AT+CIPSEND failed");
|
tr_debug("send(): AT+CIPSEND failed.");
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_parser.recv(">")) {
|
if (!_parser.recv(">")) {
|
||||||
tr_debug("ESP8266::send(): didn't get \">\"");
|
tr_debug("send(): Didn't get \">\"");
|
||||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
ret = NSAPI_ERROR_WOULD_BLOCK;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
|
@ -650,22 +650,22 @@ END:
|
||||||
// error hierarchy, from low to high
|
// error hierarchy, from low to high
|
||||||
if (_busy) {
|
if (_busy) {
|
||||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
ret = NSAPI_ERROR_WOULD_BLOCK;
|
||||||
tr_debug("ESP8266::send(): modem busy");
|
tr_debug("send(): Modem busy. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == NSAPI_ERROR_DEVICE_ERROR) {
|
if (ret == NSAPI_ERROR_DEVICE_ERROR) {
|
||||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
ret = NSAPI_ERROR_WOULD_BLOCK;
|
||||||
tr_debug("ESP8266::send(): send failed");
|
tr_debug("send(): Send failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_error) {
|
if (_error) {
|
||||||
ret = NSAPI_ERROR_CONNECTION_LOST;
|
ret = NSAPI_ERROR_CONNECTION_LOST;
|
||||||
tr_debug("ESP8266::send(): connection disrupted");
|
tr_debug("send(): Connection disrupted.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_sock_i[id].open && ret != NSAPI_ERROR_OK) {
|
if (!_sock_i[id].open && ret != NSAPI_ERROR_OK) {
|
||||||
ret = NSAPI_ERROR_CONNECTION_LOST;
|
ret = NSAPI_ERROR_CONNECTION_LOST;
|
||||||
tr_debug("ESP8266::send(): socket closed abruptly");
|
tr_debug("send(): Socket closed abruptly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
set_timeout();
|
set_timeout();
|
||||||
|
@ -708,7 +708,7 @@ void ESP8266::_oob_packet_hdlr()
|
||||||
|
|
||||||
struct packet *packet = (struct packet *)malloc(pdu_len);
|
struct packet *packet = (struct packet *)malloc(pdu_len);
|
||||||
if (!packet) {
|
if (!packet) {
|
||||||
tr_debug("out of memory, unable to allocate memory for packet");
|
tr_debug("_oob_packet_hdlr(): Out of memory, unable to allocate memory for packet.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_heap_usage += pdu_len;
|
_heap_usage += pdu_len;
|
||||||
|
@ -798,10 +798,10 @@ int32_t ESP8266::_recv_tcp_passive(int id, void *data, uint32_t amount, uint32_t
|
||||||
BUSY:
|
BUSY:
|
||||||
_process_oob(ESP8266_RECV_TIMEOUT, true);
|
_process_oob(ESP8266_RECV_TIMEOUT, true);
|
||||||
if (_busy) {
|
if (_busy) {
|
||||||
tr_debug("_recv_tcp_passive(): modem busy");
|
tr_debug("_recv_tcp_passive(): Modem busy.");
|
||||||
ret = NSAPI_ERROR_WOULD_BLOCK;
|
ret = NSAPI_ERROR_WOULD_BLOCK;
|
||||||
} else {
|
} else {
|
||||||
tr_error("_recv_tcp_passive(): unknown state");
|
tr_error("_recv_tcp_passive(): Unknown state.");
|
||||||
ret = NSAPI_ERROR_DEVICE_ERROR;
|
ret = NSAPI_ERROR_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
_smutex.unlock();
|
_smutex.unlock();
|
||||||
|
@ -1024,7 +1024,7 @@ bool ESP8266::_recv_ap(nsapi_wifi_ap_t *ap)
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
_parser.abort();
|
_parser.abort();
|
||||||
tr_warning("_recv_ap(): AP info missing");
|
tr_warning("_recv_ap(): AP info missing.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ap->security = sec < 5 ? (nsapi_security_t)sec : NSAPI_SECURITY_UNKNOWN;
|
ap->security = sec < 5 ? (nsapi_security_t)sec : NSAPI_SECURITY_UNKNOWN;
|
||||||
|
@ -1054,7 +1054,7 @@ void ESP8266::_oob_ready()
|
||||||
_conn_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
|
_conn_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
|
||||||
_conn_stat_cb();
|
_conn_stat_cb();
|
||||||
|
|
||||||
tr_debug("_oob_reset(): reset detected");
|
tr_debug("_oob_reset(): Reset detected.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP8266::_oob_busy()
|
void ESP8266::_oob_busy()
|
||||||
|
@ -1062,11 +1062,11 @@ void ESP8266::_oob_busy()
|
||||||
char status;
|
char status;
|
||||||
if (_parser.scanf("%c...\n", &status)) {
|
if (_parser.scanf("%c...\n", &status)) {
|
||||||
if (status == 's') {
|
if (status == 's') {
|
||||||
tr_debug("busy s...");
|
tr_debug("_oob_busy(): Busy s...");
|
||||||
} else if (status == 'p') {
|
} else if (status == 'p') {
|
||||||
tr_debug("busy p...");
|
tr_debug("_oob_busy(): Busy p...");
|
||||||
} else {
|
} else {
|
||||||
tr_error("unrecognized busy state '%c...'", status);
|
tr_error("_oob_busy(): unrecognized busy state '%c...'", status);
|
||||||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_EBADMSG), \
|
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_EBADMSG), \
|
||||||
"ESP8266::_oob_busy() unrecognized busy state\n");
|
"ESP8266::_oob_busy() unrecognized busy state\n");
|
||||||
}
|
}
|
||||||
|
@ -1144,35 +1144,35 @@ void ESP8266::_oob_socket0_closed()
|
||||||
{
|
{
|
||||||
static const int id = 0;
|
static const int id = 0;
|
||||||
_sock_i[id].open = false;
|
_sock_i[id].open = false;
|
||||||
tr_debug("socket %d closed", id);
|
tr_debug("_oob_socket0_closed(): Socket %d closed.", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP8266::_oob_socket1_closed()
|
void ESP8266::_oob_socket1_closed()
|
||||||
{
|
{
|
||||||
static const int id = 1;
|
static const int id = 1;
|
||||||
_sock_i[id].open = false;
|
_sock_i[id].open = false;
|
||||||
tr_debug("socket %d closed", id);
|
tr_debug("_oob_socket1_closed(): Socket %d closed.", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP8266::_oob_socket2_closed()
|
void ESP8266::_oob_socket2_closed()
|
||||||
{
|
{
|
||||||
static const int id = 2;
|
static const int id = 2;
|
||||||
_sock_i[id].open = false;
|
_sock_i[id].open = false;
|
||||||
tr_debug("socket %d closed", id);
|
tr_debug("_oob_socket2_closed(): Socket %d closed.", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP8266::_oob_socket3_closed()
|
void ESP8266::_oob_socket3_closed()
|
||||||
{
|
{
|
||||||
static const int id = 3;
|
static const int id = 3;
|
||||||
_sock_i[id].open = false;
|
_sock_i[id].open = false;
|
||||||
tr_debug("socket %d closed", id);
|
tr_debug("_oob_socket3_closed(): %d closed.", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP8266::_oob_socket4_closed()
|
void ESP8266::_oob_socket4_closed()
|
||||||
{
|
{
|
||||||
static const int id = 4;
|
static const int id = 4;
|
||||||
_sock_i[id].open = false;
|
_sock_i[id].open = false;
|
||||||
tr_debug("socket %d closed", id);
|
tr_debug("_oob_socket0_closed(): Socket %d closed.", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESP8266::_oob_connection_status()
|
void ESP8266::_oob_connection_status()
|
||||||
|
@ -1191,16 +1191,16 @@ void ESP8266::_oob_connection_status()
|
||||||
} else if (strcmp(status, "CONNECTED\n") == 0) {
|
} else if (strcmp(status, "CONNECTED\n") == 0) {
|
||||||
_conn_status = NSAPI_STATUS_CONNECTING;
|
_conn_status = NSAPI_STATUS_CONNECTING;
|
||||||
} else {
|
} else {
|
||||||
tr_error("invalid AT cmd \'%s\'", status);
|
tr_error("_oob_connection_status(): Invalid AT cmd \'%s\' .", status);
|
||||||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_EBADMSG), \
|
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_EBADMSG), \
|
||||||
"ESP8266::_oob_connection_status: invalid AT cmd\n");
|
"ESP8266::_oob_connection_status: invalid AT cmd\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tr_error("_oob_connection_status(): network status timeout, disconnecting");
|
tr_error("_oob_connection_status(): Network status timeout, disconnecting.");
|
||||||
if (!disconnect()) {
|
if (!disconnect()) {
|
||||||
tr_warning("_oob_connection_status(): driver initiated disconnect failed");
|
tr_warning("_oob_connection_status(): Driver initiated disconnect failed.");
|
||||||
} else {
|
} else {
|
||||||
tr_debug("_oob_connection_status(): disconnected");
|
tr_debug("_oob_connection_status(): Disconnected.");
|
||||||
}
|
}
|
||||||
_conn_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
|
_conn_status = NSAPI_STATUS_ERROR_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ void ESP8266Interface::ResetPin::rst_assert()
|
||||||
{
|
{
|
||||||
if (_rst_pin.is_connected()) {
|
if (_rst_pin.is_connected()) {
|
||||||
_rst_pin = 0;
|
_rst_pin = 0;
|
||||||
tr_debug("HW reset asserted");
|
tr_debug("rst_assert(): HW reset asserted.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ void ESP8266Interface::ResetPin::rst_deassert()
|
||||||
if (_rst_pin.is_connected()) {
|
if (_rst_pin.is_connected()) {
|
||||||
// Notice that Pin7 CH_EN cannot be left floating if used as reset
|
// Notice that Pin7 CH_EN cannot be left floating if used as reset
|
||||||
_rst_pin = 1;
|
_rst_pin = 1;
|
||||||
tr_debug("HW reset deasserted");
|
tr_debug("rst_deassert(): HW reset deasserted.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ void ESP8266Interface::PowerPin::power_on()
|
||||||
{
|
{
|
||||||
if (_pwr_pin.is_connected()) {
|
if (_pwr_pin.is_connected()) {
|
||||||
_pwr_pin = MBED_CONF_ESP8266_POWER_ON_POLARITY;
|
_pwr_pin = MBED_CONF_ESP8266_POWER_ON_POLARITY;
|
||||||
tr_debug("HW power-on");
|
tr_debug("power_on(): HW power-on.");
|
||||||
ThisThread::sleep_for(MBED_CONF_ESP8266_POWER_ON_TIME_MS);
|
ThisThread::sleep_for(MBED_CONF_ESP8266_POWER_ON_TIME_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ void ESP8266Interface::PowerPin::power_off()
|
||||||
{
|
{
|
||||||
if (_pwr_pin.is_connected()) {
|
if (_pwr_pin.is_connected()) {
|
||||||
_pwr_pin = !MBED_CONF_ESP8266_POWER_ON_POLARITY;
|
_pwr_pin = !MBED_CONF_ESP8266_POWER_ON_POLARITY;
|
||||||
tr_debug("HW power-off");
|
tr_debug("power_off(): HW power-off.");
|
||||||
ThisThread::sleep_for(MBED_CONF_ESP8266_POWER_OFF_TIME_MS);
|
ThisThread::sleep_for(MBED_CONF_ESP8266_POWER_OFF_TIME_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ void ESP8266Interface::_connect_async()
|
||||||
}
|
}
|
||||||
_cmutex.lock();
|
_cmutex.lock();
|
||||||
if (!_connect_event_id) {
|
if (!_connect_event_id) {
|
||||||
tr_debug("_connect_async(): cancelled");
|
tr_debug("_connect_async(): Cancelled.");
|
||||||
_cmutex.unlock();
|
_cmutex.unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -750,7 +750,7 @@ int ESP8266Interface::socket_send(void *handle, const void *data, unsigned size)
|
||||||
if (status == NSAPI_ERROR_WOULD_BLOCK
|
if (status == NSAPI_ERROR_WOULD_BLOCK
|
||||||
&& socket->proto == NSAPI_TCP
|
&& socket->proto == NSAPI_TCP
|
||||||
&& core_util_atomic_cas_u8(&_cbs[socket->id].deferred, &expect_false, true)) {
|
&& core_util_atomic_cas_u8(&_cbs[socket->id].deferred, &expect_false, true)) {
|
||||||
tr_debug("Postponing SIGIO from the device");
|
tr_debug("socket_send(...): Postponing SIGIO from the device.");
|
||||||
if (!_global_event_queue->call_in(50, callback(this, &ESP8266Interface::event_deferred))) {
|
if (!_global_event_queue->call_in(50, callback(this, &ESP8266Interface::event_deferred))) {
|
||||||
MBED_ERROR(MBED_MAKE_ERROR(MBED_MODULE_DRIVER, MBED_ERROR_CODE_ENOMEM), \
|
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");
|
||||||
|
@ -983,7 +983,7 @@ void ESP8266Interface::refresh_conn_state_cb()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_debug("refresh_conn_state_cb(): changed to %d", _conn_stat);
|
tr_debug("refresh_conn_state_cb(): Changed to %d.", _conn_stat);
|
||||||
|
|
||||||
if (_conn_stat_cb) {
|
if (_conn_stat_cb) {
|
||||||
// _conn_stat_cb will be called in _connect_async or disconnect_assync to avoid race condition
|
// _conn_stat_cb will be called in _connect_async or disconnect_assync to avoid race condition
|
||||||
|
@ -1036,7 +1036,7 @@ nsapi_error_t ESP8266Interface::set_country_code(bool track_ap, const char *coun
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
// Validation done by firmware
|
// Validation done by firmware
|
||||||
if (!country_code[i]) {
|
if (!country_code[i]) {
|
||||||
tr_warning("invalid country code");
|
tr_warning("set_country_code(): Invalid country code.");
|
||||||
return NSAPI_ERROR_PARAMETER;
|
return NSAPI_ERROR_PARAMETER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue