Skip to content

Commit 0a6c354

Browse files
authored
Merge branch 'espressif:master' into speed_OTA
2 parents 45a7a95 + fef932c commit 0a6c354

File tree

29 files changed

+684
-68
lines changed

29 files changed

+684
-68
lines changed

boards.txt

Lines changed: 317 additions & 19 deletions
Large diffs are not rendered by default.

cores/esp32/HardwareSerial.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ void HardwareSerial::setRxInvert(bool invert)
491491
// negative Pin value will keep it unmodified
492492
void HardwareSerial::setPins(int8_t rxPin, int8_t txPin, int8_t ctsPin, int8_t rtsPin)
493493
{
494+
if(_uart == NULL) {
495+
log_e("setPins() shall be called after begin() - nothing done");
496+
return;
497+
}
494498
uartSetPins(_uart, rxPin, txPin, ctsPin, rtsPin);
495499
}
496500

cores/esp32/esp32-hal-gpio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ static InterruptHandle_t __pinInterruptHandlers[SOC_GPIO_PIN_COUNT] = {0,};
9191

9292
extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
9393
{
94-
#ifdef BOARD_HAS_NEOPIXEL
95-
if (pin == LED_BUILTIN){
96-
__pinMode(LED_BUILTIN-SOC_GPIO_PIN_COUNT, mode);
94+
#ifdef RGB_BUILTIN
95+
if (pin == RGB_BUILTIN){
96+
__pinMode(RGB_BUILTIN-SOC_GPIO_PIN_COUNT, mode);
9797
return;
9898
}
9999
#endif
@@ -134,11 +134,11 @@ extern void ARDUINO_ISR_ATTR __pinMode(uint8_t pin, uint8_t mode)
134134

135135
extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val)
136136
{
137-
#ifdef BOARD_HAS_NEOPIXEL
138-
if(pin == LED_BUILTIN){
137+
#ifdef RGB_BUILTIN
138+
if(pin == RGB_BUILTIN){
139139
//use RMT to set all channels on/off
140-
const uint8_t comm_val = val != 0 ? LED_BRIGHTNESS : 0;
141-
neopixelWrite(LED_BUILTIN, comm_val, comm_val, comm_val);
140+
const uint8_t comm_val = val != 0 ? RGB_BRIGHTNESS : 0;
141+
neopixelWrite(RGB_BUILTIN, comm_val, comm_val, comm_val);
142142
return;
143143
}
144144
#endif

cores/esp32/esp32-hal-i2c.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ esp_err_t i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t frequency){
7272
} else if(frequency > 1000000UL){
7373
frequency = 1000000UL;
7474
}
75+
log_i("Initialising I2C Master: sda=%d scl=%d freq=%d", sda, scl, frequency);
7576

7677
i2c_config_t conf = { };
7778
conf.mode = I2C_MODE_MASTER;

cores/esp32/esp32-hal-ledc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,7 @@ void analogWrite(uint8_t pin, int value) {
226226
ledcWrite(pin_to_channel[pin] - 1, value);
227227
}
228228
}
229+
230+
int8_t analogGetChannel(uint8_t pin) {
231+
return pin_to_channel[pin] - 1;
232+
}

cores/esp32/esp32-hal-rgb-led.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue
77
static bool initialized = false;
88

99
uint8_t _pin = pin;
10-
#ifdef BOARD_HAS_NEOPIXEL
11-
if(pin == LED_BUILTIN){
12-
_pin = LED_BUILTIN-SOC_GPIO_PIN_COUNT;
10+
#ifdef RGB_BUILTIN
11+
if(pin == RGB_BUILTIN){
12+
_pin = RGB_BUILTIN-SOC_GPIO_PIN_COUNT;
1313
}
1414
#endif
1515

cores/esp32/esp32-hal-rgb-led.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ extern "C" {
77

88
#include "esp32-hal.h"
99

10-
#ifndef LED_BRIGHTNESS
11-
#define LED_BRIGHTNESS 64
10+
#ifndef RGB_BRIGHTNESS
11+
#define RGB_BRIGHTNESS 64
1212
#endif
1313

1414
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);

cores/esp32/esp32-hal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ void yield(void);
9292
#include "esp32-hal-cpu.h"
9393

9494
void analogWrite(uint8_t pin, int value);
95+
int8_t analogGetChannel(uint8_t pin);
9596

9697
//returns chip temperature in Celsius
9798
float temperatureRead();

docs/source/faq.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
##########################
22
Frequently Asked Questions
33
##########################
4+
5+
How to modify an sdkconfig option in Arduino?
6+
---------------------------------------------
7+
8+
Arduino-esp32 project is based on ESP-IDF. While ESP-IDF supports configuration of various compile-time options (known as "Kconfig options" or "sdkconfig options") via a "menuconfig" tool, this feature is not available in Arduino IDE.
9+
10+
To use the arduino-esp32 core with a modified sdkconfig option, you need to use ESP-IDF to compile Arduino libraries. Please see :doc:`esp-idf_component` and :doc:`lib_builder` for the two solutions available.
11+
12+
Note that modifying ``sdkconfig`` or ``sdkconfig.h`` files found in the arduino-esp32 project tree **does not** result in changes to these options. This is because ESP-IDF libraries are included into the arduino-esp32 project tree as pre-built libraries.
13+

libraries/BLE/src/BLEAdvertisedDevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <esp_gattc_api.h>
1313

1414
#include <map>
15+
#include <vector>
1516

1617
#include "BLEAddress.h"
1718
#include "BLEScan.h"

libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp

Lines changed: 90 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static ra_filter_t *ra_filter_init(ra_filter_t *filter, size_t sample_size)
148148
return filter;
149149
}
150150

151-
/* unused function triggers error
151+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
152152
static int ra_filter_run(ra_filter_t *filter, int value)
153153
{
154154
if (!filter->values)
@@ -166,7 +166,7 @@ static int ra_filter_run(ra_filter_t *filter, int value)
166166
}
167167
return filter->sum / filter->count;
168168
}
169-
*/
169+
#endif
170170

171171
#if CONFIG_ESP_FACE_DETECT_ENABLED
172172
#if CONFIG_ESP_FACE_RECOGNITION_ENABLED
@@ -1210,67 +1210,144 @@ void startCameraServer()
12101210
.uri = "/",
12111211
.method = HTTP_GET,
12121212
.handler = index_handler,
1213-
.user_ctx = NULL};
1213+
.user_ctx = NULL
1214+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1215+
,
1216+
.is_websocket = true,
1217+
.handle_ws_control_frames = false,
1218+
.supported_subprotocol = NULL
1219+
#endif
1220+
};
12141221

12151222
httpd_uri_t status_uri = {
12161223
.uri = "/status",
12171224
.method = HTTP_GET,
12181225
.handler = status_handler,
1219-
.user_ctx = NULL};
1226+
.user_ctx = NULL
1227+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1228+
,
1229+
.is_websocket = true,
1230+
.handle_ws_control_frames = false,
1231+
.supported_subprotocol = NULL
1232+
#endif
1233+
};
12201234

12211235
httpd_uri_t cmd_uri = {
12221236
.uri = "/control",
12231237
.method = HTTP_GET,
12241238
.handler = cmd_handler,
1225-
.user_ctx = NULL};
1239+
.user_ctx = NULL
1240+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1241+
,
1242+
.is_websocket = true,
1243+
.handle_ws_control_frames = false,
1244+
.supported_subprotocol = NULL
1245+
#endif
1246+
};
12261247

12271248
httpd_uri_t capture_uri = {
12281249
.uri = "/capture",
12291250
.method = HTTP_GET,
12301251
.handler = capture_handler,
1231-
.user_ctx = NULL};
1252+
.user_ctx = NULL
1253+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1254+
,
1255+
.is_websocket = true,
1256+
.handle_ws_control_frames = false,
1257+
.supported_subprotocol = NULL
1258+
#endif
1259+
};
12321260

12331261
httpd_uri_t stream_uri = {
12341262
.uri = "/stream",
12351263
.method = HTTP_GET,
12361264
.handler = stream_handler,
1237-
.user_ctx = NULL};
1265+
.user_ctx = NULL
1266+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1267+
,
1268+
.is_websocket = true,
1269+
.handle_ws_control_frames = false,
1270+
.supported_subprotocol = NULL
1271+
#endif
1272+
};
12381273

12391274
httpd_uri_t bmp_uri = {
12401275
.uri = "/bmp",
12411276
.method = HTTP_GET,
12421277
.handler = bmp_handler,
1243-
.user_ctx = NULL};
1278+
.user_ctx = NULL
1279+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1280+
,
1281+
.is_websocket = true,
1282+
.handle_ws_control_frames = false,
1283+
.supported_subprotocol = NULL
1284+
#endif
1285+
};
12441286

12451287
httpd_uri_t xclk_uri = {
12461288
.uri = "/xclk",
12471289
.method = HTTP_GET,
12481290
.handler = xclk_handler,
1249-
.user_ctx = NULL};
1291+
.user_ctx = NULL
1292+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1293+
,
1294+
.is_websocket = true,
1295+
.handle_ws_control_frames = false,
1296+
.supported_subprotocol = NULL
1297+
#endif
1298+
};
12501299

12511300
httpd_uri_t reg_uri = {
12521301
.uri = "/reg",
12531302
.method = HTTP_GET,
12541303
.handler = reg_handler,
1255-
.user_ctx = NULL};
1304+
.user_ctx = NULL
1305+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1306+
,
1307+
.is_websocket = true,
1308+
.handle_ws_control_frames = false,
1309+
.supported_subprotocol = NULL
1310+
#endif
1311+
};
12561312

12571313
httpd_uri_t greg_uri = {
12581314
.uri = "/greg",
12591315
.method = HTTP_GET,
12601316
.handler = greg_handler,
1261-
.user_ctx = NULL};
1317+
.user_ctx = NULL
1318+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1319+
,
1320+
.is_websocket = true,
1321+
.handle_ws_control_frames = false,
1322+
.supported_subprotocol = NULL
1323+
#endif
1324+
};
12621325

12631326
httpd_uri_t pll_uri = {
12641327
.uri = "/pll",
12651328
.method = HTTP_GET,
12661329
.handler = pll_handler,
1267-
.user_ctx = NULL};
1330+
.user_ctx = NULL
1331+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1332+
,
1333+
.is_websocket = true,
1334+
.handle_ws_control_frames = false,
1335+
.supported_subprotocol = NULL
1336+
#endif
1337+
};
12681338

12691339
httpd_uri_t win_uri = {
12701340
.uri = "/resolution",
12711341
.method = HTTP_GET,
12721342
.handler = win_handler,
1273-
.user_ctx = NULL};
1343+
.user_ctx = NULL
1344+
#ifdef CONFIG_HTTPD_WS_SUPPORT
1345+
,
1346+
.is_websocket = true,
1347+
.handle_ws_control_frames = false,
1348+
.supported_subprotocol = NULL
1349+
#endif
1350+
};
12741351

12751352
ra_filter_init(&ra_filter, 20);
12761353

libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
44
Demonstrates usage of onboard RGB LED on some ESP dev boards.
55
6-
Calling digitalWrite(LED_BUILTIN, HIGH) will use hidden RGB driver.
6+
Calling digitalWrite(RGB_BUILTIN, HIGH) will use hidden RGB driver.
77
88
RGBLedWrite demonstrates controll of each channel:
99
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
1010
1111
WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin
1212
with normal HIGH/LOW level
1313
*/
14-
//#define LED_BRIGHTNESS 64 // Change white brightness (max 255)
14+
//#define RGB_BRIGHTNESS 64 // Change white brightness (max 255)
1515

1616
// the setup function runs once when you press reset or power the board
1717

@@ -21,19 +21,19 @@ void setup() {
2121

2222
// the loop function runs over and over again forever
2323
void loop() {
24-
#ifdef BOARD_HAS_NEOPIXEL
25-
digitalWrite(LED_BUILTIN, HIGH); // Turn the RGB LED white
24+
#ifdef RGB_BUILTIN
25+
digitalWrite(RGB_BUILTIN, HIGH); // Turn the RGB LED white
2626
delay(1000);
27-
digitalWrite(LED_BUILTIN, LOW); // Turn the RGB LED off
27+
digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off
2828
delay(1000);
2929

30-
neopixelWrite(LED_BUILTIN,LED_BRIGHTNESS,0,0); // Red
30+
neopixelWrite(RGB_BUILTIN,RGB_BRIGHTNESS,0,0); // Red
3131
delay(1000);
32-
neopixelWrite(LED_BUILTIN,0,LED_BRIGHTNESS,0); // Green
32+
neopixelWrite(RGB_BUILTIN,0,RGB_BRIGHTNESS,0); // Green
3333
delay(1000);
34-
neopixelWrite(LED_BUILTIN,0,0,LED_BRIGHTNESS); // Blue
34+
neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue
3535
delay(1000);
36-
neopixelWrite(LED_BUILTIN,0,0,0); // Off / black
36+
neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black
3737
delay(1000);
3838
#endif
3939
}

libraries/ESP32/keywords.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#######################################
2+
# Syntax Coloring Map
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
#######################################
10+
# Methods and Functions (KEYWORD2)
11+
#######################################
12+
13+
#######################################
14+
# Constants (LITERAL1)
15+
#######################################
16+
17+
RGB_BUILTIN LITERAL1

libraries/WebServer/src/WebServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ void WebServer::sendContent_P(PGM_P content, size_t size) {
527527
}
528528

529529

530-
void WebServer::_streamFileCore(const size_t fileSize, const String & fileName, const String & contentType)
530+
void WebServer::_streamFileCore(const size_t fileSize, const String & fileName, const String & contentType, const int code)
531531
{
532532
using namespace mime;
533533
setContentLength(fileSize);
@@ -536,7 +536,7 @@ void WebServer::_streamFileCore(const size_t fileSize, const String & fileName,
536536
contentType != String(FPSTR(mimeTable[none].mimeType))) {
537537
sendHeader(F("Content-Encoding"), F("gzip"));
538538
}
539-
send(200, contentType, "");
539+
send(code, contentType, "");
540540
}
541541

542542
String WebServer::pathArg(unsigned int i) {

libraries/WebServer/src/WebServer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ class WebServer
139139
static String urlDecode(const String& text);
140140

141141
template<typename T>
142-
size_t streamFile(T &file, const String& contentType) {
143-
_streamFileCore(file.size(), file.name(), contentType);
142+
size_t streamFile(T &file, const String& contentType, const int code = 200) {
143+
_streamFileCore(file.size(), file.name(), contentType, code);
144144
return _currentClient.write(file);
145145
}
146146

@@ -160,7 +160,7 @@ class WebServer
160160
void _prepareHeader(String& response, int code, const char* content_type, size_t contentLength);
161161
bool _collectHeader(const char* headerName, const char* headerValue);
162162

163-
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType);
163+
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType, const int code = 200);
164164

165165
String _getRandomHexString();
166166
// for extracting Auth parameters

libraries/WiFi/src/WiFiGeneric.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static void _arduino_event_cb(void* arg, esp_event_base_t event_base, int32_t ev
495495
log_v("SC Found Channel");
496496
arduino_event.event_id = ARDUINO_EVENT_SC_FOUND_CHANNEL;
497497
} else if (event_base == SC_EVENT && event_id == SC_EVENT_GOT_SSID_PSWD) {
498-
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
498+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
499499
smartconfig_event_got_ssid_pswd_t *event = (smartconfig_event_got_ssid_pswd_t *)event_data;
500500
log_v("SC: SSID: %s, Password: %s", (const char *)event->ssid, (const char *)event->password);
501501
#endif

0 commit comments

Comments
 (0)