Hello forum,
I make use of Minicore's ATMega328 bootloader on my generic 3.3V 8Mhz Pro-mini boards, in order to keep WDT working. Without this the WDT does not reset the board when it goes into a closed loop.
I'm attempting to use I2C comms between two of these boards, but when I compile my sketch I get the error mentioned in the subject above, with the line containing "Wire.onReceive(getWire);" highlighted.
When I change the board to the standard Arduino Pro-mini, the error dissapears, but when I use that bootloader I'm back to WDT not working.
Does anyone know how I can bypass this?
getWire does the following, and works fine on an UNO or MEGA 2560.
void getWire()
{
int i = 0;
while (Wire.available() > 0)
{
RX[i] = Wire.read();
RX[i + 1] = '\0';
i++;
}
Serial.println(RX);
}
Found the solution, had to add this to the code:
void getWire(int wireSize)
{
(void)wireSize;
int i = 0;
while (Wire.available() > 0)
{
RX[i] = Wire.read();
RX[i + 1] = '\0';
i++;
}
Serial.println(RX);
But I'm curious why some boards need this and others don't need that bit?
You can also write
void getWire(int)
{
}
The reason why MiniCore treats this differently than the official core is that MiniCore does not use the -fpermissive flag.
From the avr-gcc manual:
-fpermissive
Downgrade some diagnostics about nonconformant code from errors to warnings. Thus, using -fpermissive will allow some nonconforming code to compile.
IIRC the -fpermissive flag was added by an accident in the official Arduino core (or for testing), and now it's too late to remove it. -fpermissive will mute code that's not right, but may still compile. I've decided to leave out this flag for all my cores, You got an error? Fix your broken code! 
Wire.onReceive
The function parameter tells you how many bytes have been received, so there would appear to be no reason to check Wire.available()
Interesting, thanks for the info!