@@ -125,7 +125,7 @@ void MQTTWidget::setup() {
125
125
126
126
// Update method
127
127
void MQTTWidget::update (bool force) {
128
- // Log.traceln("Inside update method - " + String( mqttClient.connected()));
128
+ // Log.traceln("Inside update method - %s " + mqttClient.connected().c_str( ));
129
129
130
130
if (!mqttClient.connected ()) {
131
131
reconnect ();
@@ -205,7 +205,7 @@ void MQTTWidget::callback(char *topic, byte *payload, unsigned int length) {
205
205
if (fieldValue.is <JsonArray>()) {
206
206
fieldValue = fieldValue[index]; // Access the array element by index
207
207
} else {
208
- Log.errorln (" Error: Expected an array for %s" , String ( token) );
208
+ Log.errorln (" Error: Expected an array for %s" , token);
209
209
return ;
210
210
}
211
211
} else {
@@ -235,32 +235,32 @@ void MQTTWidget::callback(char *topic, byte *payload, unsigned int length) {
235
235
236
236
// Update the display only if the value has actually changed
237
237
it->second = extractedValue;
238
- Log.traceln (" Parsed %s : %s" , orb->jsonField , extractedValue);
238
+ Log.traceln (" Parsed %s : %s" , orb->jsonField . c_str () , extractedValue. c_str () );
239
239
240
240
// Redraw the orb with updated data
241
241
drawOrb (orb->orbid );
242
242
} else {
243
- Log.traceln (" No change detected for field: %s" , orb->jsonField );
243
+ Log.traceln (" No change detected for field: %s" , orb->jsonField . c_str () );
244
244
}
245
245
} else {
246
- Log.warningln (" JSON field '%s' not found in payload." , orb->jsonField );
246
+ Log.warningln (" JSON field '%s' not found in payload." , orb->jsonField . c_str () );
247
247
return ;
248
248
}
249
249
} else {
250
250
// The orb does not expect a JSON field; use the entire payload
251
251
if (it->second != message) {
252
252
it->second = message;
253
- Log.traceln (" Updated data for %s : %s" , receivedTopic, message);
253
+ Log.traceln (" Updated data for %s : %s" , receivedTopic. c_str () , message. c_str () );
254
254
drawOrb (orb->orbid );
255
255
} else {
256
- Log.traceln (" No change detected for topic: %s" , receivedTopic);
256
+ Log.traceln (" No change detected for topic: %s" , receivedTopic. c_str () );
257
257
}
258
258
}
259
259
} else {
260
- Log.warningln (" No orb configuration found for topic: %s" , receivedTopic);
260
+ Log.warningln (" No orb configuration found for topic: %s" , receivedTopic. c_str () );
261
261
}
262
262
} else {
263
- Log.traceln (" Received message for unknown topic: %s" , receivedTopic);
263
+ Log.traceln (" Received message for unknown topic: %s" , receivedTopic. c_str () );
264
264
}
265
265
}
266
266
}
@@ -310,7 +310,7 @@ void MQTTWidget::handleSetupMessage(const String &message) {
310
310
config.orbTextColor = getColorFromString (textColorStr);
311
311
312
312
orbConfigs.push_back (config);
313
- Log.infoln (" Configured Orb: %s -> %s" , String ( config.orbid ) , config.orbdesc );
313
+ Log.infoln (" Configured Orb: %d -> %s" , config.orbid , config.orbdesc . c_str () );
314
314
315
315
// Initialize data map with empty strings
316
316
orbDataMap[config.topicSrc ] = " " ;
@@ -382,7 +382,7 @@ void MQTTWidget::reconnect() {
382
382
Log.warningln (" Failed to subscribe to setup topic: %s" , mqttSetupTopic.c_str ());
383
383
}
384
384
} else {
385
- Log.warningln (" failed, rc=%s " , String ( mqttClient.state () ));
385
+ Log.warningln (" failed, rc=%d " , mqttClient.state ());
386
386
Log.warningln (" try again in 5 seconds" );
387
387
}
388
388
}
@@ -405,7 +405,7 @@ void MQTTWidget::drawOrb(int orbid) {
405
405
}
406
406
407
407
if (orb == nullptr ) {
408
- Log.warningln (" Orb not found for orbid: %s " , String ( orbid) );
408
+ Log.warningln (" Orb not found for orbid: %d " , orbid);
409
409
return ;
410
410
}
411
411
0 commit comments