The Arduino Uno has a 5V I2C bus and the ESP8266 has a 3.3V I2C bus. The pins of the ESP8266 are more or less 5V tolerant, so it will not get damaged, but the voltage of the I2C bus signals do not match.
Could you read this: How to make a reliable I2C bus · Koepel/How-to-use-the-Arduino-Wire-library Wiki · GitHub.
Serial/UART is better, but then you still have to fix the difference in voltage levels.
Can you do your project with a single ESP32 ? Avoid all the 5V/3.3V trouble by not using 5V sensors. That is a lot easier. By the way, the ESP32 does not have 5V tolerant pins !
Could you make the text layout of the sketch better ? Make every indent, every comma, every space, every new line, everything at the right place. A good sketch shows at the first glance the structure of the code.
The Uno Slave sketch:
Your 'volatile' flag 'haveData' and your 'volatile' variables are very good.
The onRequest handler needs only Wire.write(). It is allowed to use more than one Wire.write().
Remove your Wire.beginTransmission() and Wire.endTransmission() from sendEvent().
I prefer that you check if 'howMany' has exactly the right size.
So "if (howMany ==" instead of "if (howMany >=".
Do you know a 'struct' ? That is the best way to transfer the data. See the tutorial by Robin2: Use I2C for communication between Arduinos - Exhibition / Gallery - Arduino Forum.
The receiveEvent() function is not used yet.
The ESP8266 Master sketch:
There is no need to use 'volatile' variables. They are only used in the loop() and are not changed in a interrupt routine. The 'haveData' variable is not needed.
Could you remove the Event() function ?
Requesting data from the Uno is done in the loop() with normal functions.
The Wire buffer size of the Arduino Uno is 32. You can read only 32 bytes.
Wire.requestFrom( 8, (sizeof( foo1) + (sizeof( bar)) ); //0x08 = 8;
if( Wire.available() == (sizeof( foo1) + (sizeof( bar)) )
{
I2C_readAnything (foo1);
I2C_readAnything (bar);
Serial.print ("Received bar= ");
Serial.println (bar);
Serial.print ("Received foo1 = ");
Serial.println (foo1);
}
else
{
Serial.println( "Error, no data or wrong amount of data");
}