Skip to content

Commit 4619fdc

Browse files
authored
Merge pull request #26 from tobozo/1.5.0
1.5.0
2 parents bc40a8e + b8edc1e commit 4619fdc

File tree

17 files changed

+570
-230
lines changed

17 files changed

+570
-230
lines changed

.github/workflows/ArduinoBuild.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ jobs:
6161
- 2.0.15
6262
- 2.0.16
6363
- 2.0.17
64-
- 3.0.0
65-
- 3.0.1
64+
- 3.1.1
65+
- 3.1.2
6666
- latest
6767

6868
include:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: PlatformIOBuild
2+
3+
env:
4+
PROJECT_DIR: examples/test
5+
6+
on:
7+
push:
8+
paths:
9+
- '**.ino'
10+
- '**.cpp'
11+
- '**.hpp'
12+
- '**.h'
13+
- '**.c'
14+
- '**PlatformioBuild.yml'
15+
pull_request:
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
name: ${{ matrix.pio-env }}
21+
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
matrix:
26+
pio-env:
27+
- esp32
28+
- esp8266
29+
- rp2040_pico
30+
- rp2350_pico2
31+
- seeed_wio_terminal
32+
33+
fail-fast: false
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ github.event.pull_request.head.sha }}
40+
41+
- name: Cache pip
42+
uses: actions/cache@v4
43+
with:
44+
path: ~/.cache/pip
45+
key: ${{ runner.os }}-pip-${{ matrix.pio-env }}
46+
restore-keys: |
47+
${{ runner.os }}-pip-
48+
- name: Cache PlatformIO
49+
uses: actions/cache@v4
50+
with:
51+
path: ~/.platformio
52+
key: ${{ runner.os }}-pio-${{ matrix.pio-env }}
53+
- name: Set up Python
54+
uses: actions/setup-python@v4
55+
with:
56+
python-version: '3.9'
57+
58+
- name: Install PlatformIO
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install --upgrade platformio
62+
63+
- name: Run PlatformIO
64+
65+
run: |
66+
cd ${{ env.PROJECT_DIR }}
67+
pio pkg install -e ${{ matrix.pio-env }} --no-save --library file://$(realpath ../../) --force
68+
pio run -e ${{ matrix.pio-env }}

examples/ReadWriteConfigFile/ReadWriteConfigFile.ino

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
#define FS_t fs::FS
77
#define File_t fs::File
88
#define delay_fn vTaskDelay
9-
#elif defined CORE_TEENSY
9+
#else
1010
#include <FS.h>
1111
#include <SD.h>
1212
#define FS_t FS
1313
#define File_t File
1414
#define delay_fn delay
15-
#else
16-
#error "please implement"
1715
#endif
1816

1917

@@ -41,7 +39,7 @@ const char* nodename = "my_setting"; // property name in the config
4139
const bool default_value = false; // default value for property
4240
bool current_value = default_value;
4341
bool config_loaded = false; // prevent updates if config isn't loaded
44-
DynamicJsonDocument json_doc(2048);
42+
JsonDocument json_doc;
4543
JsonObject myConfig; // json accessor
4644

4745

@@ -63,7 +61,7 @@ bool loadYamlConfig()
6361
{
6462
File_t file = SD.open( config_file );
6563
if( !file ) {
66-
Serial.println("Can't open test file for writing :-(");
64+
Serial.println("Can't open test file for reading :-(");
6765
return false;
6866
}
6967
auto err = deserializeYml( json_doc, file ); // convert yaml to json
@@ -119,7 +117,8 @@ void setup()
119117
Serial.begin(115200);
120118
SD.begin( BUILTIN_SDCARD );
121119
#else
122-
#error "please implement"
120+
Serial.begin(115200);
121+
SD.begin(SS);
123122
#endif
124123

125124

examples/deserializeYml/deserializeYml.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const char* json_sample_str = R"_JSON_STRING_(
2626
"blah": { "nope": [ "n", "o", "p", "e" ] },
2727
"integer": 12345,
2828
"float": 12.3323,
29-
"qinteger": "12345"
30-
"qfloat": "12.3323"
29+
"qinteger": "12345",
30+
"qfloat": "12.3323",
3131
"last": true
3232
}
3333

examples/serializeYml/serializeYml.ino

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ blah:
88
nope: ["n","o","p","e"]
99
integer: 12345
1010
float: 12.3323
11+
hex: 0x1234
12+
dq_hex: "0x1234"
13+
sq_hex: '0x1234'
1114
last: true
1215
1316
)_YAML_STRING_";
@@ -19,6 +22,9 @@ const char* json_sample_str = R"_JSON_STRING_(
1922
"blah": { "nope": [ "n", "o", "p", "e" ] },
2023
"integer": 12345,
2124
"float": 12.3323,
25+
"hex": 4660,
26+
"dq_hex": "0x1234",
27+
"sq_hex": "0x1234",
2228
"last": true
2329
}
2430
@@ -43,29 +49,32 @@ int test_number = 1;
4349

4450
void test_Yaml2JsonPretty()
4551
{
46-
#if defined TEST_YAML_TO_JSON
47-
String yaml_str = String( yaml_sample_str );
48-
StringStream yaml_stream( yaml_str );
49-
serializeYml( yaml_stream, Serial, YAMLParser::OUTPUT_JSON_PRETTY );
52+
#if defined TEST_YAML_TO_JSON_PRETTY
53+
Serial.println("serializeYml (OUTPUT_JSON_PRETTY)");
54+
YAMLNode yamlnode = YAMLNode::loadString( yaml_sample_str );
55+
serializeYml( yamlnode.getDocument(), Serial, OUTPUT_JSON_PRETTY );
56+
Serial.println();
5057
#endif
5158
}
5259

5360
void test_Yaml2Json()
5461
{
55-
#if defined TEST_YAML_TO_JSON_PRETTY
56-
String yaml_str = String( yaml_sample_str );
57-
StringStream yaml_stream( yaml_str );
58-
serializeYml( yaml_stream, Serial, YAMLParser::OUTPUT_JSON );
62+
#if defined TEST_YAML_TO_JSON
63+
Serial.println("serializeYml (OUTPUT_JSON)");
64+
YAMLNode yamlnode = YAMLNode::loadString( yaml_sample_str );
65+
serializeYml( yamlnode.getDocument(), Serial, OUTPUT_JSON );
66+
Serial.println();
5967
#endif
6068
}
6169

6270

6371
void test_Json2Yaml()
6472
{
6573
#if defined TEST_JSON_TO_YAML
66-
String yaml_str = String( yaml_sample_str );
67-
StringStream yaml_stream( yaml_str );
68-
serializeYml( yaml_stream, Serial, YAMLParser::OUTPUT_YAML );
74+
Serial.println("serializeYml (OUTPUT_YAML)");
75+
YAMLNode yamlnode = YAMLNode::loadString( json_sample_str );
76+
serializeYml( yamlnode.getDocument(), Serial, OUTPUT_YAML );
77+
Serial.println();
6978
#endif
7079
}
7180

@@ -75,7 +84,7 @@ void test_serializeYml_JsonObject_YamlStream()
7584
#if defined TEST_ArduinoJsonObject_TO_YAML_Stream
7685
// Convert JsonObject to yaml
7786
String json_str = String( json_sample_str );
78-
DynamicJsonDocument doc(128); // create and populate a JsonObject
87+
JsonDocument doc; // create and populate a JsonObject
7988
auto err = deserializeJson( doc, json_str.c_str() );
8089
if( err ) {
8190
Serial.printf("Unable to deserialize demo JSON to JsonObject: %s", err.c_str() );
@@ -93,7 +102,7 @@ void test_serializeYml_JsonObject_YamlString()
93102
// Convert JsonObject to yaml
94103
String str_yaml_out = ""; // YAML output string
95104
String json_str = String( json_sample_str );
96-
DynamicJsonDocument doc(128); // create and populate a JsonObject
105+
JsonDocument doc; // create and populate a JsonObject
97106
auto err = deserializeJson( doc, json_str.c_str() );
98107
if( err ) {
99108
Serial.printf("Unable to deserialize demo JSON to JsonObject: %s", err.c_str() );
@@ -112,7 +121,7 @@ void setup()
112121
{
113122
Serial.begin(115200);
114123
delay(5000);
115-
Serial.printf("Welcome to the YAML Test sketch\nRam free: %d bytes", HEAP_AVAILABLE() );
124+
Serial.printf("Welcome to the YAML Test sketch\nRam free: %d bytes\n", HEAP_AVAILABLE() );
116125

117126
// YAML::setLogLevel( YAML::LogLevelDebug ); // override sketch debug level (otherwise inherited)
118127
// YAML::setJSONIndent(" ", 8 ); // JSON -> two spaces per indent level, unfold objets up to 8 nesting levels

examples/test/platformio.ini

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,47 @@
11
[platformio]
22
description = YAMLDuino test sketch for platformio
3-
;default_envs = esp32_2_0_5
3+
default_envs = esp32
44
src_dir = src
55

66

77
[env]
88
framework = arduino
99
platform = espressif32
1010
lib_deps =
11-
bblanchon/ArduinoJson
12-
; tobozo/YAMLDuino @ ^1.2
11+
bblanchon/ArduinoJson @ ^7
12+
; tobozo/YAMLDuino @ ^1.5
1313
YAMLDuino
1414
lib_ldf_mode = deep
1515

16-
[env:arduinojson6x]
17-
lib_deps =
18-
bblanchon/ArduinoJson @ ^6
19-
YAMLDuino
20-
21-
[env:arduinojson7x]
22-
lib_deps =
23-
bblanchon/ArduinoJson @ ^7
24-
YAMLDuino
2516

26-
[env:esp32-arduinojson6x]
27-
extends = env:arduinojson6x
28-
board = esp32dev
17+
[env:esp32]
18+
board = esp32dev
19+
; alternate (community maintained) platform/package:
20+
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
21+
; or official (but barely maintained) espressif package
22+
; platform = espressif32
2923

30-
[env:esp32-arduinojson7x]
31-
extends = env:arduinojson7x
32-
board = esp32dev
3324

34-
; or alternate platform/package:
35-
;platform = https://github.com/tasmota/platform-espressif32
36-
;platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32/releases/download/2.0.5/esp32-2.0.5.zip
25+
[env:esp8266]
26+
platform = espressif8266
27+
board = d1_mini_pro
3728

3829

3930
[env:rp2040_pico]
4031
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
41-
platform_packages = framework-arduinopico @ https://github.com/earlephilhower/arduino-pico/releases/download/2.6.1/rp2040-2.6.1.zip
42-
board = generic
32+
board = pico
4333
framework = arduino
44-
board_build.filesystem_size = 0.5m ; adjust if needed
45-
board_upload.maximum_size = 16777216
46-
board_build.arduino.earlephilhower.boot2_source = boot2_w25q080_4_padded_checksum.S
34+
board_build.core = earlephilhower
35+
board_build.filesystem_size = 0.5m
36+
37+
38+
[env:rp2350_pico2]
39+
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
40+
board = rpipico2
41+
board_build.mcu = rp2350-riscv
42+
board_build.core = earlephilhower
43+
board_build.filesystem_size = 0.5m
44+
45+
[env:seeed_wio_terminal]
46+
platform = atmelsam
47+
board = seeed_wio_terminal

0 commit comments

Comments
 (0)