Skip to content

Commit ac7879c

Browse files
authored
Added NVS test sketch + test script (#6885)
* Added NVS test sketch + test script * Added cfg.json with multiple fqbns * cfg.json missing commas fix * Changed OPI PSRAM to QSPI accordind to new HW setup. * disabled PSRAM for ESP32S3 * Reverting PSRAM changes * Remove Octal flash test Octal flash needs to be tested locally before each release.
1 parent 0260cd6 commit ac7879c

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

Diff for: tests/nvs/cfg.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"targets": [
3+
{
4+
"name": "esp32",
5+
"fqbn":[
6+
"espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio",
7+
"espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dout,FlashFreq=40",
8+
"espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=qio",
9+
"espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=qout,FlashFreq=40"
10+
]
11+
},
12+
{
13+
"name": "esp32s2",
14+
"fqbn": [
15+
"espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dio",
16+
"espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=dout,FlashFreq=40",
17+
"espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=qio",
18+
"espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app,FlashMode=qout,FlashFreq=40"
19+
]
20+
},
21+
{
22+
"name": "esp32c3",
23+
"fqbn": [
24+
"espressif:esp32:esp32c3:PartitionScheme=huge_app,FlashMode=dio",
25+
"espressif:esp32:esp32c3:PartitionScheme=huge_app,FlashMode=dout,FlashFreq=40",
26+
"espressif:esp32:esp32c3:PartitionScheme=huge_app,FlashMode=qio",
27+
"espressif:esp32:esp32c3:PartitionScheme=huge_app,FlashMode=qout,FlashFreq=40"
28+
]
29+
},
30+
{
31+
"name": "esp32s3",
32+
"fqbn": [
33+
"espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app,FlashMode=qio",
34+
"espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app,FlashMode=qio120",
35+
"espressif:esp32:esp32s3:PSRAM=opi,USBMode=default,PartitionScheme=huge_app,FlashMode=dio"
36+
]
37+
}
38+
]
39+
}

Diff for: tests/nvs/nvs.ino

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <Preferences.h>
2+
3+
Preferences preferences;
4+
5+
void setup() {
6+
Serial.begin(115200);
7+
8+
while (!Serial) {
9+
;
10+
}
11+
12+
preferences.begin("my-app", false);
13+
14+
// Get the counter value, if the key does not exist, return a default value of 0
15+
unsigned int counter = preferences.getUInt("counter", 0);
16+
17+
// Print the counter to Serial Monitor
18+
Serial.printf("Current counter value: %u\n", counter);
19+
20+
// Increase counter by 1
21+
counter++;
22+
23+
// Store the counter to the Preferences
24+
preferences.putUInt("counter", counter);
25+
26+
// Close the Preferences
27+
preferences.end();
28+
29+
// Wait 1 second
30+
delay(1000);
31+
32+
// Restart ESP
33+
ESP.restart();
34+
}
35+
36+
void loop() {}

Diff for: tests/nvs/test_nvs.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def test_nvs(dut):
2+
dut.expect('Current counter value: 0')
3+
dut.expect('Current counter value: 1')
4+
dut.expect('Current counter value: 2')
5+
dut.expect('Current counter value: 3')
6+
dut.expect('Current counter value: 4')
7+
dut.expect('Current counter value: 5')

0 commit comments

Comments
 (0)