problem in using OLED (SPI interface) and Dallas ds18B20 temperature sensor

i am making a project that requires temperature monitoring through 2 ds18b20 sensors using esp8266 and displaying the average temperature on OLED having a spi interface. the code seems to run fine but after some time it displays random characters on OLED and distorts the display. everything appears fine on the terminal and the code also runs for a few seconds after resetting the board. has anyone gone through a similar issue? or can someone help me identify the fault.

i am using adafruit library

//libraries for oled
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

for OLED and
#include <OneWire.h>
#include <DallasTemperature.h>

these for the temperature sensor ds18b20

I'm quite sure the problem is in your code which you're hiding from us.

I have found that many of the Adafruit libraries cause the ESP32 to generate uController errors. Might be the same for the ESP8266. Are you getting microController errors? You might need to increase your Core Debug Level; if that's a thing for the 8266, it is a thing for the ESP32.

As a note the Adafruit_NeoPixel works really well. Even has code written in C to take advantages of the ESP32 to do background tasks.

You have DS18B20 sensor; so, you have included OneWire.h Library
You have OLED device; so, you have included SPI.h Library.

Why have you included Wire.h Library?

We would like to see your whole codes to be sure that you have correctly broken your float temp into 4-bytes for onward submission to SPI Protocol which handles data one byte at a time.