Room to optimize code

So, you have a program that works and a program that doesn't work. You want help with the program that doesn't work, so you post the program that does work? Your logic escapes me!

But anyway, you are using 2 devices that both need quite a lot of ram memory, SD card and graphic display.

As others mentioned, something with more ram, and something that runs at 3.3V perhaps, because SD card writers and most oled displays also run at 3.3V I think. I would also go for an oled with SPI interface, they are faster to update than i2c and should be able to share most pins with the SD card. Maybe something based on samd21 chip so that it Arduino zero compatible.