## Summary The GitHub recent release API returns lots of data, including the full release notes. For 1.2.0, that data is 30,530 bytes. The existing OtaUpdater HTTP handler and single-buffer JSON parsing can't reliably handle that much data in the constrained ESP32 environment. This change does a few things: 1. Adds a very simple lib/JsonParser/StreamingJsonParser.cpp with SAX-style callbacks to read JSON data incrementally. 2. Adds a very simple lib/JsonParser/ReleaseJsonParser.cpp building on StreamingJsonParser, which specifically parses the GitHub release JSON for the release version, URL, and size. 3. Updates OtaUpdater.cpp to use an instance of ReleaseJsonParser to incrementally parse the large response it may receive from GitHub. Building from this commit while overriding my local version to 1.1.9, I was able to run the OTA update process ~5 times in a row successfully. Fixes #1561 (second part, after #1805). --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**YES**_
30 lines
591 B
Bash
Executable File
30 lines
591 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
BUILD_DIR="$ROOT_DIR/build/release_json_parser"
|
|
BINARY="$BUILD_DIR/ReleaseJsonParserTest"
|
|
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
SOURCES=(
|
|
"$ROOT_DIR/test/release_json_parser/ReleaseJsonParserTest.cpp"
|
|
"$ROOT_DIR/lib/JsonParser/ReleaseJsonParser.cpp"
|
|
"$ROOT_DIR/lib/JsonParser/StreamingJsonParser.cpp"
|
|
)
|
|
|
|
CXXFLAGS=(
|
|
-std=c++20
|
|
-O2
|
|
-Wall
|
|
-Wextra
|
|
-pedantic
|
|
-I"$ROOT_DIR"
|
|
-I"$ROOT_DIR/lib"
|
|
-I"$ROOT_DIR/lib/JsonParser"
|
|
)
|
|
|
|
c++ "${CXXFLAGS[@]}" "${SOURCES[@]}" -o "$BINARY"
|
|
|
|
"$BINARY" "$@"
|