From 6bd61ae298ac15401261663bf9ebb3bbfe4ba8a9 Mon Sep 17 00:00:00 2001 From: Jeff Kletsky Date: Tue, 27 Feb 2018 19:59:40 -0800 Subject: [PATCH] Increase heap to 288 on SNTP test; warnings on robustness --- extras/timekeeping/tests/sntp-run/sntp_impl.c | 18 +++++++++++++++--- .../tests/sntp-run/timekeeping_sntp_run.c | 5 +++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/extras/timekeeping/tests/sntp-run/sntp_impl.c b/extras/timekeeping/tests/sntp-run/sntp_impl.c index a973dcc..afcc763 100644 --- a/extras/timekeeping/tests/sntp-run/sntp_impl.c +++ b/extras/timekeeping/tests/sntp-run/sntp_impl.c @@ -2,7 +2,8 @@ * Test implementation of callback for LWIP SNTP * * Production code would likely decide how to handle - * various magnitude changes, and be brisk about it + * various magnitude changes, be robust to outliers, + * and be brisk about it all */ /*- @@ -43,9 +44,20 @@ #include "sntp_impl.h" - +/********************************************************** + * IMPORTANT: THIS IS A TEST HARNESS, NOT PRODUCTION CODE * + ********************************************************** + * + * Spikes in delay of over 200 ms have been observed in testing. + * Such spikes would likely cause both a forward and a backward jump + * in time using this simplistic approach. Increasing the threshold to, + * for example, 250 ms would require 2000 * 250 ms = 500 sec ~ 10 min + * for the time to slew back after a "bad set" or series of "bad" packets. + * + * PRODUCTION CODE SHOULD USE AN APPLICATION-APPROPRIATE CLOCK DISCIPLINE + */ #ifndef SNTP_IMPL_STEP_THRESHOLD -#define SNTP_IMPL_STEP_THRESHOLD 128000 +#define SNTP_IMPL_STEP_THRESHOLD 125000 #endif diff --git a/extras/timekeeping/tests/sntp-run/timekeeping_sntp_run.c b/extras/timekeeping/tests/sntp-run/timekeeping_sntp_run.c index bd56bde..a8195d0 100644 --- a/extras/timekeeping/tests/sntp-run/timekeeping_sntp_run.c +++ b/extras/timekeeping/tests/sntp-run/timekeeping_sntp_run.c @@ -129,7 +129,8 @@ user_init(void) * Run at a high enough priority so that the initial time-set doesn't get interrupted * Later calls and listen-only mode calls run in the high-priority "tcpip_thread" (LWIP) * - * 256 heap seems sufficient, 196 didn't bomb, but not examined in detail + * While 196 heap seemed sufficient for many tests, use of an NTP pool + * with DNS caused heap errors/warnings on starting NTP at 256 heap */ - xTaskCreate(sntp_task, "SNTP task", 256, NULL, 6, NULL); + xTaskCreate(sntp_task, "SNTP task", 288, NULL, 6, NULL); }