mirror of https://github.com/arendst/Tasmota.git
Fix invalid JSON
Fix invalid JSON floating point result from nan into null (#4147)
This commit is contained in:
parent
048de4c7fa
commit
51ee22273b
|
@ -1,5 +1,6 @@
|
||||||
/* 6.2.1.19 20181023
|
/* 6.2.1.19 20181023
|
||||||
* Fix header file execution order by renaming user_config.h to my_user_config.h
|
* Fix header file execution order by renaming user_config.h to my_user_config.h
|
||||||
|
* Fix invalid JSON floating point result from nan into null (#4147)
|
||||||
*
|
*
|
||||||
* 6.2.1.18 20181019
|
* 6.2.1.18 20181019
|
||||||
* Add more API callbacks and document API.md
|
* Add more API callbacks and document API.md
|
||||||
|
|
|
@ -196,8 +196,13 @@ int TextToInt(char *str)
|
||||||
|
|
||||||
char* dtostrfd(double number, unsigned char prec, char *s)
|
char* dtostrfd(double number, unsigned char prec, char *s)
|
||||||
{
|
{
|
||||||
|
if (isnan(number)) {
|
||||||
|
strcpy(s, "null");
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
return dtostrf(number, 1, prec, s);
|
return dtostrf(number, 1, prec, s);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char* Unescape(char* buffer, uint16_t* size)
|
char* Unescape(char* buffer, uint16_t* size)
|
||||||
{
|
{
|
||||||
|
@ -630,10 +635,6 @@ boolean GetUsedInModule(byte val, uint8_t *arr)
|
||||||
if (GPIO_I2C_SCL == val) { return true; }
|
if (GPIO_I2C_SCL == val) { return true; }
|
||||||
if (GPIO_I2C_SDA == val) { return true; }
|
if (GPIO_I2C_SDA == val) { return true; }
|
||||||
#endif
|
#endif
|
||||||
#ifndef USE_SR04
|
|
||||||
if (GPIO_SR04_TRIG == val) { return true; }
|
|
||||||
if (GPIO_SR04_ECHO == val) { return true; }
|
|
||||||
#endif
|
|
||||||
#ifndef USE_WS2812
|
#ifndef USE_WS2812
|
||||||
if (GPIO_WS2812 == val) { return true; }
|
if (GPIO_WS2812 == val) { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
@ -706,6 +707,11 @@ boolean GetUsedInModule(byte val, uint8_t *arr)
|
||||||
if (GPIO_HX711_SCK == val) { return true; }
|
if (GPIO_HX711_SCK == val) { return true; }
|
||||||
if (GPIO_HX711_DAT == val) { return true; }
|
if (GPIO_HX711_DAT == val) { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef USE_TX20_WIND_SENSOR
|
||||||
|
if (GPIO_TX20_TXD_BLACK == val) { return true; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if ((val >= GPIO_REL1) && (val < GPIO_REL1 + MAX_RELAYS)) {
|
if ((val >= GPIO_REL1) && (val < GPIO_REL1 + MAX_RELAYS)) {
|
||||||
offset = (GPIO_REL1_INV - GPIO_REL1);
|
offset = (GPIO_REL1_INV - GPIO_REL1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue