ttlappalainen/NMEA2000

Compile with V3.0.0a IDF

Closed this issue · 0 comments

I am trying to see if IDF 3.0.0 (alpha 3) is usable, and I found these errors that are associated with your library.
You may already be aware of them?
Rodrigo Garcia was nice enough on another issue for me to remind me that its possible to "#ifdef" and look at the ESP_IDF_Version so as to have two versions of code.
THIS IS A PAIN.. but they probably have "reasons" for changes.. ??
They seem to also be "tightening up" on format conversions?

The errors I'm seeing in N2000 are below. I have a issue report in about gpio_matrix_out problem elsewhere..
It might "just" be a change in input parameter expectations?, but I have not found an easy answer.

In file included from c:\Users\admin\Documents\Arduino\libraries\NMEA2000_esp32\NMEA2000_esp32.cpp:30:
C:\Users\admin\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.1-3662303f31/esp32/include/driver/deprecated/driver/periph_ctrl.h:7:2: warning: #warning driver/periph_ctrl.h header is no longer used, and will be removed in future versions. [-Wcpp]
    7 | #warning driver/periph_ctrl.h header is no longer used, and will be removed in future versions.
      |  ^~~~~~~
c:\Users\admin\Documents\Arduino\libraries\NMEA2000_esp32\NMEA2000_esp32.cpp: In member function 'void tNMEA2000_esp32::CAN_init()':
c:\Users\admin\Documents\Arduino\libraries\NMEA2000_esp32\NMEA2000_esp32.cpp:132:9: error: 'gpio_matrix_in' was not declared in this scope
  132 |         gpio_matrix_in(RxPin,CAN_RX_IDX,0);
      |         ^~~~~~~~~~~~~~
c:\Users\admin\Documents\Arduino\libraries\NMEA2000_esp32\NMEA2000_esp32.cpp:133:9: error: 'gpio_pad_select_gpio' was not declared in this scope; did you mean 'esp_rom_gpio_pad_select_gpio'?
  133 |         gpio_pad_select_gpio(RxPin);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         esp_rom_gpio_pad_select_gpio
c:\Users\admin\Documents\Arduino\libraries\NMEA2000_esp32\NMEA2000_esp32.cpp:157:44: warning: arithmetic between floating-point type 'float' and enumeration type 'CAN_speed_t' is deprecated [-Wdeprecated-enum-float-conversion]
  157 |                         __tq = ((float)1000/speed) / 16;
      |                                 ~~~~~~~~~~~^~~~~~
c:\Users\admin\Documents\Arduino\libraries\NMEA2000_esp32\NMEA2000_esp32.cpp:200:5: error: 'gpio_matrix_out' was not declared in this scope; did you mean 'gpio_iomux_out'?
  200 |     gpio_matrix_out(TxPin,CAN_TX_IDX,0,0);
      |     ^~~~~~~~~~~~~~~
      |     gpio_iomux_out

This is the form I've used to make a different bit of code compile with both IDF..

#if ESP_IDF_VERSION_MAJOR == 5 
//revised version for  IDF 5.xxx
static void OnDataRecv(const esp_now_recv_info_t *recv_info, const uint8_t *data, int len) 
{..}
#else
// older IDF Version ( eg v4.4.2)
void OnDataRecv(const uint8_t* mac, const uint8_t* incomingData, int len) 
 {...}
#endif