mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-22 10:16:30 +00:00
Refactor access TasmotaGlobal.mqtt_data
This commit is contained in:
parent
e5e8ef4736
commit
b112c05d9a
@ -1328,7 +1328,7 @@ void ThermostatDebug(uint8_t ctr_output)
|
||||
#endif // DEBUG_THERMOSTAT
|
||||
|
||||
void ThermostatGetLocalSensor(uint8_t ctr_output) {
|
||||
String buf = TasmotaGlobal.mqtt_data; // copy the string into a new buffer that will be modified
|
||||
String buf = ResponseData(); // copy the string into a new buffer that will be modified
|
||||
JsonParser parser((char*)buf.c_str());
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
if (root) {
|
||||
|
@ -258,7 +258,7 @@ void InfluxDbProcessJson(void) {
|
||||
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("IFX: JSON %s"), ResponseData());
|
||||
|
||||
String jsonStr = TasmotaGlobal.mqtt_data;
|
||||
String jsonStr = ResponseData();
|
||||
JsonParser parser((char *)jsonStr.c_str());
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
if (root) {
|
||||
|
@ -3123,7 +3123,7 @@ static void BLEPostMQTTSeenDevices(int type) {
|
||||
int remains = 0;
|
||||
#ifdef MQTT_DATA_STRING
|
||||
ResponseTime_P(PSTR(""));
|
||||
String response_time = TasmotaGlobal.mqtt_data;
|
||||
String response_time = ResponseData();
|
||||
|
||||
int maxlen = 1024;
|
||||
char dest[maxlen];
|
||||
|
@ -1093,13 +1093,9 @@ bool XdrvRulesProcess(bool teleperiod, const char* event) {
|
||||
}
|
||||
|
||||
bool XdrvRulesProcess(bool teleperiod) {
|
||||
#ifdef MQTT_DATA_STRING
|
||||
bool result = XdrvRulesProcess(teleperiod, TasmotaGlobal.mqtt_data.c_str());
|
||||
ResponseClear();
|
||||
bool result = XdrvRulesProcess(teleperiod, ResponseData());
|
||||
ResponseClear(); // Free heap space
|
||||
return result;
|
||||
#else
|
||||
return XdrvRulesProcess(teleperiod, TasmotaGlobal.mqtt_data);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_DEBUG_DRIVER
|
||||
|
@ -76,7 +76,7 @@ void SevensegLog(void)
|
||||
int16_t valueDecimal = 0;
|
||||
double valueFloat = 0;
|
||||
uint8 fDigits = 0;
|
||||
String jsonStr = TasmotaGlobal.mqtt_data; // Move from stack to heap to fix watchdogs (20180626)
|
||||
String jsonStr = ResponseData(); // Move from stack to heap to fix watchdogs (20180626)
|
||||
JsonParser parser((char*)jsonStr.c_str());
|
||||
JsonParserObject object_root = parser.getRootObject();
|
||||
if (object_root) {
|
||||
|
@ -283,7 +283,7 @@ void HandleMetrics(void) {
|
||||
|
||||
ResponseClear();
|
||||
MqttShowSensor(); //Pull sensor data
|
||||
String jsonStr = TasmotaGlobal.mqtt_data;
|
||||
String jsonStr = ResponseData();
|
||||
JsonParser parser((char *)jsonStr.c_str());
|
||||
JsonParserObject root = parser.getRootObject();
|
||||
if (root) { // did JSON parsing succeed?
|
||||
|
Loading…
x
Reference in New Issue
Block a user