Slow I2C

Hello, I use NRF24L01 to remotely control FM radio TEA5767 (uses I2C) and I implemented a feature that lets me know if sent data was successfully received using ackPayload (red light-failed, green-received). But the response time is very long. I set sending interval to 10 milliseconds, but it seems like the receiving Arduino is busy for too long when writing to TEA5767. The result is that LEDs are alternately blinking and whole communication is slowed down. I also added a servo, which is jiggering while moving. Increasing sending interval to 100 ms only fixed LED blinking and doesn't solve the speed problem. I tried changing bus speed to 400kHz with no results. Any ideas?

Transmitter:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>


#define CE_PIN  7
#define CSN_PIN 8
#define online 3
#define offline 4

const byte adresa[5] = {'O','z','z','a','k'};

RF24 komunikace(CE_PIN, CSN_PIN);

int dataProAuto = 8000;
int dataOdAuta = -1;
bool novaData = false;
int pot1;

unsigned long soucasnyCas;
unsigned long predchoziCas;
unsigned long vysilaciInterval = 100;

//===============

void setup() {
  Serial.begin(9600);
    pinMode(online, OUTPUT);
    pinMode(offline, OUTPUT);
    pinMode(A0, INPUT);
    pinMode(A2, INPUT);

    komunikace.begin();
    komunikace.setDataRate( RF24_250KBPS );

    komunikace.enableAckPayload();
    komunikace.setPALevel(RF24_PA_MIN);


    komunikace.openWritingPipe(adresa);
}

//=============

void loop() {

    soucasnyCas = millis();
    if (soucasnyCas - predchoziCas >= vysilaciInterval) {
      
        odeslat();
    }
    zobrazPrichoziData();
}

//================

void odeslat() {

    bool ack;
    ack = komunikace.write( &dataProAuto, sizeof(dataProAuto) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataProAuto was an int sizeof() would correctly return 2


    if (ack) {
        if ( komunikace.isAckPayloadAvailable() ) {
            komunikace.read(&dataOdAuta, sizeof(dataOdAuta));
            novaData = true;
            digitalWrite(online, HIGH);
            digitalWrite(offline, LOW);
        }


    }
    else {

        digitalWrite(online, LOW);
        digitalWrite(offline, HIGH);
        
    }
        aktualizujOdchoziData();
    predchoziCas = millis();
 }


//=================

void zobrazPrichoziData() {
    if (novaData == true) {

        novaData = false;
    }
}

//================

void aktualizujOdchoziData() {
pot1 = analogRead(A0);
pot1 = map(pot1, 0, 1023, 0, 210);
pot1 = pot1 + 870;
    dataProAuto = pot1;
    Serial.println(dataProAuto);
}

Receiver:

#include <Servo.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
#include <TEA5767Radio.h>

#define CE_PIN  7
#define CSN_PIN 8

const byte adresa[5] = {'O','z','z','a','k'};

RF24 komunikace(CE_PIN, CSN_PIN);

int dataOdOvladace;
int dataProOvladac = 100;
bool novaData = false;
int ser;
Servo servo1;


TEA5767Radio radio = TEA5767Radio();


//==============

void setup() {
  servo1.attach(10);
    
    Wire.begin();
    Wire.setClock(400000);
    Wire.write(0x02);

    komunikace.begin();
    komunikace.setDataRate( RF24_250KBPS );
    komunikace.openReadingPipe(1, adresa);

    komunikace.enableAckPayload();
    komunikace.setPALevel(RF24_PA_MAX);

    komunikace.writeAckPayload(1, &dataProOvladac, sizeof(dataProOvladac)); // pre-load data

    komunikace.startListening();
}

//==========

void loop() {
    prijmoutData();
    pouzitPrichoziData();
}

//============

void prijmoutData() {
    if ( komunikace.available() ) {
        komunikace.read( &dataOdOvladace, sizeof(dataOdOvladace) );
        
        aktualizujDataProOvladac();
        
        novaData = true;
    }
}

//================

void pouzitPrichoziData() {
    if (novaData == true) {
ser = map(dataOdOvladace, 870, 1080, 0, 180);
servo1.write(ser);
float y;
y = float(dataOdOvladace);
y = y/10;
radio.setFrequency(y);

        novaData = false;
    }
}

//================

void aktualizujDataProOvladac() {
    dataProOvladac -= 1;

    if (dataProOvladac < 100) {
        dataProOvladac = 109;
    }

    komunikace.writeAckPayload(1, &dataProOvladac, sizeof(dataProOvladac)); // load the payload for the next time
}

To set the frequency every 10ms is too fast.
You didn't tell which TEA5767Radio library you use, but I suppose it is the 5 year old version of Simon Monk.
The setFrequency() of that function has a delay(100). I don't know why, but that delay is in that function. The I2C to the TEA5767 takes about 1 or 2 ms.

You were absolutely right. I removed that delay from my library and everything works like it's supposed to. Thank you.