The following sketch will compile in version 21 and below, but not in version 22. Any ideas?
It writes multiple bytes to EEPROM. Been running it for some time in a larger sketch. Upgraded to version 22 yesterday.
#include <EEPROM.h>
float Kwh = 141.00;
float KwhHourstart = 0.000;
float KwhDaystart = 141.000;
template int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}
template int EEPROM_readAnything(int ee, T& value)
{
byte* p = (byte*)(void*)&value;
int i;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}
void setup()
{
Serial.begin(9600);
EEPROM_writeAnything(20, Kwh);
EEPROM_writeAnything(24, KwhHourstart);
EEPROM_writeAnything(28, KwhDaystart);
EEPROM_readAnything(20,Kwh);
Serial.print(Kwh,3);
}
void loop()
{
}