add: pulse mode
add: editorconfig
This commit is contained in:
parent
679175f1a9
commit
0f342b4aa8
13 changed files with 151 additions and 70 deletions
src
17
src/main.c
17
src/main.c
|
@ -140,15 +140,20 @@ main(int argc, const char** argv)
|
|||
|
||||
/******************** START MAIN LOOP ********************/
|
||||
|
||||
for(;;)
|
||||
time_t timer = time(NULL);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
mg_mgr_poll(&mgr, 1000);
|
||||
if(!global_connection_mqtt)
|
||||
mg_mgr_poll(&mgr, 200);
|
||||
if(time(NULL) - timer >= 1)
|
||||
{
|
||||
LOG_DEBUG("mqtt connection is not open\n");
|
||||
connection_mqtt_connect(&mgr);
|
||||
if(!global_connection_mqtt)
|
||||
{
|
||||
connection_mqtt_connect(&mgr);
|
||||
}
|
||||
handler_loop(global_connection_mqtt);
|
||||
timer = time(NULL);
|
||||
}
|
||||
handler_loop(global_connection_mqtt);
|
||||
}
|
||||
|
||||
terminate(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue