Skip to content

Commit

Permalink
check wifi status while keep trying mqtt conn
Browse files Browse the repository at this point in the history
  • Loading branch information
librae8226 committed Apr 20, 2016
1 parent 533b364 commit 0dfc63e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/neurite.ino
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,13 @@ inline void stop_ticker_led(struct neurite_data_s *nd)
}
inline void start_ticker_led_breath(struct neurite_data_s *nd)
{
ticker_led.detach();
stop_ticker_led(nd);
ticker_led.attach_ms(50, ticker_led_breath);
}
inline void start_ticker_led_blink(struct neurite_data_s *nd)
{
ticker_mon.detach();
stop_ticker_led(nd);
ticker_led.attach_ms(50, ticker_led_blink);
}
Expand All @@ -551,6 +553,7 @@ inline void stop_ticker_mon(struct neurite_data_s *nd)
}
inline void start_ticker_mon(struct neurite_data_s *nd)
{
ticker_mon.detach();
stop_ticker_mon(nd);
ticker_mon.attach_ms(100, ticker_monitor_task, nd);
}
Expand All @@ -560,6 +563,7 @@ inline void stop_ticker_but(struct neurite_data_s *nd)
}
inline void start_ticker_but(struct neurite_data_s *nd)
{
ticker_but.detach();
stop_ticker_but(nd);
ticker_but.attach_ms(50, ticker_button_task, nd);
}
Expand Down Expand Up @@ -620,6 +624,7 @@ inline void stop_ticker_cmd(struct neurite_data_s *nd)

inline void start_ticker_cmd(struct neurite_data_s *nd)
{
ticker_cmd.detach();
stop_ticker_cmd(nd);
ticker_cmd.attach_ms(1, ticker_cmd_task, nd);
}
Expand Down Expand Up @@ -1073,7 +1078,7 @@ inline void neurite_cfg_worker(void)
server->handleClient();
break;
default:
log_err("unknown cfg state: %d\n\r", worker_st);
log_err("unknown cfg state: %d\n\r", cfg_st);
break;
}
}
Expand Down Expand Up @@ -1104,7 +1109,10 @@ inline void neurite_worker(void)
break;
case WORKER_ST_3:
if (!mqtt_check_status(nd)) {
mqtt_connect(nd);
if (!wifi_check_status(nd))
update_worker_state(WORKER_ST_0);
else
mqtt_connect(nd);
break;
}

Expand Down

0 comments on commit 0dfc63e

Please sign in to comment.