Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e1818e

Browse files
authored
Merge branch 'main' into blockdev-fix
2 parents de96222 + f64f904 commit 6e1818e

File tree

20 files changed

+132
-151
lines changed

20 files changed

+132
-151
lines changed

‎cores/arduino/analog.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,10 @@ void analogReference(uint8_t mode) {
558558
R_ADC_Open(&adc1.ctrl, &adc1.cfg);
559559
}
560560

561+
#if defined(AVCC_MEASURE_PIN)
561562
static float aref = 0;
563+
#endif
564+
562565
float analogReference() {
563566
switch (adc.cfg_extend.adc_vref_control) {
564567
case ADC_VREF_CONTROL_1_5V_OUTPUT:
@@ -817,4 +820,4 @@ void analogWrite(pin_size_t pinNumber, int value)
817820

818821
FspTimer* __get_timer_for_channel(int channel) {
819822
return pwms.get_from_channel(channel)->get_timer();
820-
}
823+
}

‎libraries/ESPhost/src/CMsg.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ void CMsg::reset_without_delete() {
8585

8686

8787
/* -------------------------------------------------------------------------- */
88-
CMsg::CMsg() : buf{nullptr}, dim{0}, payload_header{nullptr}, proto_dim{0}, tlv_size(esp_tlv_header_size) {
88+
CMsg::CMsg() : buf{nullptr}, dim{0}, proto_dim{0}, payload_header{nullptr}, tlv_size(esp_tlv_header_size) {
8989

9090
}
9191
/* -------------------------------------------------------------------------- */
9292

9393
/* -------------------------------------------------------------------------- */
94-
CMsg::CMsg(uint16_t proto_size, bool use_tlv /*= true*/) : buf{nullptr},
95-
dim{0},
96-
payload_header{nullptr},
97-
proto_dim{proto_size} {
94+
CMsg::CMsg(uint16_t proto_size, bool use_tlv /*= true*/) : buf{nullptr},
95+
dim{0},
96+
proto_dim{proto_size},
97+
payload_header{nullptr} {
9898
/* -------------------------------------------------------------------------- */
9999
uint16_t request_size = 0;
100100
if(use_tlv) {
@@ -204,6 +204,7 @@ CMsg& CMsg::operator=(CMsg&& m) {
204204
Serial.println(" bad!");
205205
#endif
206206
}
207+
return *this;
207208
}
208209

209210

@@ -442,6 +443,7 @@ void CMsg::debug_print(const char* title) {
442443
/* -------------------------------------------------------------------------- */
443444
bool CMsg::store_rx_buffer(const uint8_t *buffer, uint32_t d) {
444445
/* -------------------------------------------------------------------------- */
446+
(void)d;
445447
/* rx_payload_len is TLV + PROTO (tlv can be present or not) */
446448
uint16_t rx_payload_len = verify_payload_header(buffer);
447449

@@ -498,6 +500,7 @@ bool CMsg::add_msg(CMsg &msg) {
498500
return false;
499501
}
500502
}
503+
return true;
501504
}
502505

503506
/* -------------------------------------------------------------------------- */

‎libraries/ESPhost/src/EspSpiDriver.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ static spi_event_t _spi_cb_status = SPI_EVENT_TRANSFER_ABORTED;
124124
* ############################# */
125125

126126
static void spi_callback(spi_callback_args_t *p_args);
127-
static void ext_irq_callback(void);
128127

129128

130129
/* execute SPI communication, send the content of tx_buffer to ESP32, put the
@@ -534,9 +533,3 @@ static void spi_callback(spi_callback_args_t *p_args) {
534533
_spi_cb_status = SPI_EVENT_TRANSFER_ABORTED;
535534
}
536535
}
537-
538-
/* -------------------------------------------------------------------------- */
539-
static void ext_irq_callback(void) {
540-
/* -------------------------------------------------------------------------- */
541-
542-
}

‎libraries/Ethernet/src/Ethernet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ int CEthernet::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_ser
123123
/* -------------------------------------------------------------------------- */
124124
int CEthernet::begin(uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet, unsigned long timeout, unsigned long responseTimeout) {
125125
/* -------------------------------------------------------------------------- */
126+
(void)responseTimeout;
127+
(void)timeout;
126128
CLwipIf::getInstance().setMacAddress(NI_ETHERNET, mac);
127129
return begin(local_ip, dns_server, gateway, subnet);
128130
}

‎libraries/Ethernet/src/EthernetClock.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,14 @@ fsp_err_t EthernetClock::stop() {
4949
fsp_err_t err = R_AGT_Stop(&this->TIMER_ETHERNET_ctrl);
5050
if (err != FSP_SUCCESS) {
5151
return err;
52-
} else {
53-
err = R_AGT_Close(&this->TIMER_ETHERNET_ctrl);
54-
if (err != FSP_SUCCESS) {
55-
return err;
56-
} else {
57-
err = R_AGT_Disable(&this->TIMER_ETHERNET_ctrl);
58-
if (err != FSP_SUCCESS) {
59-
return err;
60-
}
61-
}
6252
}
53+
54+
err = R_AGT_Close(&this->TIMER_ETHERNET_ctrl);
55+
if (err != FSP_SUCCESS) {
56+
return err;
57+
}
58+
59+
return R_AGT_Disable(&this->TIMER_ETHERNET_ctrl);
6360
}
6461

6562
#else

‎libraries/Ethernet/src/EthernetDriver.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ void eth_reset_due_to_ADE_bit() {
195195
/* -------------------------------------------------------------------------- */
196196
void EthernetDriver::irq_callback(ether_callback_args_t * p_args) {
197197
/* -------------------------------------------------------------------------- */
198-
p_args->status_ecsr;
199198
uint32_t reg_eesr = p_args->status_eesr;
200199
if(p_args->channel == ETHERNET_CHANNEL) {
201200
if(p_args->event == ETHER_EVENT_WAKEON_LAN) {

‎libraries/SSLClient/src/SSLClient.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,9 @@ void SSLClient::setClient(Client& client)
9797

9898
void SSLClient::stop()
9999
{
100-
if (sslclient->client >= 0) {
101-
//sslclient->client->stop();
102-
_connected = false;
103-
_peek = -1;
104-
}
105-
stop_ssl_socket(sslclient, _CA_cert, _cert, _private_key);
100+
stop_ssl_socket(sslclient);
101+
_connected = false;
102+
_peek = -1;
106103
}
107104

108105
int SSLClient::connect(IPAddress ip, uint16_t port)
@@ -150,12 +147,12 @@ int SSLClient::connect(const char *host, uint16_t port, const char *_CA_cert, co
150147
}
151148

152149
int SSLClient::connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psKey) {
153-
return connect(ip.toString().c_str(), port,_pskIdent, _psKey);
150+
return connect(ip.toString().c_str(), port, pskIdent, psKey);
154151
}
155152

156153
int SSLClient::connect(const char *host, uint16_t port, const char *pskIdent, const char *psKey) {
157154
log_v("start_ssl_client with PSK");
158-
int ret = start_ssl_client(sslclient, host, port, _timeout, NULL, NULL, NULL, NULL, _pskIdent, _psKey, _use_insecure);
155+
int ret = start_ssl_client(sslclient, host, port, _timeout, NULL, NULL, NULL, NULL, pskIdent, psKey, _use_insecure);
159156
_lastError = ret;
160157
if (ret < 0) {
161158
log_e("start_ssl_client: %d", ret);

‎libraries/SSLClient/src/ssl_client.cpp

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static int _handle_error(int err, const char * file, int line)
3838

3939
#define handle_error(e) _handle_error(e, __FUNCTION__, __LINE__)
4040

41+
#if defined(SSL_CLIENT_RECV_DISABLE_TIMEOUT)
4142
/**
4243
* \brief Read at most 'len' characters. If no error occurs,
4344
* the actual amount read is returned.
@@ -52,11 +53,11 @@ static int _handle_error(int err, const char * file, int line)
5253
*/
5354
static int client_net_recv( void *ctx, unsigned char *buf, size_t len ) {
5455
Client *client = (Client*)ctx;
55-
if (!client) {
56+
if (!client) {
5657
log_e("Uninitialised!");
5758
return -1;
5859
}
59-
60+
6061
//if (!client->connected()) {
6162
// log_e("Not connected!");
6263
// return -2;
@@ -68,31 +69,31 @@ static int client_net_recv( void *ctx, unsigned char *buf, size_t len ) {
6869
if (result > 0) {
6970
//esp_log_buffer_hexdump_internal("SSL.RD", buf, (uint16_t)result, ESP_LOG_VERBOSE);
7071
}
71-
72+
7273
return result;
7374
}
74-
75-
int client_net_recv_timeout( void *ctx, unsigned char *buf,
75+
#else
76+
staticint client_net_recv_timeout( void *ctx, unsigned char *buf,
7677
size_t len, uint32_t timeout ) {
7778
Client *client = (Client*)ctx;
78-
if (!client) {
79+
if (!client) {
7980
log_e("Uninitialised!");
8081
return -1;
8182
}
8283
unsigned long start = millis();
8384
unsigned long tms = start + timeout;
84-
int pending = client->available();
85+
uint16_t pending = client->available();
8586
// If there is data in the client, wait for message completion
8687
if((pending > 0) && (pending < len))
8788
do {
88-
int pending = client->available();
89+
uint16_t pending = client->available();
8990
if (pending < len && timeout > 0) {
9091
delay(1);
9192
} else break;
9293
} while (millis() < tms);
93-
94+
9495
int result = client->read(buf, len);
95-
96+
9697
// lwIP interface return -1 if there is no data to read
9798
// report without throwing errors or block
9899
if (result <= 0) return MBEDTLS_ERR_SSL_WANT_READ;
@@ -102,10 +103,10 @@ int client_net_recv_timeout( void *ctx, unsigned char *buf,
102103
if (result > 0) {
103104
//esp_log_buffer_hexdump_internal("SSL.RD", buf, (uint16_t)result, ESP_LOG_VERBOSE);
104105
}
105-
106+
106107
return result;
107108
}
108-
109+
#endif
109110

110111
/**
111112
* \brief Write at most 'len' characters. If no error occurs,
@@ -121,20 +122,20 @@ int client_net_recv_timeout( void *ctx, unsigned char *buf,
121122
*/
122123
static int client_net_send( void *ctx, const unsigned char *buf, size_t len ) {
123124
Client *client = (Client*)ctx;
124-
if (!client) {
125+
if (!client) {
125126
log_e("Uninitialised!");
126127
return -1;
127128
}
128-
129+
129130
//if (!client->connected()) {
130131
// log_e("Not connected!");
131132
// return -2;
132133
//}
133-
134+
134135
//esp_log_buffer_hexdump_internal("SSL.WR", buf, (uint16_t)len, ESP_LOG_VERBOSE);
135-
136+
136137
int result = client->write(buf, len);
137-
138+
138139
log_d("SSL client TX res=%d len=%d", result, len);
139140
return result;
140141
}
@@ -152,7 +153,7 @@ void ssl_init(sslclient_context *ssl_client, Client *client, const char * ca_pat
152153
mbedtls_ssl_conf_ciphersuites(&ssl_client->ssl_conf, mbedtls_ssl_list_ciphersuites());
153154

154155
mbedtls_ssl_conf_dbg(&ssl_client->ssl_conf, mbedtls_debug_print, NULL);
155-
mbedtls_debug_set_threshold(DEBUG_LEVEL);
156+
mbedtls_debug_set_threshold(SSL_DEBUG_LEVEL);
156157

157158
mbedtls_fs_init(ca_path);
158159
}
@@ -225,7 +226,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
225226
}
226227
unsigned char psk[MBEDTLS_PSK_MAX_LEN];
227228
size_t psk_len = strlen(psKey)/2;
228-
for (int j=0; j<strlen(psKey); j+= 2) {
229+
for (size_t j=0; j<strlen(psKey); j+= 2) {
229230
char c = psKey[j];
230231
if (c >= '0' && c <= '9') c -= '0';
231232
else if (c >= 'A' && c <= 'F') c -= 'A' - 10;
@@ -336,13 +337,13 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
336337
memset(buf, 0, sizeof(buf));
337338
mbedtls_x509_crt_verify_info(buf, sizeof(buf), " ! ", flags);
338339
log_e("Failed to verify peer certificate! verification info: %s", buf);
339-
stop_ssl_socket(ssl_client, rootCABuff, cli_cert, cli_key); //It's not safe continue.
340+
stop_ssl_socket(ssl_client); //It's not safe continue.
340341

341342
return handle_error(ret);
342343
} else {
343344
log_v("Certificate verified.");
344345
}
345-
346+
346347
if ((rootCABuff != NULL) || ((rootCAPath != NULL))) {
347348
log_d("free buffer");
348349
mbedtls_x509_crt_free(&ssl_client->ca_cert);
@@ -354,14 +355,14 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
354355

355356
if (cli_key != NULL) {
356357
mbedtls_pk_free(&ssl_client->client_key);
357-
}
358+
}
358359

359360
//return ssl_client->socket;
360361
return 1;
361362
}
362363

363364

364-
void stop_ssl_socket(sslclient_context *ssl_client, constchar *rootCABuff, constchar *cli_cert, constchar *cli_key)
365+
void stop_ssl_socket(sslclient_context *ssl_client)
365366
{
366367
log_v("Cleaning SSL connection.");
367368

‎libraries/SSLClient/src/ssl_client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ typedef struct sslclient_context {
4343

4444
void ssl_init(sslclient_context *ssl_client, Client *client, const char *ca_path);
4545
int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t port, int timeout, const char *rootCABuff, const char *rootCAPath, const char *cli_cert, const char *cli_key, const char *pskIdent, const char *psKey, bool insecure);
46-
void stop_ssl_socket(sslclient_context *ssl_client, constchar*rootCABuff, constchar*cli_cert, constchar*cli_key);
46+
void stop_ssl_socket(sslclient_context *ssl_client);
4747
int data_to_read(sslclient_context *ssl_client);
4848
int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, uint16_t len);
4949
int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length);

‎libraries/SSLClient/src/ssl_debug.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "ssl_debug.h"
2121

2222
void ssl_debug_print(const char *format, ...) {
23-
char debug_buf[1024];
23+
char debug_buf[1024];
2424
va_list argptr;
2525
va_start(argptr, format);
2626
vsnprintf(debug_buf, sizeof(debug_buf), format, argptr);
@@ -29,7 +29,7 @@ void ssl_debug_print(const char *format, ...) {
2929
}
3030

3131
void ssl_debug_println(const char *format, ...) {
32-
char debug_buf[1024];
32+
char debug_buf[1024];
3333
va_list argptr;
3434
va_start(argptr, format);
3535
vsnprintf(debug_buf, sizeof(debug_buf), format, argptr);
@@ -43,6 +43,7 @@ void ssl_debug_none(const char *format, ...) {
4343

4444
void mbedtls_debug_print(void *ctx, int level, const char *file, int line, const char *str)
4545
{
46+
((void) ctx);
4647
((void) level);
4748
ssl_debug_print("%s:%04d: %s", file, line, str);
4849
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /