@@ -808,6 +808,9 @@ class BlinkerApi : public BlinkerProtocol
808
808
809
809
uint32_t _autoUpdateTime = 0 ;
810
810
811
+ uint8_t _serverTimes = 0 ;
812
+ uint32_t _serverTime = 0 ;
813
+
811
814
#if defined(BLINKER_PRO_ESP)
812
815
uint32_t _eWarnTime = 0 ;
813
816
uint32_t _eErrTime = 0 ;
@@ -2073,6 +2076,7 @@ class BlinkerApi : public BlinkerProtocol
2073
2076
2074
2077
#endif
2075
2078
2079
+ bool checkServerLimit ();
2076
2080
bool checkSMS ();
2077
2081
bool checkPUSH ();
2078
2082
bool checkWECHAT ();
@@ -9270,8 +9274,34 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9270
9274
9271
9275
#endif
9272
9276
9277
+ bool BlinkerApi::checkServerLimit ()
9278
+ {
9279
+ if ((millis () - _serverTime) < 60 * 60 * 1000 )
9280
+ {
9281
+ if (_serverTimes > BLINKER_PRINT_MSG_LIMIT)
9282
+ {
9283
+ BLINKER_ERR_LOG (BLINKER_F (" SERVER NOT ALIVE OR MSG LIMIT" ));
9284
+
9285
+ return false ;
9286
+ }
9287
+ else
9288
+ {
9289
+ _serverTimes++;
9290
+ return true ;
9291
+ }
9292
+ }
9293
+ else
9294
+ {
9295
+ _serverTimes++;
9296
+ return true ;
9297
+ }
9298
+
9299
+ }
9300
+
9273
9301
bool BlinkerApi::checkSMS ()
9274
9302
{
9303
+ if (!checkServerLimit ()) return false ;
9304
+
9275
9305
if ((millis () - _smsTime) >= BLINKER_SMS_MSG_LIMIT || \
9276
9306
_smsTime == 0 ) return true ;
9277
9307
else return false ;
@@ -9280,6 +9310,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9280
9310
9281
9311
bool BlinkerApi::checkPUSH ()
9282
9312
{
9313
+ if (!checkServerLimit ()) return false ;
9314
+
9283
9315
if ((millis () - _pushTime) >= BLINKER_PUSH_MSG_LIMIT || \
9284
9316
_pushTime == 0 ) return true ;
9285
9317
else return false ;
@@ -9288,6 +9320,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9288
9320
9289
9321
bool BlinkerApi::checkWECHAT ()
9290
9322
{
9323
+ if (!checkServerLimit ()) return false ;
9324
+
9291
9325
if ((millis () - _wechatTime) >= BLINKER_WECHAT_MSG_LIMIT || \
9292
9326
_wechatTime == 0 ) return true ;
9293
9327
else return false ;
@@ -9296,6 +9330,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9296
9330
9297
9331
bool BlinkerApi::checkWEATHER ()
9298
9332
{
9333
+ if (!checkServerLimit ()) return false ;
9334
+
9299
9335
if ((millis () - _weatherTime) >= BLINKER_WEATHER_MSG_LIMIT || \
9300
9336
_weatherTime == 0 ) return true ;
9301
9337
else return false ;
@@ -9304,6 +9340,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9304
9340
9305
9341
bool BlinkerApi::checkAQI ()
9306
9342
{
9343
+ if (!checkServerLimit ()) return false ;
9344
+
9307
9345
if ((millis () - _aqiTime) >= BLINKER_AQI_MSG_LIMIT || \
9308
9346
_aqiTime == 0 ) return true ;
9309
9347
else return false ;
@@ -9319,6 +9357,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9319
9357
9320
9358
bool BlinkerApi::checkCGET ()
9321
9359
{
9360
+ if (!checkServerLimit ()) return false ;
9361
+
9322
9362
if ((millis () - _cGetTime) >= BLINKER_CONFIG_GET_LIMIT || \
9323
9363
_cGetTime == 0 ) return true ;
9324
9364
else return false ;
@@ -9327,6 +9367,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9327
9367
9328
9368
bool BlinkerApi::checkCDEL ()
9329
9369
{
9370
+ if (!checkServerLimit ()) return false ;
9371
+
9330
9372
if ((millis () - _cDelTime) >= BLINKER_CONFIG_GET_LIMIT || \
9331
9373
_cDelTime == 0 ) return true ;
9332
9374
else return false ;
@@ -9343,6 +9385,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9343
9385
9344
9386
bool BlinkerApi::checkDataGet ()
9345
9387
{
9388
+ if (!checkServerLimit ()) return false ;
9389
+
9346
9390
if ((millis () - _dGetTime) >= BLINKER_CONFIG_UPDATE_LIMIT || \
9347
9391
_dGetTime == 0 ) return true ;
9348
9392
else return false ;
@@ -9351,6 +9395,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
9351
9395
9352
9396
bool BlinkerApi::checkDataDel ()
9353
9397
{
9398
+ if (!checkServerLimit ()) return false ;
9399
+
9354
9400
if ((millis () - _dDelTime) >= BLINKER_CONFIG_UPDATE_LIMIT || \
9355
9401
_dDelTime == 0 ) return true ;
9356
9402
else return false ;
0 commit comments