Added new ArduinoJson library.

Added new Synth_Dexed library.
dev
Holger Wirtz 2 years ago
parent e64f16de5b
commit 71ee0ecbcc
  1. 7
      third-party/ArduinoJson/CHANGELOG.md
  2. 2
      third-party/ArduinoJson/CMakeLists.txt
  3. 0
      third-party/ArduinoJson/LICENSE.txt
  4. 14
      third-party/ArduinoJson/README.md
  5. 2
      third-party/ArduinoJson/appveyor.yml
  6. 2
      third-party/ArduinoJson/extras/scripts/build-arduino-package.sh
  7. 2
      third-party/ArduinoJson/extras/scripts/publish-particle-library.sh
  8. 3
      third-party/ArduinoJson/extras/scripts/publish.sh
  9. 74
      third-party/ArduinoJson/extras/tests/Cpp11/stl_containers.cpp
  10. 1
      third-party/ArduinoJson/extras/tests/Helpers/Arduino.h
  11. 2
      third-party/ArduinoJson/extras/tests/JsonArray/copyArray.cpp
  12. 4
      third-party/ArduinoJson/extras/tests/JsonDeserializer/object.cpp
  13. 1
      third-party/ArduinoJson/extras/tests/Misc/StringAdapters.cpp
  14. 2
      third-party/ArduinoJson/extras/tests/MixedConfiguration/enable_progmem_1.cpp
  15. 2
      third-party/ArduinoJson/extras/tests/MixedConfiguration/enable_string_deduplication_0.cpp
  16. 2
      third-party/ArduinoJson/extras/tests/MixedConfiguration/enable_string_deduplication_1.cpp
  17. 2
      third-party/ArduinoJson/extras/tests/MixedConfiguration/issue1707.cpp
  18. 265
      third-party/ArduinoJson/extras/tests/catch/catch.hpp
  19. 12
      third-party/ArduinoJson/idf_component.yml
  20. 2
      third-party/ArduinoJson/library.json
  21. 2
      third-party/ArduinoJson/library.properties
  22. 1
      third-party/ArduinoJson/logo.svg
  23. 20
      third-party/ArduinoJson/src/ArduinoJson/Deserialization/DeserializationError.hpp
  24. 35
      third-party/ArduinoJson/src/ArduinoJson/Numbers/FloatTraits.hpp
  25. 31
      third-party/ArduinoJson/src/ArduinoJson/Polyfills/pgmspace_generic.hpp
  26. 30
      third-party/ArduinoJson/src/ArduinoJson/Polyfills/static_array.hpp
  27. 6
      third-party/ArduinoJson/src/ArduinoJson/Variant/VariantRefBase.hpp
  28. 4
      third-party/ArduinoJson/src/ArduinoJson/version.hpp
  29. 37
      third-party/Synth_Dexed/src/dexed.cpp
  30. 12
      third-party/Synth_Dexed/src/dexed.h

@ -1,6 +1,13 @@
ArduinoJson: change log
=======================
v6.20.1 (2023-02-08)
-------
* Remove explicit exclusion of `as<char*>()` and `as<char>()` (issue #1860)
If you try to call them, you'll now get the same error message as any unsupported type.
You could also add a custom converter for `char*` and `char`.
v6.20.0 (2022-12-26)
-------

@ -10,7 +10,7 @@ if(ESP_PLATFORM)
return()
endif()
project(ArduinoJson VERSION 6.20.0)
project(ArduinoJson VERSION 6.20.1)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)

@ -1,17 +1,18 @@
<p align="center">
<a href="https://arduinojson.org/"><img alt="ArduinoJson" src="logo.svg" /></a>
<a href="https://arduinojson.org/"><img alt="ArduinoJson" src="https://arduinojson.org/images/logo.svg" width="200" /></a>
</p>
---
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bblanchon/ArduinoJson/ci.yml?branch=6.x)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bblanchon/ArduinoJson/ci.yml?branch=6.x&logo=github)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x)
[![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
[![Coveralls branch](https://img.shields.io/coveralls/github/bblanchon/ArduinoJson/6.x?logo=coveralls)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x)
[![Arduino Library Manager](https://img.shields.io/static/v1?label=Arduino&message=v6.20.0&logo=arduino&logoColor=white&color=blue)](https://www.ardu-badge.com/ArduinoJson/6.20.0)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/bblanchon/library/ArduinoJson.svg?version=6.20.0)](https://registry.platformio.org/packages/libraries/bblanchon/ArduinoJson?version=6.20.0)
[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github)](https://github.com/bblanchon/ArduinoJson/stargazers)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github)](https://github.com/sponsors/bblanchon)
[![Arduino Library Manager](https://img.shields.io/static/v1?label=Arduino&message=v6.20.1&logo=arduino&logoColor=white&color=blue)](https://www.ardu-badge.com/ArduinoJson/6.20.1)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/bblanchon/library/ArduinoJson.svg?version=6.20.1)](https://registry.platformio.org/packages/libraries/bblanchon/ArduinoJson?version=6.20.1)
[![ESP IDF](https://img.shields.io/static/v1?label=ESP+IDF&message=v6.20.1&logo=cpu&logoColor=white&color=blue)](https://components.espressif.com/components/bblanchon/arduinojson)
[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github&color=orange)](https://github.com/bblanchon/ArduinoJson/stargazers)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github&color=orange)](https://github.com/sponsors/bblanchon)
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
@ -99,7 +100,6 @@ ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).
* Most popular of all Arduino libraries on [GitHub](https://github.com/search?o=desc&q=arduino+library&s=stars&type=Repositories)
* [Used in hundreds of projects](https://www.hackster.io/search?i=projects&q=arduinojson)
* [Responsive support](https://github.com/bblanchon/ArduinoJson/issues?q=is%3Aissue+is%3Aclosed)
* [Discord server](https://discord.gg/DzN6hHHD4h)
## Quickstart

@ -1,4 +1,4 @@
version: 6.20.0.{build}
version: 6.20.1.{build}
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022

@ -18,6 +18,6 @@ rm -f "$OUTPUT"
src \
keywords.txt \
library.properties \
LICENSE.md \
LICENSE.txt \
README.md \
ArduinoJson.h

@ -9,7 +9,7 @@ trap 'rm -rf "$WORK_DIR"' EXIT
cp "$SOURCE_DIR/README.md" "$WORK_DIR/README.md"
cp "$SOURCE_DIR/CHANGELOG.md" "$WORK_DIR/CHANGELOG.md"
cp "$SOURCE_DIR/library.properties" "$WORK_DIR/library.properties"
cp "$SOURCE_DIR/LICENSE.md" "$WORK_DIR/LICENSE.txt"
cp "$SOURCE_DIR/LICENSE.txt" "$WORK_DIR/LICENSE.txt"
cp -r "$SOURCE_DIR/src" "$WORK_DIR/"
cp -r "$SOURCE_DIR/examples" "$WORK_DIR/"

@ -38,6 +38,9 @@ update_version_in_source () {
sed -i~ -bE "s/version: .*$/version: $VERSION.{build}/" appveyor.yml
rm appveyor.yml~
sed -i~ -bE "s/^version: .*$/version: \"$VERSION\"/" idf_component.yml
rm idf_component.yml~
sed -i~ -bE \
-e "s/ARDUINOJSON_VERSION .*$/ARDUINOJSON_VERSION \"$VERSION\"/" \
-e "s/ARDUINOJSON_VERSION_MAJOR .*$/ARDUINOJSON_VERSION_MAJOR $MAJOR/" \

@ -6,6 +6,7 @@
#include <stdint.h>
#include <catch.hpp>
#include <array>
#include <string>
#include <vector>
@ -28,12 +29,38 @@ struct Converter<std::vector<T> > {
static bool checkJson(JsonVariantConst src) {
JsonArrayConst array = src;
bool result = array;
for (JsonVariantConst item : array)
result &= item.is<T>();
return result;
}
};
template <typename T, size_t N>
struct Converter<std::array<T, N> > {
static void toJson(const std::array<T, N>& src, JsonVariant dst) {
JsonArray array = dst.to<JsonArray>();
for (T item : src)
array.add(item);
}
static std::array<T, N> fromJson(JsonVariantConst src) {
std::array<T, N> dst;
dst.fill(0);
size_t idx = 0;
for (T item : src.as<JsonArrayConst>())
dst[idx++] = item;
return dst;
}
static bool checkJson(JsonVariantConst src) {
JsonArrayConst array = src;
bool result = array;
size_t size = 0;
for (JsonVariantConst item : array) {
if (!result)
break;
result = item.is<T>();
result &= item.is<T>();
size++;
}
return result;
return result && size == N;
}
};
} // namespace ARDUINOJSON_NAMESPACE
@ -70,3 +97,42 @@ TEST_CASE("vector<int>") {
CHECK(doc.is<std::vector<int> >() == false);
}
}
TEST_CASE("array<int, 2>") {
typedef std::array<int, 2> array_type;
SECTION("toJson") {
array_type v;
v[0] = 1;
v[1] = 2;
StaticJsonDocument<128> doc;
doc.set(v);
REQUIRE(doc.as<std::string>() == "[1,2]");
}
SECTION("fromJson") {
StaticJsonDocument<128> doc;
doc.add(1);
doc.add(2);
auto v = doc.as<array_type>();
REQUIRE(v.size() == 2);
CHECK(v[0] == 1);
CHECK(v[1] == 2);
}
SECTION("checkJson") {
StaticJsonDocument<128> doc;
CHECK(doc.is<array_type>() == false);
doc.add(1);
CHECK(doc.is<array_type>() == false);
doc.add(2);
CHECK(doc.is<array_type>() == true);
doc[0] = "foo";
CHECK(doc.is<array_type>() == false);
}
}

@ -7,6 +7,5 @@
#include "api/Print.h"
#include "api/Stream.h"
#include "api/String.h"
#include "progmem_emulation.hpp"
#define ARDUINO_H_INCLUDED 1

@ -165,7 +165,7 @@ TEST_CASE("copyArray()") {
char json[32] = "";
int source[][3] = {{1, 2, 3}, {4, 5, 6}};
CAPTURE(SIZE)
CAPTURE(SIZE);
bool ok = copyArray(source, array);
CAPTURE(doc.memoryUsage());

@ -100,7 +100,7 @@ TEST_CASE("deserialize JSON object") {
REQUIRE(obj["key"] == "value");
}
SECTION("Before the colon") {
SECTION("Before the comma") {
DeserializationError err =
deserializeJson(doc, "{\"key1\":\"value1\" ,\"key2\":\"value2\"}");
JsonObject obj = doc.as<JsonObject>();
@ -112,7 +112,7 @@ TEST_CASE("deserialize JSON object") {
REQUIRE(obj["key2"] == "value2");
}
SECTION("After the colon") {
SECTION("After the comma") {
DeserializationError err =
deserializeJson(doc, "{\"key1\":\"value1\", \"key2\":\"value2\"}");
JsonObject obj = doc.as<JsonObject>();

@ -6,6 +6,7 @@
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
#include "custom_string.hpp"
#include "progmem_emulation.hpp"
#include "weird_strcmp.hpp"
#include <ArduinoJson/Strings/IsString.hpp>

@ -2,6 +2,8 @@
// Copyright © 2014-2022, Benoit BLANCHON
// MIT License
#include "progmem_emulation.hpp"
#define ARDUINOJSON_ENABLE_PROGMEM 1
#include <ArduinoJson.h>

@ -2,6 +2,8 @@
// Copyright © 2014-2022, Benoit BLANCHON
// MIT License
#include "progmem_emulation.hpp"
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
#define ARDUINOJSON_ENABLE_PROGMEM 1
#define ARDUINOJSON_ENABLE_STRING_DEDUPLICATION 0

@ -2,6 +2,8 @@
// Copyright © 2014-2022, Benoit BLANCHON
// MIT License
#include "progmem_emulation.hpp"
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
#define ARDUINOJSON_ENABLE_PROGMEM 1
#define ARDUINOJSON_ENABLE_STRING_DEDUPLICATION 1

@ -5,6 +5,8 @@
#define ARDUINO
#define memcpy_P(dest, src, n) memcpy((dest), (src), (n))
#include "progmem_emulation.hpp"
#include <ArduinoJson.h>
#include <catch.hpp>

@ -1,6 +1,6 @@
/*
* Catch v1.12.2
* Generated: 2018-05-14 15:10:01.112442
* Generated: 2023-01-17 08:45:40.979381
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -214,7 +214,7 @@
////////////////////////////////////////////////////////////////////////////////
// Use variadic macros if the compiler supports them
#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
#if ( defined _MSC_VER && _MSC_VER >= 1400 && !defined __EDGE__) || \
( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
( defined __GNUC__ && __GNUC__ >= 3 ) || \
( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
@ -2129,6 +2129,9 @@ namespace Catch{
#define CATCH_TRAP() \
__asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \
: : : "memory","r0","r3","r4" ) /* NOLINT */
#elif defined(__aarch64__)
// Backport of https://github.com/catchorg/Catch2/commit/a25c1a24af8bffd35727a888a307ff0280cf9387
#define CATCH_TRAP() __asm__(".inst 0xd4200000")
#else
#define CATCH_TRAP() __asm__("int $3\n" : : /* NOLINT */ )
#endif
@ -6392,9 +6395,12 @@ CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
// #included from: catch_fatal_condition.hpp
#define TWOBLUECUBES_CATCH_FATAL_CONDITION_H_INCLUDED
#include <cassert>
#include <stdexcept>
namespace Catch {
// Report the error condition
//! Signals fatal error message to the run context
inline void reportFatal(std::string const &message) {
IContext &context = Catch::getCurrentContext();
IResultCapture *resultCapture = context.getResultCapture();
@ -6432,16 +6438,43 @@ namespace Catch {
#if !defined(CATCH_CONFIG_WINDOWS_SEH)
namespace Catch {
struct FatalConditionHandler {
void reset() {}
};
class FatalConditionHandler {
bool m_started;
// Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume
// engage-disengage 1:1 pairing.
void engage_platform() {}
void disengage_platform() {}
public:
// Should also have platform-specific implementations as needed
FatalConditionHandler() : m_started(false) {}
~FatalConditionHandler() {}
void engage() {
assert(!m_started && "Handler cannot be installed twice.");
m_started = true;
engage_platform();
}
void disengage() {
assert(m_started &&
"Handler cannot be uninstalled without being installed first");
m_started = false;
disengage_platform();
}
};
} // namespace Catch
#else // CATCH_CONFIG_WINDOWS_SEH is defined
namespace Catch {
struct SignalDefs { DWORD id; const char* name; };
struct SignalDefs {
DWORD id;
const char *name;
};
extern SignalDefs signalDefs[];
// There is no 1-1 mapping between signals and windows exceptions.
// Windows can easily distinguish between SO and SigSegV,
@ -6453,9 +6486,8 @@ namespace Catch {
{EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error"},
};
struct FatalConditionHandler {
static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
static LONG CALLBACK
handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
reportFatal(signalDefs[i].name);
@ -6466,40 +6498,63 @@ namespace Catch {
return EXCEPTION_CONTINUE_SEARCH;
}
FatalConditionHandler() {
isSet = true;
// 32k seems enough for Catch to handle stack overflow,
// but the value was found experimentally, so there is no strong guarantee
guaranteeSize = 32 * 1024;
exceptionHandlerHandle = CATCH_NULL;
// Since we do not support multiple instantiations, we put these
// into global variables and rely on cleaning them up in outlined
// constructors/destructors
static PVOID exceptionHandlerHandle = CATCH_NULL;
class FatalConditionHandler {
bool m_started;
// Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume
// engage-disengage 1:1 pairing.
void engage_platform() {
// Register as first handler in current chain
exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);
// Pass in guarantee size to be filled
SetThreadStackGuarantee(&guaranteeSize);
exceptionHandlerHandle =
AddVectoredExceptionHandler(1, handleVectoredException);
if (!exceptionHandlerHandle) {
throw std::runtime_error("Could not register vectored exception handler");
}
}
static void reset() {
if (isSet) {
// Unregister handler and restore the old guarantee
RemoveVectoredExceptionHandler(exceptionHandlerHandle);
SetThreadStackGuarantee(&guaranteeSize);
void disengage_platform() {
if (!RemoveVectoredExceptionHandler(exceptionHandlerHandle)) {
throw std::runtime_error(
"Could not unregister vectored exception handler");
}
exceptionHandlerHandle = CATCH_NULL;
isSet = false;
}
public:
FatalConditionHandler() : m_started(false) {
ULONG guaranteeSize = static_cast<ULONG>(32 * 1024);
if (!SetThreadStackGuarantee(&guaranteeSize)) {
// We do not want to fully error out, because needing
// the stack reserve should be rare enough anyway.
Catch::cerr() << "Failed to reserve piece of stack."
<< " Stack overflows will not be reported successfully.";
}
}
~FatalConditionHandler() {
reset();
// We do not attempt to unset the stack guarantee, because
// Windows does not support lowering the stack size guarantee.
~FatalConditionHandler() {}
void engage() {
assert(!m_started && "Handler cannot be installed twice.");
m_started = true;
engage_platform();
}
private:
static bool isSet;
static ULONG guaranteeSize;
static PVOID exceptionHandlerHandle;
};
bool FatalConditionHandler::isSet = false;
ULONG FatalConditionHandler::guaranteeSize = 0;
PVOID FatalConditionHandler::exceptionHandlerHandle = CATCH_NULL;
void disengage() {
assert(m_started &&
"Handler cannot be uninstalled without being installed first");
m_started = false;
disengage_platform();
}
};
} // namespace Catch
@ -6510,11 +6565,35 @@ namespace Catch {
#if !defined(CATCH_CONFIG_POSIX_SIGNALS)
namespace Catch {
struct FatalConditionHandler {
void reset() {}
};
class FatalConditionHandler {
bool m_started;
// Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume
// engage-disengage 1:1 pairing.
void engage_platform() {}
void disengage_platform() {}
public:
// Should also have platform-specific implementations as needed
FatalConditionHandler() : m_started(false) {}
~FatalConditionHandler() {}
void engage() {
assert(!m_started && "Handler cannot be installed twice.");
m_started = true;
engage_platform();
}
void disengage() {
assert(m_started &&
"Handler cannot be uninstalled without being installed first");
m_started = false;
disengage_platform();
}
};
} // namespace Catch
#else // CATCH_CONFIG_POSIX_SIGNALS is defined
#include <signal.h>
@ -6532,18 +6611,35 @@ namespace Catch {
{SIGFPE, "SIGFPE - Floating point error signal"},
{SIGSEGV, "SIGSEGV - Segmentation violation signal"},
{SIGTERM, "SIGTERM - Termination request signal"},
{ SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
};
{SIGABRT, "SIGABRT - Abort (abnormal termination) signal"}};
struct FatalConditionHandler {
// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
// which is zero initialization, but not explicit. We want to avoid
// that.
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
static bool isSet;
static struct sigaction oldSigActions [sizeof(signalDefs)/sizeof(SignalDefs)];
static char *altStackMem = CATCH_NULL;
static std::size_t altStackSize = 0;
static stack_t oldSigStack;
static char altStackMem[SIGSTKSZ];
static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)];
static void restorePreviousSignalHandlers() {
// We set signal handlers back to the previous ones. Hopefully
// nobody overwrote them in the meantime, and doesn't expect
// their signal handlers to live past ours given that they
// installed them after ours..
for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
sigaction(signalDefs[i].id, &oldSigActions[i], CATCH_NULL);
}
// Return the old stack
sigaltstack(&oldSigStack, CATCH_NULL);
}
static void handleSignal(int sig) {
std::string name = "<unknown signal>";
char const *name = "<unknown signal>";
for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
SignalDefs &def = signalDefs[i];
if (sig == def.id) {
@ -6551,13 +6647,22 @@ namespace Catch {
break;
}
}
reset();
// We need to restore previous signal handlers and let them do
// their thing, so that the users can have the debugger break
// when a signal is raised, and so on.
restorePreviousSignalHandlers();
reportFatal(name);
raise(sig);
}
FatalConditionHandler() {
isSet = true;
class FatalConditionHandler {
bool m_started;
// Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume
// engage-disengage 1:1 pairing.
void engage_platform() {
stack_t sigStack;
sigStack.ss_sp = altStackMem;
sigStack.ss_size = SIGSTKSZ;
@ -6572,26 +6677,42 @@ namespace Catch {
}
}
~FatalConditionHandler() {
reset();
void disengage_platform() { restorePreviousSignalHandlers(); }
public:
FatalConditionHandler() : m_started(false) {
assert(!altStackMem &&
"Cannot initialize POSIX signal handler when one already exists");
if (altStackSize == 0) {
altStackSize = SIGSTKSZ;
}
static void reset() {
if( isSet ) {
// Set signals back to previous values -- hopefully nobody overwrote them in the meantime
for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {
sigaction(signalDefs[i].id, &oldSigActions[i], CATCH_NULL);
altStackMem = new char[altStackSize]();
}
// Return the old stack
sigaltstack(&oldSigStack, CATCH_NULL);
isSet = false;
~FatalConditionHandler() {
delete[] altStackMem;
// We signal that another instance can be constructed by zeroing
// out the pointer.
altStackMem = CATCH_NULL;
}
void engage() {
assert(!m_started && "Handler cannot be installed twice.");
m_started = true;
engage_platform();
}
void disengage() {
assert(m_started &&
"Handler cannot be uninstalled without being installed first");
m_started = false;
disengage_platform();
}
};
bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};
stack_t FatalConditionHandler::oldSigStack = {};
char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} // namespace Catch
@ -6599,6 +6720,22 @@ namespace Catch {
#endif // not Windows
namespace Catch {
//! Simple RAII guard for (dis)engaging the FatalConditionHandler
class FatalConditionHandlerGuard {
FatalConditionHandler *m_handler;
public:
FatalConditionHandlerGuard(FatalConditionHandler *handler)
: m_handler(handler) {
m_handler->engage();
}
~FatalConditionHandlerGuard() { m_handler->disengage(); }
};
} // end namespace Catch
#include <cassert>
#include <set>
#include <string>
@ -6938,9 +7075,8 @@ namespace Catch {
}
void invokeActiveTestCase() {
FatalConditionHandler fatalConditionHandler; // Handle signals
FatalConditionHandlerGuard _(&m_fatalConditionhandler);
m_activeTestCase->invoke();
fatalConditionHandler.reset();
}
private:
@ -6978,6 +7114,7 @@ namespace Catch {
std::vector<SectionEndInfo> m_unfinishedSections;
std::vector<ITracker*> m_activeSections;
TrackerContext m_trackerContext;
FatalConditionHandler m_fatalConditionhandler;
size_t m_prevPassed;
bool m_shouldReportUnexpected;
};

@ -0,0 +1,12 @@
version: "6.20.0"
description: >-
A simple and efficient JSON library for embedded C++.
ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ MessagePack, ✔ fixed allocation, ✔ zero-copy, ✔ streams, ✔ filtering, and more.
It is the most popular Arduino library on GitHub ❤❤❤❤❤.
Check out arduinojson.org for a comprehensive documentation.
url: https://arduinojson.org/
files:
exclude:
- "**/.vs/**/*"
- "examples/**/*"
- "extras/**/*"

@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/bblanchon/ArduinoJson.git"
},
"version": "6.20.0",
"version": "6.20.1",
"authors": {
"name": "Benoit Blanchon",
"url": "https://blog.benoitblanchon.fr"

@ -1,5 +1,5 @@
name=ArduinoJson
version=6.20.0
version=6.20.1
author=Benoit Blanchon <blog.benoitblanchon.fr>
maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
sentence=A simple and efficient JSON library for embedded C++.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 17 KiB

@ -6,8 +6,8 @@
#include <ArduinoJson/Misc/SafeBoolIdiom.hpp>
#include <ArduinoJson/Namespace.hpp>
#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
#include <ArduinoJson/Polyfills/preprocessor.hpp>
#include <ArduinoJson/Polyfills/static_array.hpp>
#if ARDUINOJSON_ENABLE_STD_STREAM
# include <ostream>
@ -74,16 +74,16 @@ class DeserializationError : public SafeBoolIdom<DeserializationError> {
#if ARDUINOJSON_ENABLE_PROGMEM
const __FlashStringHelper* f_str() const {
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s0, "Ok");
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s1, "EmptyInput");
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s2, "IncompleteInput");
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s3, "InvalidInput");
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s4, "NoMemory");
ARDUINOJSON_DEFINE_STATIC_ARRAY(char, s5, "TooDeep");
ARDUINOJSON_DEFINE_STATIC_ARRAY(
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s0, "Ok");
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s1, "EmptyInput");
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s2, "IncompleteInput");
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s3, "InvalidInput");
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s4, "NoMemory");
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s5, "TooDeep");
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(
const char*, messages, ARDUINOJSON_EXPAND6({s0, s1, s2, s3, s4, s5}));
return ARDUINOJSON_READ_STATIC_ARRAY(const __FlashStringHelper*, messages,
_code);
return reinterpret_cast<const __FlashStringHelper*>(
pgm_read(messages + _code));
}
#endif

@ -10,8 +10,8 @@
#include <ArduinoJson/Configuration.hpp>
#include <ArduinoJson/Polyfills/alias_cast.hpp>
#include <ArduinoJson/Polyfills/math.hpp>
#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
#include <ArduinoJson/Polyfills/preprocessor.hpp>
#include <ArduinoJson/Polyfills/static_array.hpp>
#include <ArduinoJson/Polyfills/type_traits.hpp>
namespace ARDUINOJSON_NAMESPACE {
@ -49,7 +49,7 @@ struct FloatTraits<T, 8 /*64bits*/> {
}
static T positiveBinaryPowerOfTen(int index) {
ARDUINOJSON_DEFINE_STATIC_ARRAY( //
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
uint32_t, factors,
ARDUINOJSON_EXPAND18({
0x40240000, 0x00000000, // 1e1
@ -62,13 +62,12 @@ struct FloatTraits<T, 8 /*64bits*/> {
0x5A827748, 0xF9301D32, // 1e128
0x75154FDD, 0x7F73BF3C // 1e256
}));
return forge(
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index),
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index + 1));
return forge(pgm_read(factors + 2 * index),
pgm_read(factors + 2 * index + 1));
}
static T negativeBinaryPowerOfTen(int index) {
ARDUINOJSON_DEFINE_STATIC_ARRAY( //
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
uint32_t, factors,
ARDUINOJSON_EXPAND18({
0x3FB99999, 0x9999999A, // 1e-1
@ -81,13 +80,12 @@ struct FloatTraits<T, 8 /*64bits*/> {
0x255BBA08, 0xCF8C979D, // 1e-128
0x0AC80628, 0x64AC6F43 // 1e-256
}));
return forge(
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index),
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index + 1));
return forge(pgm_read(factors + 2 * index),
pgm_read(factors + 2 * index + 1));
}
static T negativeBinaryPowerOfTenPlusOne(int index) {
ARDUINOJSON_DEFINE_STATIC_ARRAY( //
ARDUINOJSON_DEFINE_PROGMEM_ARRAY( //
uint32_t, factors,
ARDUINOJSON_EXPAND18({
0x3FF00000, 0x00000000, // 1e0
@ -100,9 +98,8 @@ struct FloatTraits<T, 8 /*64bits*/> {
0x25915445, 0x81B7DEC2, // 1e-127
0x0AFE07B2, 0x7DD78B14 // 1e-255
}));
return forge(
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index),
ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, 2 * index + 1));
return forge(pgm_read(factors + 2 * index),
pgm_read(factors + 2 * index + 1));
}
static T nan() {
@ -175,7 +172,7 @@ struct FloatTraits<T, 4 /*32bits*/> {
}
static T positiveBinaryPowerOfTen(int index) {
ARDUINOJSON_DEFINE_STATIC_ARRAY(uint32_t, factors,
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
ARDUINOJSON_EXPAND6({
0x41200000, // 1e1f
0x42c80000, // 1e2f
@ -184,11 +181,11 @@ struct FloatTraits<T, 4 /*32bits*/> {
0x5a0e1bca, // 1e16f
0x749dc5ae // 1e32f
}));
return forge(ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, index));
return forge(pgm_read(factors + index));
}
static T negativeBinaryPowerOfTen(int index) {
ARDUINOJSON_DEFINE_STATIC_ARRAY(uint32_t, factors,
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
ARDUINOJSON_EXPAND6({
0x3dcccccd, // 1e-1f
0x3c23d70a, // 1e-2f
@ -197,11 +194,11 @@ struct FloatTraits<T, 4 /*32bits*/> {
0x24e69595, // 1e-16f
0x0a4fb11f // 1e-32f
}));
return forge(ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, index));
return forge(pgm_read(factors + index));
}
static T negativeBinaryPowerOfTenPlusOne(int index) {
ARDUINOJSON_DEFINE_STATIC_ARRAY(uint32_t, factors,
ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,
ARDUINOJSON_EXPAND6({
0x3f800000, // 1e0f
0x3dcccccd, // 1e-1f
@ -210,7 +207,7 @@ struct FloatTraits<T, 4 /*32bits*/> {
0x26901d7d, // 1e-15f
0x0c01ceb3 // 1e-31f
}));
return forge(ARDUINOJSON_READ_STATIC_ARRAY(uint32_t, factors, index));
return forge(pgm_read(factors + index));
}
static T forge(uint32_t bits) {

@ -5,20 +5,41 @@
#pragma once
#include <ArduinoJson/Namespace.hpp>
#if ARDUINOJSON_ENABLE_PROGMEM
# include <ArduinoJson/Polyfills/pgmspace.hpp>
# include <ArduinoJson/Polyfills/type_traits.hpp>
#endif
namespace ARDUINOJSON_NAMESPACE {
#if ARDUINOJSON_ENABLE_PROGMEM
# ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY
# define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
static type const name[] PROGMEM = value;
# endif
template <typename T>
typename enable_if<is_pointer<T>::value, T>::type pgm_read(const void* p) {
return reinterpret_cast<T>(pgm_read_ptr(p));
inline const T* pgm_read(const T* const* p) {
return reinterpret_cast<const T*>(pgm_read_ptr(p));
}
template <typename T>
typename enable_if<is_same<T, uint32_t>::value, T>::type pgm_read(
const void* p) {
inline uint32_t pgm_read(const uint32_t* p) {
return pgm_read_dword(p);
}
#else
# ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY
# define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
static type const name[] = value;
# endif
template <typename T>
inline T pgm_read(const T* p) {
return *p;
}
#endif
} // namespace ARDUINOJSON_NAMESPACE

@ -1,30 +0,0 @@
// ArduinoJson - https://arduinojson.org
// Copyright © 2014-2022, Benoit BLANCHON
// MIT License
#pragma once
#include <ArduinoJson/Configuration.hpp>
#if ARDUINOJSON_ENABLE_PROGMEM
# include <ArduinoJson/Polyfills/pgmspace_generic.hpp>
# ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY
# define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
static type const name[] PROGMEM = value;
# endif
# define ARDUINOJSON_DEFINE_STATIC_ARRAY ARDUINOJSON_DEFINE_PROGMEM_ARRAY
# define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) \
pgm_read<type>(name + index)
#else // i.e. ARDUINOJSON_ENABLE_PROGMEM == 0
# define ARDUINOJSON_DEFINE_STATIC_ARRAY(type, name, value) \
static type const name[] = value;
# define ARDUINOJSON_READ_STATIC_ARRAY(type, name, index) name[index]
#endif

@ -46,10 +46,8 @@ class VariantRefBase : public VariantTag {
// Casts the value to the specified type.
// https://arduinojson.org/v6/api/jsonvariant/as/
template <typename T>
FORCE_INLINE typename enable_if<!is_same<T, char*>::value &&
!is_same<T, char>::value &&
!ConverterNeedsWriteableRef<T>::value,
T>::type
FORCE_INLINE
typename enable_if<!ConverterNeedsWriteableRef<T>::value, T>::type
as() const {
return Converter<T>::fromJson(getVariantConst());
}

@ -4,7 +4,7 @@
#pragma once
#define ARDUINOJSON_VERSION "6.20.0"
#define ARDUINOJSON_VERSION "6.20.1"
#define ARDUINOJSON_VERSION_MAJOR 6
#define ARDUINOJSON_VERSION_MINOR 20
#define ARDUINOJSON_VERSION_REVISION 0
#define ARDUINOJSON_VERSION_REVISION 1

@ -74,6 +74,8 @@ Dexed::Dexed(uint8_t maxnotes, int rate)
xrun = 0;
render_time_max = 0;
setVelocityScale(MIDI_VELOCITY_SCALING_OFF);
#ifndef TEENSYDUINO
compressor = new Compressor(samplerate);
#endif
@ -210,6 +212,8 @@ void Dexed::keydown(int16_t pitch, uint8_t velo) {
return;
}
velo=uint8_t((float(velo)/127.0)*velocity_diff+0.5)+velocity_offset;
pitch += data[144] - TRANSPOSE_FIX;
int previousKeyDown = lastKeyDown;
@ -1665,6 +1669,39 @@ void Dexed::getName(char* buffer)
buffer[10] = '\0';
}
void Dexed::setVelocityScale(uint8_t offset, uint8_t max)
{
velocity_offset = offset & 0x7f;
velocity_max = max & 0x7f;
velocity_diff = velocity_max - velocity_offset;
}
void Dexed::getVelocityScale(uint8_t* offset, uint8_t* max)
{
*offset = velocity_offset;
*max = velocity_max;
}
void Dexed::setVelocityScale(uint8_t setup = MIDI_VELOCITY_SCALING_OFF)
{
switch(setup)
{
case MIDI_VELOCITY_SCALING_DX7:
velocity_offset=16;
velocity_max=109;
break;
case MIDI_VELOCITY_SCALING_DX7II:
velocity_offset=6;
velocity_max=119;
break;
default: // default setup
velocity_offset=0;
velocity_max=127;
break;
}
setVelocityScale(velocity_offset, velocity_max);
}
#ifndef TEENSYDUINO
void Dexed::setCompressor(bool enable_compressor)
{

@ -175,6 +175,9 @@ class Dexed
uint16_t getRenderTimeMax(void);
void resetRenderTimeMax(void);
void ControllersRefresh(void);
void setVelocityScale(uint8_t offset, uint8_t max);
void getVelocityScale(uint8_t* offset, uint8_t* max);
void setVelocityScale(uint8_t setup);
#ifndef TEENSYDUINO
void setCompressor(bool comp);
bool getCompressor(void);
@ -354,9 +357,18 @@ class Dexed
void getSamples(int16_t* buffer, uint16_t n_samples);
void compress(float32_t* wav_in, float32_t* wav_out, uint16_t n, float32_t threshold, float32_t slope, uint16_t sr, float32_t tla, float32_t twnd, float32_t tatt, float32_t trel);
bool use_compressor;
uint8_t velocity_offset;
uint8_t velocity_max;
float velocity_diff;
#ifndef TEENSYDUINO
Compressor* compressor;
#endif
enum {
MIDI_VELOCITY_SCALING_OFF,
MIDI_VELOCITY_SCALING_DX7,
MIDI_VELOCITY_SCALING_DX7II
};
};
#endif

Loading…
Cancel
Save