mirror of
https://github.com/esp8266/Arduino.git
synced 2025-12-13 20:03:19 +03:00
polledTimeout: add option to use CPU count instead of millis() (#5870)
* polledTimeout: add option to use CPU count instead of millis() * use more "using" alias * more c++/clear code, using typename (thanks @devyte) * rename class name to include unit, introduce timeMax() and check it with assert() * remove useless defines * improve api readability, add micro-second unit * update example * mock: emulate getCycleCount, add/fix polledTimeout CI test * + nano-seconds, assert -> message, comments, host test * allow 0 for timeout (enables immediate timeout, fix division by 0) * typo, set member instead of local variable * unify error message * slight change on checkExpired() allows "never expired" also removed printed message, add YieldAndDelay, simplify calculations * remove traces of debug.h/cpp in this PR * include missing <limits> header * back to original expired test, introduce boolean _neverExpires, fix reset(), getTimeout() is invalid * fix expiredOneShot with _timeout==0 check * reenable getTimeout() * expose checkExpired with unit conversion * fix timing comments, move critical code to iram * add member ::neverExpires and use it where relevant * improve clarity * remove exposed checkExpired(), adapt LEAmDNS with equivalent * add API ::resetToNeverExpires(), use it in LEAmDNS * remove offending constness from ::flagged() LEAmDNS (due do API fix in PolledTimeout) * simplify "Fast" base classes * minor variable rename * Fix examples * compliance with good c++ manners * minor changes for consistency * add missing const * expired() and bool() moved to iram * constexpr compensation computing * add/update comments * move neverExpires and alwaysExpired
This commit is contained in:
@@ -905,12 +905,12 @@ protected:
|
||||
* stcProbeInformation
|
||||
*/
|
||||
struct stcProbeInformation {
|
||||
enuProbingStatus m_ProbingStatus;
|
||||
uint8_t m_u8SentCount; // Used for probes and announcements
|
||||
esp8266::polledTimeout::oneShot m_Timeout; // Used for probes and announcements
|
||||
//clsMDNSTimeFlag m_TimeFlag; // Used for probes and announcements
|
||||
bool m_bConflict;
|
||||
bool m_bTiebreakNeeded;
|
||||
enuProbingStatus m_ProbingStatus;
|
||||
uint8_t m_u8SentCount; // Used for probes and announcements
|
||||
esp8266::polledTimeout::oneShotMs m_Timeout; // Used for probes and announcements
|
||||
//clsMDNSTimeFlag m_TimeFlag; // Used for probes and announcements
|
||||
bool m_bConflict;
|
||||
bool m_bTiebreakNeeded;
|
||||
MDNSHostProbeFn m_fnHostProbeResultCallback;
|
||||
MDNSServiceProbeFn m_fnServiceProbeResultCallback;
|
||||
|
||||
@@ -974,14 +974,14 @@ protected:
|
||||
const timeoutLevel_t TIMEOUTLEVEL_INTERVAL = 5;
|
||||
const timeoutLevel_t TIMEOUTLEVEL_FINAL = 100;
|
||||
|
||||
uint32_t m_u32TTL;
|
||||
esp8266::polledTimeout::oneShot m_TTLTimeout;
|
||||
timeoutLevel_t m_timeoutLevel;
|
||||
uint32_t m_u32TTL;
|
||||
esp8266::polledTimeout::oneShotMs m_TTLTimeout;
|
||||
timeoutLevel_t m_timeoutLevel;
|
||||
|
||||
stcTTL(void);
|
||||
bool set(uint32_t p_u32TTL);
|
||||
|
||||
bool flagged(void) const;
|
||||
bool flagged(void);
|
||||
bool restart(void);
|
||||
|
||||
bool prepareDeletion(void);
|
||||
@@ -1073,14 +1073,14 @@ protected:
|
||||
#endif
|
||||
};
|
||||
|
||||
stcMDNSServiceQuery* m_pNext;
|
||||
stcMDNS_RRDomain m_ServiceTypeDomain; // eg. _http._tcp.local
|
||||
MDNSServiceQueryCallbackFunc m_fnCallback;
|
||||
bool m_bLegacyQuery;
|
||||
uint8_t m_u8SentCount;
|
||||
esp8266::polledTimeout::oneShot m_ResendTimeout;
|
||||
bool m_bAwaitingAnswers;
|
||||
stcAnswer* m_pAnswers;
|
||||
stcMDNSServiceQuery* m_pNext;
|
||||
stcMDNS_RRDomain m_ServiceTypeDomain; // eg. _http._tcp.local
|
||||
MDNSServiceQueryCallbackFunc m_fnCallback;
|
||||
bool m_bLegacyQuery;
|
||||
uint8_t m_u8SentCount;
|
||||
esp8266::polledTimeout::oneShotMs m_ResendTimeout;
|
||||
bool m_bAwaitingAnswers;
|
||||
stcAnswer* m_pAnswers;
|
||||
|
||||
stcMDNSServiceQuery(void);
|
||||
~stcMDNSServiceQuery(void);
|
||||
|
||||
Reference in New Issue
Block a user