//#endif
#else /* LWIP_WND_SCALE */
-#if (ESP_PER_SOC_TCP_WND == 0)
+#if ! ESP_PER_SOC_TCP_WND
#if (LWIP_TCP && (TCP_WND > 0xffff))
#error "If you want to use TCP, TCP_WND must fit in an u16_t, so, you have to reduce it in your lwipopts.h (or enable window scaling)"
#endif
#endif /* LWIP_WND_SCALE */
-#if (ESP_PER_SOC_TCP_WND == 0)
-#if (LWIP_TCP && (TCP_SND_QUEUELEN > 0xffff))
+#if ! ESP_PER_SOC_TCP_WND
+#if (LWIP_TCP && (TCP_SND_QUEUELEN(0) > 0xffff))
#error "If you want to use TCP, TCP_SND_QUEUELEN must fit in an u16_t, so, you have to reduce it in your lwipopts.h"
#endif
-#if (LWIP_TCP && (TCP_SND_QUEUELEN < 2))
+#if (LWIP_TCP && (TCP_SND_QUEUELEN(0) < 2))
#error "TCP_SND_QUEUELEN must be at least 2 for no-copy TCP writes to work"
#endif
/* TCP sanity checks */
#if !LWIP_DISABLE_TCP_SANITY_CHECKS
+#if ! ESP_PER_SOC_TCP_WND
#if LWIP_TCP
-#if !MEMP_MEM_MALLOC && (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN)
+#if !MEMP_MEM_MALLOC && (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN(0))
#error "lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
-#if (ESP_PER_SOC_TCP_WND == 0)
-#if TCP_SND_BUF < (2 * TCP_MSS)
+#if TCP_SND_BUF(0) < (2 * TCP_MSS)
#error "lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
-#if TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF / TCP_MSS))
- #error "lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
+#if TCP_SND_QUEUELEN(0) < (2 * (TCP_SND_BUF(0) / TCP_MSS))
+ #error "lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF(0)/TCP_MSS) for things to work. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
-#if TCP_SNDLOWAT >= TCP_SND_BUF
+#if TCP_SNDLOWAT >= TCP_SND_BUF(0)
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!"
#endif
-#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
+#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN(0)
#error "lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
#endif
#endif
/* Enable all Espressif-only options */
#define ESP_LWIP 1
-#define ESP_PER_SOC_TCP_WND 1
+#define ESP_PER_SOC_TCP_WND 0
#define ESP_THREAD_SAFE 1
#define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF
#define ESP_DHCP 1
#define ESP_LIGHT_SLEEP 1
-#if ESP_PER_SOC_TCP_WND
#define TCP_WND_DEFAULT (4*TCP_MSS)
#define TCP_SND_BUF_DEFAULT (2*TCP_MSS)
+
+#if ESP_PER_SOC_TCP_WND
#define TCP_WND(pcb) (pcb->per_soc_tcp_wnd)
#define TCP_SND_BUF(pcb) (pcb->per_soc_tcp_snd_buf)
#else