forked from bblanchon/ArduinoJson
Use pgm_read_dword()
instead of pgm_read_float()
(issue #1433)
This commit is contained in:
@ -27,10 +27,6 @@ inline void* pgm_read_ptr(const void* p) {
|
||||
return *reinterpret_cast<void* const*>(convertFlashToPtr(p));
|
||||
}
|
||||
|
||||
inline float pgm_read_float(const void* p) {
|
||||
return *reinterpret_cast<const float*>(convertFlashToPtr(p));
|
||||
}
|
||||
|
||||
#define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, value) \
|
||||
static type const ARDUINOJSON_CONCAT2(name, _progmem)[] = value; \
|
||||
static type const* name = reinterpret_cast<type const*>( \
|
||||
|
@ -50,6 +50,14 @@ TEST_CASE("Flash strings") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("parseNumber()") { // tables are in Flash
|
||||
using ARDUINOJSON_NAMESPACE::parseNumber;
|
||||
|
||||
CHECK(parseNumber<float>("1") == 1.f);
|
||||
CHECK(parseNumber<float>("1.23") == 1.23f);
|
||||
CHECK(parseNumber<float>("-1.23e34") == -1.23e34f);
|
||||
}
|
||||
|
||||
TEST_CASE("strlen_P") {
|
||||
CHECK(strlen_P(PSTR("")) == 0);
|
||||
CHECK(strlen_P(PSTR("a")) == 1);
|
||||
|
Reference in New Issue
Block a user