Upgrading ESP8266 from 3.0.2 to 3.1.0 causing a Wire library notice

I upgraded my ESP8266 board library from 3.0.2 to 3.1.0.This upgrade cause a notice regarding the Wire.h library appears when my sketch is compiled. This note is not present when the version 3.0.2. of ESP8266 is used.

The sketch can be uploaded to ESP module and the program is running even if these notices are present.

D:\Arduino IDE\xxxx.ino:677:31: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second:
  677 |   Wire.requestFrom(MCP_Addr, 1);
      |                               ^
In file included from D:\Arduino IDE\xxxxx.ino:2:
C:\Users\mario\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.0\libraries\Wire/Wire.h:73:13: note: candidate 1: 'uint8_t TwoWire::requestFrom(int, int)'
   73 |     uint8_t requestFrom(int, int);
      |             ^~~~~~~~~~~
C:\Users\mario\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.0\libraries\Wire/Wire.h:71:13: note: candidate 2: 'uint8_t TwoWire::requestFrom(uint8_t, uint8_t)'
   71 |     uint8_t requestFrom(uint8_t, uint8_t);
      |             ^~~~~~~~~~~

There is a section of my sketch regarding the line 677.

void MCP_Read(uint8_t MCP_Addr, uint8_t Registre) {  // Lire valeur d'un registre, retourne MCP_data

  Wire.beginTransmission(MCP_Addr);
  Wire.write(Registre);
  Wire.endTransmission();
  Wire.requestFrom(MCP_Addr, 1);
  MCP_data = Wire.read();
  delayMicroseconds(200);
}

Does someone can comment this notice and the way to remove it?

Tanks,

Your function call has the format Wire.requestFrom(uint8_t, int), and the compiler cannot decide whether it is better to change the first argument to int, or the 2nd argument to uint_8. You should be able to explicitly use Wire.requestFrom(MCP_Addr, (uint8_t) 1) to get rid of the ambiguity.

Mr. david,
Tanks a lot for your solution.

I modified, like suggested the parameters of the function.

void MCP_Read(int MCP_Addr, uint8_t Registre) { 

MDR

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.