Skip to content

Commit e4f8812

Browse files
committed
update codes, upgrade BLINKER SERVER LIMIT codes
1 parent fb3c173 commit e4f8812

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ environment:
44
BUILD_HOME: "/home/appveyor"
55

66
TARGET_LIB: "$BUILD_HOME/Arduino/libraries/blinker-library"
7-
OTHER_LIB: "https://github.com/adafruit/Adafruit_NeoPixel.git,https://github.com/adafruit/DHT-sensor-library.git,https://github.com/adafruit/Adafruit_Sensor.git"
7+
OTHER_LIB: "https://github.com/adafruit/Adafruit_NeoPixel.git,https://github.com/adafruit/DHT-sensor-library.git,https://github.com/adafruit/Adafruit_Sensor.git,https://github.com/adafruit/Adafruit-BMP085-Library.git"
88

99
ARDUINO_VER: "arduino-1.8.9"
1010
ARDUINO_URL: "https://downloads.arduino.cc/arduino-1.8.9-linux64.tar.xz"

examples/Blinker_BMP180/BMP180_WiFi/BMP180_WiFi.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ BlinkerNumber PRES("pres"); // Pressure
5656
BlinkerNumber ALTI("alti"); // Altitude
5757

5858
// Download Adafruit-BMP085-Library library here:
59-
//https://github.com/adafruit/Adafruit-BMP085-Library
59+
// https://github.com/adafruit/Adafruit-BMP085-Library
6060
#include <Wire.h>
6161
#include <Adafruit_BMP085.h>
6262

src/Blinker/BlinkerApi.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,9 @@ class BlinkerApi : public BlinkerProtocol
808808

809809
uint32_t _autoUpdateTime = 0;
810810

811+
uint8_t _serverTimes = 0;
812+
uint32_t _serverTime = 0;
813+
811814
#if defined(BLINKER_PRO_ESP)
812815
uint32_t _eWarnTime = 0;
813816
uint32_t _eErrTime = 0;
@@ -2073,6 +2076,7 @@ class BlinkerApi : public BlinkerProtocol
20732076

20742077
#endif
20752078

2079+
bool checkServerLimit();
20762080
bool checkSMS();
20772081
bool checkPUSH();
20782082
bool checkWECHAT();
@@ -9270,8 +9274,34 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
92709274

92719275
#endif
92729276

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+
92739301
bool BlinkerApi::checkSMS()
92749302
{
9303+
if (!checkServerLimit()) return false;
9304+
92759305
if ((millis() - _smsTime) >= BLINKER_SMS_MSG_LIMIT || \
92769306
_smsTime == 0) return true;
92779307
else return false;
@@ -9280,6 +9310,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
92809310

92819311
bool BlinkerApi::checkPUSH()
92829312
{
9313+
if (!checkServerLimit()) return false;
9314+
92839315
if ((millis() - _pushTime) >= BLINKER_PUSH_MSG_LIMIT || \
92849316
_pushTime == 0) return true;
92859317
else return false;
@@ -9288,6 +9320,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
92889320

92899321
bool BlinkerApi::checkWECHAT()
92909322
{
9323+
if (!checkServerLimit()) return false;
9324+
92919325
if ((millis() - _wechatTime) >= BLINKER_WECHAT_MSG_LIMIT || \
92929326
_wechatTime == 0) return true;
92939327
else return false;
@@ -9296,6 +9330,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
92969330

92979331
bool BlinkerApi::checkWEATHER()
92989332
{
9333+
if (!checkServerLimit()) return false;
9334+
92999335
if ((millis() - _weatherTime) >= BLINKER_WEATHER_MSG_LIMIT || \
93009336
_weatherTime == 0) return true;
93019337
else return false;
@@ -9304,6 +9340,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
93049340

93059341
bool BlinkerApi::checkAQI()
93069342
{
9343+
if (!checkServerLimit()) return false;
9344+
93079345
if ((millis() - _aqiTime) >= BLINKER_AQI_MSG_LIMIT || \
93089346
_aqiTime == 0) return true;
93099347
else return false;
@@ -9319,6 +9357,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
93199357

93209358
bool BlinkerApi::checkCGET()
93219359
{
9360+
if (!checkServerLimit()) return false;
9361+
93229362
if ((millis() - _cGetTime) >= BLINKER_CONFIG_GET_LIMIT || \
93239363
_cGetTime == 0) return true;
93249364
else return false;
@@ -9327,6 +9367,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
93279367

93289368
bool BlinkerApi::checkCDEL()
93299369
{
9370+
if (!checkServerLimit()) return false;
9371+
93309372
if ((millis() - _cDelTime) >= BLINKER_CONFIG_GET_LIMIT || \
93319373
_cDelTime == 0) return true;
93329374
else return false;
@@ -9343,6 +9385,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
93439385

93449386
bool BlinkerApi::checkDataGet()
93459387
{
9388+
if (!checkServerLimit()) return false;
9389+
93469390
if ((millis() - _dGetTime) >= BLINKER_CONFIG_UPDATE_LIMIT || \
93479391
_dGetTime == 0) return true;
93489392
else return false;
@@ -9351,6 +9395,8 @@ char * BlinkerApi::widgetName_tab(uint8_t num)
93519395

93529396
bool BlinkerApi::checkDataDel()
93539397
{
9398+
if (!checkServerLimit()) return false;
9399+
93549400
if ((millis() - _dDelTime) >= BLINKER_CONFIG_UPDATE_LIMIT || \
93559401
_dDelTime == 0) return true;
93569402
else return false;

0 commit comments

Comments
 (0)