Added blynk_syncAll to [19_m1284p_WIZNET_blynk]
This commit is contained in:
@@ -760,3 +760,14 @@ static void replacetonull(uint8_t * str, uint8_t c)
|
|||||||
for (x = 0; str[x]; x++)
|
for (x = 0; str[x]; x++)
|
||||||
if (str[x] == c) str[x] = NULL;
|
if (str[x] == c) str[x] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t is_blynk_connection_available(void)
|
||||||
|
{
|
||||||
|
return blynk_connection_available;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Requests Server to re-send current values for all widgets
|
||||||
|
void blynk_syncAll(void)
|
||||||
|
{
|
||||||
|
sendCmd(BLYNK_CMD_HARDWARE_SYNC, 0, NULL, 0, NULL, 0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ enum BlynkCmd
|
|||||||
BLYNK_CMD_EMAIL = 13,
|
BLYNK_CMD_EMAIL = 13,
|
||||||
BLYNK_CMD_PUSH_NOTIFICATION = 14,
|
BLYNK_CMD_PUSH_NOTIFICATION = 14,
|
||||||
BLYNK_CMD_BRIDGE = 15,
|
BLYNK_CMD_BRIDGE = 15,
|
||||||
|
BLYNK_CMD_HARDWARE_SYNC = 16,
|
||||||
BLYNK_CMD_HARDWARE = 20
|
BLYNK_CMD_HARDWARE = 20
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -136,6 +137,9 @@ BlynkParam;
|
|||||||
void blynk_begin(uint8_t * auth, uint8_t * dest_ip, uint16_t dest_port, uint8_t * buf, uint8_t socket);
|
void blynk_begin(uint8_t * auth, uint8_t * dest_ip, uint16_t dest_port, uint8_t * buf, uint8_t socket);
|
||||||
void blynk_run(void);
|
void blynk_run(void);
|
||||||
|
|
||||||
void blynk_time_handler(void);
|
//void blynk_time_handler(void);
|
||||||
|
uint8_t is_blynk_connection_available(void);
|
||||||
|
void sendCmd(uint8_t cmd, uint16_t id, uint8_t * data, size_t length, uint8_t * data2, size_t length2);
|
||||||
|
void blynk_syncAll(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ uint8_t Domain_IP[4] = {0, }; // Translated IP address by DNS S
|
|||||||
* OK (v1.3)GPIO IN - fixed bug (remove redundant space symbol in <dw xx xx >)
|
* OK (v1.3)GPIO IN - fixed bug (remove redundant space symbol in <dw xx xx >)
|
||||||
* Virtual IN/OUT -Not fully supported yet, so decide not use here..
|
* Virtual IN/OUT -Not fully supported yet, so decide not use here..
|
||||||
* OK (v1.4)Analog Read/Write
|
* OK (v1.4)Analog Read/Write
|
||||||
* Restore pins state on board reboot
|
* OK (v1.5)Restore pins state on board reboot
|
||||||
* OK ??3.Try fix frequent reconnection with blynk server - every ~22sec may be this OK.
|
* OK ??3.Try fix frequent reconnection with blynk server - every ~22sec may be this OK.
|
||||||
* Need compare local blynk.c code with modern <blynk> library - (Too old version here - 0.2.1 (On git blynk March 2019 - 0.6.x) )
|
* Need compare local blynk.c code with modern <blynk> library - (Too old version here - 0.2.1 (On git blynk March 2019 - 0.6.x) )
|
||||||
*
|
*
|
||||||
@@ -100,7 +100,7 @@ volatile unsigned long _millis; // for millis tick !! Overflow every ~49.7 days
|
|||||||
//*********Program metrics
|
//*********Program metrics
|
||||||
const char compile_date[] PROGMEM = __DATE__; // Mmm dd yyyy - Дата компиляции
|
const char compile_date[] PROGMEM = __DATE__; // Mmm dd yyyy - Дата компиляции
|
||||||
const char compile_time[] PROGMEM = __TIME__; // hh:mm:ss - Время компиляции
|
const char compile_time[] PROGMEM = __TIME__; // hh:mm:ss - Время компиляции
|
||||||
const char str_prog_name[] PROGMEM = "\r\nAtMega1284p v1.4 Static IP BLYNK WIZNET_5500 ETHERNET 14/03/2019\r\n"; // Program name
|
const char str_prog_name[] PROGMEM = "\r\nAtMega1284p v1.5 Static IP BLYNK WIZNET_5500 ETHERNET 14/03/2019\r\n"; // Program name
|
||||||
|
|
||||||
#if defined(__AVR_ATmega128__)
|
#if defined(__AVR_ATmega128__)
|
||||||
const char PROGMEM str_mcu[] = "ATmega128"; //CPU is m128
|
const char PROGMEM str_mcu[] = "ATmega128"; //CPU is m128
|
||||||
@@ -497,7 +497,8 @@ int main()
|
|||||||
|
|
||||||
/* Loopback Test: TCP Server and UDP */
|
/* Loopback Test: TCP Server and UDP */
|
||||||
// Test for Ethernet data transfer validation
|
// Test for Ethernet data transfer validation
|
||||||
uint32_t timer_link_1sec = millis();
|
uint32_t timer_tick_1sec = millis();
|
||||||
|
uint8_t blynk_restore_connection = 1;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
//Here at least every 1sec
|
//Here at least every 1sec
|
||||||
@@ -515,22 +516,23 @@ int main()
|
|||||||
//loopback_ret = loopback_tcpc(SOCK_TCPS, gDATABUF, destip, destport);
|
//loopback_ret = loopback_tcpc(SOCK_TCPS, gDATABUF, destip, destport);
|
||||||
//if(loopback_ret < 0) printf("loopback ret: %ld\r\n", loopback_ret); // TCP Socket Error code
|
//if(loopback_ret < 0) printf("loopback ret: %ld\r\n", loopback_ret); // TCP Socket Error code
|
||||||
|
|
||||||
//Shouldn't use it here
|
//Here every 1sec
|
||||||
/*
|
if((millis()-timer_tick_1sec)> 1000)
|
||||||
if((millis()-timer_link_1sec)> 1000)
|
|
||||||
{
|
{
|
||||||
//here every 1 sec
|
//here every 1 sec
|
||||||
timer_link_1sec = millis();
|
timer_tick_1sec = millis();
|
||||||
if(wizphy_getphylink() == PHY_LINK_ON)
|
//To restore GPIO state on start-up application
|
||||||
|
if(blynk_restore_connection)
|
||||||
{
|
{
|
||||||
led1_high();
|
if(is_blynk_connection_available())
|
||||||
}
|
{
|
||||||
else
|
blynk_restore_connection = 0;
|
||||||
{
|
//Requests Server to re-send current values for all widgets
|
||||||
led1_low();
|
PRINTF("++blynk_syncAll event\r\n"); //Just for debug
|
||||||
|
blynk_syncAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user