Skip to content

Commit 447f6db

Browse files
authored
Merge branch 'master' into release/v2.x
2 parents 3670e2b + 72c41d0 commit 447f6db

File tree

25 files changed

+1378
-141
lines changed

25 files changed

+1378
-141
lines changed

.github/ISSUE_TEMPLATE/Issue-report.yml

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ body:
4141
options:
4242
- latest master (checkout manually)
4343
- latest development Release Candidate (RC-X)
44+
- v2.0.9
4445
- v2.0.8
4546
- v2.0.7
4647
- v2.0.6

boards.txt

+786-2
Large diffs are not rendered by default.

cores/esp32/HWCDC.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ESP_EVENT_DEFINE_BASE(ARDUINO_HW_CDC_EVENTS);
2828

2929
static RingbufHandle_t tx_ring_buf = NULL;
3030
static xQueueHandle rx_queue = NULL;
31-
static uint8_t rx_data_buf[64];
31+
static uint8_t rx_data_buf[64] = {0};
3232
static intr_handle_t intr_handle = NULL;
3333
static volatile bool initial_empty = false;
3434
static xSemaphoreHandle tx_lock = NULL;
@@ -195,6 +195,7 @@ void HWCDC::end()
195195
intr_handle = NULL;
196196
if(tx_lock != NULL) {
197197
vSemaphoreDelete(tx_lock);
198+
tx_lock = NULL;
198199
}
199200
setRxBufferSize(0);
200201
setTxBufferSize(0);

cores/esp32/HardwareSerial.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,6 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
367367
}
368368
break;
369369
#endif
370-
default:
371-
log_e("Bad UART Number");
372-
return;
373370
}
374371
}
375372

cores/esp32/esp32-hal-bt.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
#ifdef CONFIG_BT_ENABLED
1818

19-
bool btInUse(){ return true; }
19+
// user may want to change it to free resources
20+
__attribute__((weak)) bool btInUse(){ return true; }
2021

2122
#include "esp_bt.h"
2223

cores/esp32/esp32-hal-misc.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,8 @@ bool verifyRollbackLater() { return false; }
209209
#endif
210210

211211
#ifdef CONFIG_BT_ENABLED
212-
//overwritten in esp32-hal-bt.c
213-
bool btInUse() __attribute__((weak));
214-
bool btInUse(){ return false; }
212+
//from esp32-hal-bt.c
213+
extern bool btInUse();
215214
#endif
216215

217216
void initArduino()

docs/source/api/ledc.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ This function is used to setup the LEDC channel to 50 % PWM tone on selected fre
9090
* ``freq`` select frequency of pwm signal.
9191

9292
This function will return ``frequency`` set for channel.
93-
If ``0`` is returned, error occurs and ledc cahnnel was not configured.
93+
If ``0`` is returned, error occurs and ledc channel was not configured.
9494

9595
ledcWriteNote
9696
*************

docs/source/faq.rst

+17
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,20 @@ How to compile libs with different debug level?
1515
-----------------------------------------------
1616

1717
The short answer is ``esp32-arduino-lib-builder/configs/defconfig.common:44``. A guide explaining the process can be found here <guides/core_debug>
18+
19+
SPIFFS mount failed
20+
-------------------
21+
When you come across and error like this:
22+
23+
.. code-block:: shell
24+
25+
E (588) SPIFFS: mount failed, -10025
26+
[E][SPIFFS.cpp:47] begin(): Mounting SPIFFS failed! Error: -1
27+
28+
Try enforcing format on fail in your code by adding ``true`` in the ``begin`` method such as this:
29+
30+
.. code-block:: c++
31+
32+
SPIFFS.begin(true);
33+
34+
See the method prototype for reference: ``bool begin(bool formatOnFail=false, const char * basePath="/spiffs", uint8_t maxOpenFiles=10, const char * partitionLabel=NULL);``

docs/source/tutorials/preferences.rst

+31-18
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ Like so:
233233

234234
.. code-block:: arduino
235235
236-
String myString = myPreferences.getString("myStringKey");
236+
float myFloat = myPreferences.getFloat("pi");
237237
238-
This will retrieve the String value from the namespace key ``"myStringKey"`` and assign it to the String type variable ``myString``.
238+
This will retrieve the float value from the namespace key ``"pi"`` and assign it to the float type variable ``myFloat``.
239239

240240

241241
Summary
@@ -277,9 +277,10 @@ When started, the system has no way of knowing which of the above conditions is
277277
// not the complete setup(), but in setup(), include this...
278278
279279
stcPrefs.begin("STCPrefs", RO_MODE); // Open our namespace (or create it
280-
// if it doesn't exist) in in RO mode.
280+
// if it doesn't exist) in RO mode.
281281
282-
bool tpInit = stcPrefs.isKey("nvsInit"); // Test for the existence of the "already initialized" key.
282+
bool tpInit = stcPrefs.isKey("nvsInit"); // Test for the existence
283+
// of the "already initialized" key.
283284
284285
if (tpInit == false) {
285286
// If tpInit is 'false', the key "nvsInit" does not yet exist therefore this
@@ -289,13 +290,15 @@ When started, the system has no way of knowing which of the above conditions is
289290
290291
291292
// The .begin() method created the "STCPrefs" namespace and since this is our
292-
// first-time run we will create our keys and store the initial "factory default" values.
293+
// first-time run we will create
294+
// our keys and store the initial "factory default" values.
293295
stcPrefs.putUChar("curBright", 10);
294296
stcPrefs.putString("talChan", "one");
295297
stcPrefs.putLong("talMax", -220226);
296298
stcPrefs.putBool("ctMde", true);
297299
298-
stcPrefs.putBool("nvsInit", true); // Create the "already initialized" key and store a value.
300+
stcPrefs.putBool("nvsInit", true); // Create the "already initialized"
301+
// key and store a value.
299302
300303
// The "factory defaults" are created and stored so...
301304
stcPrefs.end(); // Close the namespace in RW mode and...
@@ -456,10 +459,12 @@ This is best explained with an example. Here the ``Bytes`` methods are used to s
456459
Serial.begin(115200);
457460
delay(250);
458461
459-
mySketchPrefs.begin("myPrefs", RW_MODE); // open (or create) the namespace "myPrefs" in RW mode
462+
mySketchPrefs.begin("myPrefs", RW_MODE); // open (or create) the namespace
463+
// "myPrefs" in RW mode
460464
mySketchPrefs.clear(); // delete any previous keys in this namespace
461465
462-
// Create an array of test values. We're using hex numbers throughout to better show how the bytes move around.
466+
// Create an array of test values. We're using hex numbers
467+
// throughout to better show how the bytes move around.
463468
int16_t myArray[] = { 0x1112, 0x2122, 0x3132, 0x4142, 0x5152, 0x6162, 0x7172 };
464469
465470
Serial.println("Printing myArray...");
@@ -468,22 +473,28 @@ This is best explained with an example. Here the ``Bytes`` methods are used to s
468473
}
469474
Serial.println("\r\n");
470475
471-
// In the next statement, the second sizeof() needs to match the data type of the elements of myArray
472-
Serial.print("The number of elements in myArray is: "); Serial.println( sizeof(myArray) / sizeof(int16_t) );
473-
Serial.print("But the size of myArray in bytes is: "); Serial.println( sizeof(myArray) );
476+
// In the next statement, the second sizeof() needs
477+
// to match the data type of the elements of myArray
478+
Serial.print("The number of elements in myArray is: ");
479+
Serial.println( sizeof(myArray) / sizeof(int16_t) );
480+
Serial.print("But the size of myArray in bytes is: ");
481+
Serial.println( sizeof(myArray) );
474482
Serial.println("");
475483
476-
Serial.println("Storing myArray into the Preferences namespace \"myPrefs\" against the key \"myPrefsBytes\".");
484+
Serial.println(
485+
"Storing myArray into the Preferences namespace \"myPrefs\" against the key \"myPrefsBytes\".");
477486
// Note: in the next statement, to store the entire array, we must use the
478487
// size of the arrray in bytes, not the number of elements in the array.
479488
mySketchPrefs.putBytes( "myPrefsBytes", myArray, sizeof(myArray) );
480-
Serial.print("The size of \"myPrefsBytes\" is (in bytes): "); Serial.println( mySketchPrefs.getBytesLength("myPrefsBytes") );
489+
Serial.print("The size of \"myPrefsBytes\" is (in bytes): ");
490+
Serial.println( mySketchPrefs.getBytesLength("myPrefsBytes") );
481491
Serial.println("");
482492
483-
int16_t myIntBuffer[20] = {}; // No magic about 20. Just making a buffer (array) big enough.
493+
int16_t myIntBuffer[20] = {}; // No magic about 20. Just making a buffer (array) big enough.
484494
Serial.println("Retrieving the value of myPrefsBytes into myIntBuffer.");
485495
Serial.println(" - Note the data type of myIntBuffer matches that of myArray");
486-
mySketchPrefs.getBytes( "myPrefsBytes", myIntBuffer, mySketchPrefs.getBytesLength("myPrefsBytes") );
496+
mySketchPrefs.getBytes("myPrefsBytes", myIntBuffer,
497+
mySketchPrefs.getBytesLength("myPrefsBytes"));
487498
488499
Serial.println("Printing myIntBuffer...");
489500
// In the next statement, sizeof() needs to match the data type of the elements of myArray
@@ -492,9 +503,11 @@ This is best explained with an example. Here the ``Bytes`` methods are used to s
492503
}
493504
Serial.println("\r\n");
494505
495-
Serial.println("We can see how the data from myArray is actually stored in the namespace as follows.");
496-
uint8_t myByteBuffer[40] = {}; // No magic about 40. Just making a buffer (array) big enough.
497-
mySketchPrefs.getBytes( "myPrefsBytes", myByteBuffer, mySketchPrefs.getBytesLength("myPrefsBytes") );
506+
Serial.println(
507+
"We can see how the data from myArray is actually stored in the namespace as follows.");
508+
uint8_t myByteBuffer[40] = {}; // No magic about 40. Just making a buffer (array) big enough.
509+
mySketchPrefs.getBytes("myPrefsBytes", myByteBuffer,
510+
mySketchPrefs.getBytesLength("myPrefsBytes"));
498511
499512
Serial.println("Printing myByteBuffer...");
500513
for (int i = 0; i < mySketchPrefs.getBytesLength("myPrefsBytes"); i++) {

libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
//#define CAMERA_MODEL_ESP32_CAM_BOARD
2929
//#define CAMERA_MODEL_ESP32S2_CAM_BOARD
3030
//#define CAMERA_MODEL_ESP32S3_CAM_LCD
31-
31+
//#define CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3 // Has PSRAM
32+
//#define CAMERA_MODEL_DFRobot_Romeo_ESP32S3 // Has PSRAM
3233
#include "camera_pins.h"
3334

3435
// ===========================

libraries/ESP32/examples/Camera/CameraWebServer/camera_pins.h

+19
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,25 @@
293293
#define HREF_GPIO_NUM 7
294294
#define PCLK_GPIO_NUM 13
295295

296+
#elif defined(CAMERA_MODEL_DFRobot_FireBeetle2_ESP32S3) || defined(CAMERA_MODEL_DFRobot_Romeo_ESP32S3)
297+
#define PWDN_GPIO_NUM -1
298+
#define RESET_GPIO_NUM -1
299+
#define XCLK_GPIO_NUM 45
300+
#define SIOD_GPIO_NUM 1
301+
#define SIOC_GPIO_NUM 2
302+
303+
#define Y9_GPIO_NUM 48
304+
#define Y8_GPIO_NUM 46
305+
#define Y7_GPIO_NUM 8
306+
#define Y6_GPIO_NUM 7
307+
#define Y5_GPIO_NUM 4
308+
#define Y4_GPIO_NUM 41
309+
#define Y3_GPIO_NUM 40
310+
#define Y2_GPIO_NUM 39
311+
#define VSYNC_GPIO_NUM 6
312+
#define HREF_GPIO_NUM 42
313+
#define PCLK_GPIO_NUM 5
314+
296315
#else
297316
#error "Camera model not selected"
298317
#endif

libraries/ESP32/examples/GPIO/FunctionalInterrupt/FunctionalInterrupt.ino

+31-8
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,67 @@
1+
/*
2+
* This example demonstrates usage of interrupt by detecting a button press.
3+
*
4+
* Setup: Connect first button between pin defined in BUTTON1 and GND
5+
* Similarly connect second button between pin defined in BUTTON2 and GND.
6+
* If you do not have a button simply connect a wire to those buttons
7+
* - touching GND pin with other end of the wire will behave same as pressing the connected button.
8+
* Wen using the bare wire be careful not to touch any other pin by accident.
9+
*
10+
* Note: There is no de-bounce implemented and the physical connection will normally
11+
* trigger many more button presses than actually happened.
12+
* This is completely normal and is not to be considered a fault.
13+
*/
14+
15+
116
#include <Arduino.h>
217
#include <FunctionalInterrupt.h>
318

419
#define BUTTON1 16
520
#define BUTTON2 17
621

7-
class Button
8-
{
22+
class Button{
923
public:
1024
Button(uint8_t reqPin) : PIN(reqPin){
1125
pinMode(PIN, INPUT_PULLUP);
12-
attachInterrupt(PIN, std::bind(&Button::isr,this), FALLING);
1326
};
14-
~Button() {
27+
28+
void begin(){
29+
attachInterrupt(PIN, std::bind(&Button::isr,this), FALLING);
30+
Serial.printf("Started button interrupt on pin %d\n", PIN);
31+
}
32+
33+
~Button(){
1534
detachInterrupt(PIN);
1635
}
1736

18-
void ARDUINO_ISR_ATTR isr() {
37+
void ARDUINO_ISR_ATTR isr(){
1938
numberKeyPresses += 1;
2039
pressed = true;
2140
}
2241

23-
void checkPressed() {
42+
void checkPressed(){
2443
if (pressed) {
2544
Serial.printf("Button on pin %u has been pressed %u times\n", PIN, numberKeyPresses);
2645
pressed = false;
2746
}
2847
}
2948

3049
private:
31-
const uint8_t PIN;
50+
const uint8_t PIN;
3251
volatile uint32_t numberKeyPresses;
3352
volatile bool pressed;
3453
};
3554

3655
Button button1(BUTTON1);
3756
Button button2(BUTTON2);
3857

39-
4058
void setup() {
4159
Serial.begin(115200);
60+
while(!Serial) delay(10);
61+
Serial.println("Starting Functional Interrupt example.");
62+
button1.begin();
63+
button2.begin();
64+
Serial.println("Setup done.");
4265
}
4366

4467
void loop() {

libraries/RainMaker/src/RMakerDevice.cpp

+15-11
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,31 @@
55
static esp_err_t err;
66
typedef void (*deviceWriteCb)(Device*, Param*, const param_val_t val, void *priv_data, write_ctx_t *ctx);
77
typedef void (*deviceReadCb)(Device*, Param*, void *priv_data, read_ctx_t *ctx);
8-
9-
void (*write_cb)(Device*, Param*, param_val_t, void*, write_ctx_t*);
10-
void (*read_cb)(Device*, Param*, void*, read_ctx_t*);
11-
Device device;
12-
Param param;
8+
typedef struct {
9+
void *priv_data;
10+
deviceWriteCb write_cb;
11+
deviceReadCb read_cb;
12+
} RMakerDevicePrivT;
1313

1414
static esp_err_t write_callback(const device_handle_t *dev_handle, const param_handle_t *par_handle, const param_val_t val, void *priv_data, write_ctx_t *ctx)
1515
{
16+
Device device;
17+
Param param;
1618
device.setDeviceHandle(dev_handle);
1719
param.setParamHandle(par_handle);
18-
19-
write_cb(&device, &param, val, priv_data, ctx);
20+
deviceWriteCb cb = ((RMakerDevicePrivT *)priv_data)->write_cb;
21+
cb(&device, &param, val, ((RMakerDevicePrivT *)priv_data)->priv_data, ctx);
2022
return ESP_OK;
2123
}
2224

2325
static esp_err_t read_callback(const device_handle_t *dev_handle, const param_handle_t *par_handle, void *priv_data, read_ctx_t *ctx)
2426
{
27+
Device device;
28+
Param param;
2529
device.setDeviceHandle(dev_handle);
2630
param.setParamHandle(par_handle);
27-
28-
read_cb(&device, &param, priv_data, ctx);
31+
deviceReadCb cb = ((RMakerDevicePrivT *)priv_data)->read_cb;
32+
cb(&device, &param, ((RMakerDevicePrivT *)priv_data)->priv_data, ctx);
2933
return ESP_OK;
3034
}
3135

@@ -41,8 +45,8 @@ esp_err_t Device::deleteDevice()
4145

4246
void Device::addCb(deviceWriteCb writeCb, deviceReadCb readCb)
4347
{
44-
write_cb = writeCb;
45-
read_cb = readCb;
48+
this->private_data.write_cb = writeCb;
49+
this->private_data.read_cb = readCb;
4650
err = esp_rmaker_device_add_cb(getDeviceHandle(), write_callback, read_callback);
4751
if(err != ESP_OK) {
4852
log_e("Failed to register callback");

0 commit comments

Comments
 (0)