Adding a onewire function kills my mqtt/ethernet connection and I don't know why

People have been so patient with me as I’m learning C on the fly. I’ve made a ton of progress. I know the code below has lots of comments and unnecessary Serial.prints but the one thing people keep saying is that they want to see the entire code.

I’m basically trying to contain two sketches… a pubsub MQTT sketch and a 1-wire temp probe sketch.

My sketch works perfectly until I add the void printTemperature(DeviceAddress deviceAddress)
function in (which is part of the onewire sketch) and then all of a sudden MQTT won’t connect with the message

Attempting MQTT connection…failed, rc=-2 try again in 5 seconds

Here’s my code

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 10
int resolution = 10; //.5 celcius
#define DEVICE "OfficeArduino"
#define DEVICEHELLO "OfficeArduino Connected"
String campus = "campus";
String building = "building";
String room = "office";
String subscription = campus+'/'+building+'/'+room+'/'+'#';
float setpoint = 45.00;
float actual = 44.44;
int state = 0;
int request = 0;

char *cstring;
byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 221);
IPAddress server(192, 168, 0, 222);

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

DeviceAddress office = { 0x28, 0xFF, 0x46, 0x82, 0x58, 0x16, 0x04, 0x9A };




void callback(char* topic, byte* payload, unsigned int length) {
  for (int i=0;i<length;i++) {
    payload[length] = '\0';
    
    cstring = (char *) payload;
  }
  Serial.println(topic);
  Serial.println(cstring);
  setpoint = atof(cstring);
  Serial.println("The setpoint is...");
  
}

EthernetClient ethClient;
PubSubClient client(ethClient);

void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect(DEVICE)) {
      Serial.println("connected");
      // Once connected, publish an announcement...
      client.publish("outTopic",DEVICEHELLO);
      // ... and resubscribe
      client.subscribe(subscription.c_str());
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void setup()
{
  
  // disable SD card if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  Serial.begin(57600);
    sensors.begin();
    sensors.setResolution(office, resolution);
  
  client.setServer(server, 1883);
  client.setCallback(callback);
  
  Ethernet.begin(mac, ip);
  // Allow the hardware to sort itself out
  delay(1500);
  
  Serial.print("The setpoint is ... ");
  Serial.println(setpoint);
  Serial.print("The actual is ... ");
  Serial.println(actual);
  Serial.print("The state is ... ");
  Serial.println(state);
  Serial.print("The requested state is ... ");
  Serial.println(request);
  Serial.print("length...");
  Serial.println(setpoint);
  Serial.println(subscription);
  
}

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  if (tempC == -127.00) {
    Serial.println("error");
  } else {
     //Serial.println(tempC);
    //Serial.print(" F: ");
    Serial.println(DallasTemperature::toFahrenheit(tempC));
  }
}


void loop()
{
  if (!client.connected()) {
    reconnect();
  }
  client.loop();
}

Again, if I pull this section out

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  if (tempC == -127.00) {
    Serial.println("error");
  } else {
     //Serial.println(tempC);
    //Serial.print(" F: ");
    Serial.println(DallasTemperature::toFahrenheit(tempC));
  }
}

I can publish and subscribe to topics at will. With that chunk in there, I can’t connect at all.

(deleted)

THANK YOU! You saved my day. Seriously. Learning C had been giving me so many fits that I didn't even think to look in that direction. Thanks!