Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sntp work with ESP-IDF >= 5.0 #6769

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

HeMan
Copy link
Contributor

@HeMan HeMan commented May 18, 2024

What does this implement/fix?

Makes sntp works with ESP-IDF >= 5.0

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@codecov-commenter
Copy link

codecov-commenter commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.09%. Comparing base (4d8b5ed) to head (2dac987).
Report is 635 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6769      +/-   ##
==========================================
+ Coverage   53.70%   54.09%   +0.38%     
==========================================
  Files          50       50              
  Lines        9408     9627     +219     
  Branches     1654     1701      +47     
==========================================
+ Hits         5053     5208     +155     
- Misses       4056     4092      +36     
- Partials      299      327      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jesserockz
Copy link
Member

What error were you getting before with idf 5+?

@HeMan
Copy link
Contributor Author

HeMan commented May 19, 2024

What error were you getting before with idf 5+?

I get multiple errors, redeclared, undeclared and deprecation.

/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:235:6: error: 'void sntp_setoperatingmode(u8_t)' was declared 'extern' and later 'static' [-fpermissive]
  235 | void sntp_setoperatingmode(u8_t operating_mode)
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from src/esphome/components/sntp/sntp_component.cpp:5:
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/lwip/src/include/lwip/apps/sntp.h:51:6: note: previous declaration of 'void sntp_setoperatingmode(u8_t)'
   51 | void sntp_setoperatingmode(u8_t operating_mode);
      |      ^~~~~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:242:1: error: expected unqualified-id before '{' token
  242 | {
      | ^
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:249:6: error: 'void sntp_setservername(u8_t, const char*)' was declared 'extern' and later 'static' [-fpermissive]
  249 | void sntp_setservername(u8_t idx, const char *server)
      |      ^~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/lwip/src/include/lwip/apps/sntp.h:66:6: note: previous declaration of 'void sntp_setservername(u8_t, const char*)'
   66 | void sntp_setservername(u8_t idx, const char *server);
      |      ^~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:255:6: error: 'void sntp_init()' was declared 'extern' and later 'static' [-fpermissive]
  255 | void sntp_init(void)
      |      ^~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/lwip/src/include/lwip/apps/sntp.h:54:6: note: previous declaration of 'void sntp_init()'
   54 | void sntp_init(void);
      |      ^~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:261:13: error: 'const char* sntp_getservername(u8_t)' was declared 'extern' and later 'static' [-fpermissive]
  261 | const char *sntp_getservername(u8_t idx)
      |             ^~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/lwip/src/include/lwip/apps/sntp.h:67:13: note: previous declaration of 'const char* sntp_getservername(u8_t)'
   67 | const char *sntp_getservername(u8_t idx);
      |             ^~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:267:18: error: 'const ip_addr_t* sntp_getserver(u8_t)' was declared 'extern' and later 'static' [-fpermissive]
  267 | const ip_addr_t* sntp_getserver(u8_t idx)
      |                  ^~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/lwip/src/include/lwip/apps/sntp.h:59:18: note: previous declaration of 'const ip_addr_t* sntp_getserver(u8_t)'
   59 | const ip_addr_t* sntp_getserver(u8_t idx);
      |                  ^~~~~~~~~~~~~~
src/esphome/components/sntp/sntp_component.cpp: In member function 'virtual void esphome::sntp::SNTPComponent::setup()':
src/esphome/components/sntp/sntp_component.cpp:34:24: warning: 'void sntp_setoperatingmode(u8_t)' is deprecated: use esp_sntp_setoperatingmode() instead [-Wdeprecated-declarations]
   34 |   sntp_setoperatingmode(SNTP_OPMODE_POLL);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:235:6: note: declared here
  235 | void sntp_setoperatingmode(u8_t operating_mode)
      |      ^~~~~~~~~~~~~~~~~~~~~
src/esphome/components/sntp/sntp_component.cpp:40:21: warning: 'void sntp_setservername(u8_t, const char*)' is deprecated: use esp_sntp_setservername() instead [-Wdeprecated-declarations]
   40 |   sntp_setservername(0, strdup(this->server_1_.c_str()));
      |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:249:6: note: declared here
  249 | void sntp_setservername(u8_t idx, const char *server)
      |      ^~~~~~~~~~~~~~~~~~
src/esphome/components/sntp/sntp_component.cpp:42:23: warning: 'void sntp_setservername(u8_t, const char*)' is deprecated: use esp_sntp_setservername() instead [-Wdeprecated-declarations]
   42 |     sntp_setservername(1, strdup(this->server_2_.c_str()));
      |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:249:6: note: declared here
  249 | void sntp_setservername(u8_t idx, const char *server)
      |      ^~~~~~~~~~~~~~~~~~
src/esphome/components/sntp/sntp_component.cpp:45:23: warning: 'void sntp_setservername(u8_t, const char*)' is deprecated: use esp_sntp_setservername() instead [-Wdeprecated-declarations]
   45 |     sntp_setservername(2, strdup(this->server_3_.c_str()));
      |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:249:6: note: declared here
  249 | void sntp_setservername(u8_t idx, const char *server)
      |      ^~~~~~~~~~~~~~~~~~
src/esphome/components/sntp/sntp_component.cpp:51:12: warning: 'void sntp_init()' is deprecated: use esp_sntp_init() instead [-Wdeprecated-declarations]
   51 |   sntp_init();
      |   ~~~~~~~~~^~
/home/jimmy/.platformio/packages/framework-espidf/components/lwip/include/apps/esp_sntp.h:255:6: note: declared here
  255 | void sntp_init(void)
      |      ^~~~~~~~~
Compiling .pioenvs/round/src/esphome/components/time/automation.o
*** [.pioenvs/round/src/esphome/components/sntp/sntp_component.o] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants