cc3200: Add delays to allow the servers to start and stop properly.

This commit is contained in:
Daniel Campora 2015-04-27 21:11:03 +02:00
parent d34c4784a5
commit 9fbc265eb8

View File

@ -87,31 +87,30 @@ void TASK_Servers (void *pvParameters) {
for ( ;; ) {
if (servers_data.enabled) {
if (servers_data.do_disable) {
// disable network services
telnet_disable();
ftp_disable();
// now clear the flags
servers_data.do_disable = false;
servers_data.enabled = false;
}
else {
if (cycle) {
telnet_run();
}
else {
ftp_run();
}
}
}
else if (servers_data.do_enable) {
if (servers_data.do_enable) {
// enable network services
telnet_enable();
ftp_enable();
// now set/clear the flags
servers_data.enabled = true;
servers_data.do_enable = false;
servers_data.do_disable = false;
}
else if (servers_data.enabled && servers_data.do_disable) {
// disable network services
telnet_disable();
ftp_disable();
// now clear the flags
servers_data.do_disable = false;
servers_data.enabled = false;
servers_data.do_enable = false;
}
if (cycle) {
telnet_run();
}
else {
ftp_run();
}
// move to the next cycle
@ -125,6 +124,7 @@ void TASK_Servers (void *pvParameters) {
void servers_start (void) {
servers_data.do_disable = false;
servers_data.do_enable = true;
HAL_Delay (SERVERS_CYCLE_TIME_MS * 5);
}
void servers_stop (void) {
@ -133,6 +133,7 @@ void servers_stop (void) {
do {
HAL_Delay (SERVERS_CYCLE_TIME_MS);
} while (servers_are_enabled());
HAL_Delay (SERVERS_CYCLE_TIME_MS * 5);
}
bool servers_are_enabled (void) {