i have to programs running on two esp32 microcontrollers. I am sending with the first code data to the second esp32 that runs the second code. The dataBuffer on the second code seems to be empty, what can cause the empty value?
ESP32 1 code 1: 
#include <Wire.h>
#include <esp_now.h>
#include <WiFi.h>
#include <esp_wifi.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define BUFFER_SIZE 1024

#define I2C_DEV_ADDR 0x3C
#define CHANNEL 1


uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0;  // Current size of data received

//uint8_t dataArray[MAX_POSSIBLE_DATA_SIZE];
//uint8_t currentDataSize = 0;  // Current size of data received

esp_now_peer_info_t slave;
bool isSlavePaired = false;  // Track if slave is currently paired

void onReceive(int len) {
  currentDataSize = len;
  for (int i = 0; i < len; i++) {
    addToBuffer(Wire.read());
  }
  sendData();/*
    for (int i = 0; i < BUFFER_SIZE; i++) {
    Serial.print(dataBuffer[i], HEX);
    Serial.print(" ");
    if ((i + 1) % 16 == 0) {  // Print 16 values per line
      Serial.println();
    }
  }*/
}

void addToBuffer(uint8_t data) {
  bufferHead = (bufferHead + 1) % BUFFER_SIZE;  // Wrap around if buffer is full
  dataBuffer[bufferHead] = data;
  if (bufferHead == bufferTail) {
    bufferTail = (bufferTail + 1) % BUFFER_SIZE;  // Remove oldest data when buffer is full
  }
}


void sendData() {
  const uint8_t* peer_addr = slave.peer_addr;
  esp_err_t result = esp_now_send(peer_addr, dataBuffer + bufferTail, currentDataSize);

  if (result == ESP_OK) {
    Serial.println("Success");
  } else {
    Serial.println("Send Error");
  }
    Serial.print("Data send:");
  Serial.println();
  for (int i = 0; i < BUFFER_SIZE; i++) {
    Serial.print(dataBuffer[i], HEX);
    Serial.print(" ");
    if ((i + 1) % 16 == 0) {  // Print 16 values per line
      Serial.println();
    }
  }
}

void InitESPNow() {
    WiFi.disconnect();

    for(int retries = 0; retries < 3; retries++) {
        if (esp_now_init() == ESP_OK) {
            Serial.println("ESPNow Init Success");
            break;
        }
        else {
            if(retries == 2) {
                Serial.println("ESPNow Init Failed 3 times, restarting...");
                delay(1000);
                ESP.restart();
            }
            delay(500);
        }
    }
}

bool manageSlave() {
    if (slave.channel == CHANNEL) {
        bool exists = esp_now_is_peer_exist(slave.peer_addr);
        if (exists) {
            Serial.println("Already Paired");
            return true;
        } else {
            esp_err_t addStatus = esp_now_add_peer(&slave);
            if (addStatus == ESP_OK) {
                Serial.println("Pair success");
                return true;
            } else {
                Serial.println("Pairing Error");
            }
        }
    } else {
        Serial.println("No Slave found to process");
    }
    return false;
}

void OnDataSent(const uint8_t* mac_addr, esp_now_send_status_t status) {
  char macStr[18];
  snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
    mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
  Serial.print("Last Packet Sent to: ");
  Serial.println(macStr);
  Serial.print("Last Packet Send Status: ");
  Serial.println(status == ESP_NOW_SEND_SUCCESS ? "Delivery Success" : "Delivery Fail");
}

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);

  Wire.onReceive(onReceive);
  Wire.begin((uint8_t)I2C_DEV_ADDR);

  WiFi.mode(WIFI_STA);
  esp_wifi_set_channel(CHANNEL, WIFI_SECOND_CHAN_NONE);

  Serial.println("Klipper I2c SDD1306 Screen data sender");
  Serial.print("STA MAC: ");
  Serial.println(WiFi.macAddress());
  Serial.print("STA CHANNEL ");
  Serial.println(WiFi.channel());

    InitESPNow();
    esp_now_register_send_cb(OnDataSent);
}

void ScanForSlave() {
    int16_t scanResults = WiFi.scanNetworks();
    memset(&slave, 0, sizeof(slave));
    
    if (scanResults == 0) {
        Serial.println("No WiFi devices in AP Mode found");
    } else {
        for (int i = 0; i < scanResults; ++i) {
            String SSID = WiFi.SSID(i);
            String BSSIDstr = WiFi.BSSIDstr(i);
            
            if (SSID.indexOf("Slave") == 0) {
                int mac[6];
                if (6 == sscanf(BSSIDstr.c_str(), "%x:%x:%x:%x:%x:%x", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5])) {
                    for (int ii = 0; ii < 6; ++ii) {
                        slave.peer_addr[ii] = (uint8_t)mac[ii];
                    }
                }
                
                slave.channel = CHANNEL;
                slave.encrypt = 0;
                
                break;
            }
        }
    }
    
    WiFi.scanDelete();
}

void loop() {
    if(!isSlavePaired) {
        ScanForSlave();
        isSlavePaired = manageSlave();
        if (!isSlavePaired) {
            Serial.println("Slave pair failed!");
            delay(5000);  // Wait for 5 seconds before trying again
        }
    }

}
ESP32 2 code 2:  
#include <esp_now.h>
#include <WiFi.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
#define CHANNEL 1
#define BUFFER_SIZE 1024
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len);

uint8_t dataBuffer[BUFFER_SIZE];
unsigned int bufferHead = 0;
unsigned int bufferTail = 0;
unsigned int currentDataSize = 0;

void InitESPNow() {
  WiFi.disconnect();
  if (esp_now_init() == ESP_OK) {
    Serial.println("ESPNow Init Success");
  } else {
    Serial.println("ESPNow Init Failed");
    ESP.restart();
  }
}

void configDeviceAP() {
  const char SSID[] = "Slave_1";
  if (!WiFi.softAP(SSID, "Slave_1_Password", CHANNEL, 0)) {
    Serial.println("AP Config failed.");
    ESP.restart();
  } else {
    Serial.print("AP Config Success. Broadcasting with AP: ");
    Serial.println(SSID);
    Serial.print("AP CHANNEL ");
    Serial.println(WiFi.channel());
  }
}

void setup() {
  Serial.begin(115200);
  WiFi.mode(WIFI_AP);
  configDeviceAP();
  InitESPNow();
  esp_now_register_recv_cb(OnDataRecv);
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    while (true); // Infinite loop
  }
  display.clearDisplay();
}

void OnDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
    char macStr[18];
    snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x",
             mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
    Serial.print("Data Received from :");
    Serial.println(macStr);
    Serial.println();
    bufferHead = (bufferHead + 1) % BUFFER_SIZE;
    dataBuffer[bufferHead] = *data;
    if (bufferHead == bufferTail) {
      bufferTail = (bufferTail + 1) % BUFFER_SIZE;  
    }

    Serial.print("Databuffer on data receive.");
    Serial.println();
     for (int i = 0; i < BUFFER_SIZE; i++) {
       Serial.print(dataBuffer[i], HEX);
       Serial.print(" ");
     if ((i + 1) % 16 == 0) {  // Print 16 values per line
      Serial.println();
      }
    }
    Wire.beginTransmission(SCREEN_ADDRESS);
    for (int i = 0; i < data_len; i++) {
        Wire.write(dataBuffer[i]);
    }
    Wire.endTransmission();
}

void loop() {

}