Last active
September 6, 2019 06:23
-
-
Save mcspr/a68cd059304c14f487a4653f7b03e091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tools/sdk/lwip2/include/lwipopts.h b/tools/sdk/lwip2/include/lwipopts.h | |
index 22acb6b4..fcd7ba4e 100644 | |
--- a/tools/sdk/lwip2/include/lwipopts.h | |
+++ b/tools/sdk/lwip2/include/lwipopts.h | |
@@ -3571,9 +3571,9 @@ extern "C" { | |
#define SNTP_SET_SYSTEM_TIME_US(t,us) do { struct timeval tv = { t, us }; settimeofday(&tv, NULL); } while (0) | |
#define SNTP_UPDATE_DELAY_DEFAULT 3600000 | |
-#define SNTP_SUPPRESS_DELAY_CHECK 1 | |
-#define SNTP_UPDATE_DELAY sntp_update_delay_not_less_than_15000 | |
-extern uint32_t SNTP_UPDATE_DELAY; | |
+#define SNTP_SUPPRESS_DELAY_CHECK 1 // suppress sntp preprocessor checking that this value is below 15000 | |
+#define SNTP_UPDATE_DELAY custom_sntp_update_delay_func() | |
+extern uint32_t custom_sntp_update_delay_func(void); | |
#if LWIP_FEATURES | |
// lwip-1.4 had 3 possible SNTP servers (constant was harcoded) | |
@@ -3589,7 +3589,10 @@ extern uint32_t SNTP_UPDATE_DELAY; | |
* This can be defined to a random generation function, | |
* which must return the delay in milliseconds as u32_t. | |
*/ | |
-#define SNTP_STARTUP_DELAY 0 | |
+ | |
+#define SNTP_STARTUP_DELAY 1 | |
+#define SNTP_STARTUP_DELAY_FUNC custom_sntp_startup_delay_func() | |
+extern uint32_t custom_sntp_startup_delay_func(void); | |
/* | |
-------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/glue-lwip/lwip-git.c b/glue-lwip/lwip-git.c | |
index 566e813..3441bb5 100644 | |
--- a/glue-lwip/lwip-git.c | |
+++ b/glue-lwip/lwip-git.c | |
@@ -65,7 +65,13 @@ const char netif_name[2][8] = { "station", "soft-ap" }; | |
int __attribute__((weak)) doprint_allow = 0; // for doprint() | |
-uint32_t sntp_update_delay_not_less_than_15000 = SNTP_UPDATE_DELAY_DEFAULT; | |
+uint32_t __attribute__((weak)) custom_sntp_update_delay_func() { | |
+ return SNTP_UPDATE_DELAY_DEFAULT; | |
+} | |
+ | |
+uint32_t __attribute__((weak)) custom_sntp_startup_delay_func() { | |
+ return (LWIP_RAND() % 5000); | |
+} | |
err_t glue2git_err (err_glue_t err) | |
{ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment