Commit eefd8984 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Add trigger section to control file.

Use immediate trigger in test.ctrl files.
Fix some bugs
parent 966b1736
...@@ -129,8 +129,7 @@ TARGETS:= $$($(DIR)_TMPTARGETS) $$(TARGETS) ...@@ -129,8 +129,7 @@ TARGETS:= $$($(DIR)_TMPTARGETS) $$(TARGETS)
DIR := $(DIR) DIR := $(DIR)
endef endef
CFLAGS := -pthread -D_GNU_SOURCE -Icommon -Icommon/include -Icontroller -Iconsole/console -Iinclude
CFLAGS := -pthread -Icommon -Icommon/include -Icontroller -Iconsole/console -Iinclude
LDFLAGS := -pthread -Lcommon/lib -Lcontroller/lib -Lconsole/console/lib -Llib -Wl,--as-needed LDFLAGS := -pthread -Lcommon/lib -Lcontroller/lib -Lconsole/console/lib -Llib -Wl,--as-needed
VPATH += common/lib controller/lib console/console/lib lib VPATH += common/lib controller/lib console/console/lib lib
VPATH += include VPATH += include
......
...@@ -527,7 +527,7 @@ int trace_handle_recv(struct trace *trace) ...@@ -527,7 +527,7 @@ int trace_handle_recv(struct trace *trace)
int trace_handle(struct trace *trace, fd_set *set) int trace_handle(struct trace *trace, fd_set *set)
{ {
if (!set || FD_ISSET(trace->fd, set)) { if (trace->fd >= 0 && (!set || FD_ISSET(trace->fd, set))) {
trace_handle_recv(trace); trace_handle_recv(trace);
} }
return 0; return 0;
......
...@@ -29,8 +29,9 @@ ...@@ -29,8 +29,9 @@
#include <netdb.h> #include <netdb.h>
#include <errno.h> #include <errno.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#ifdef __linux__ #ifdef __linux__
#include <linux/sockios.h> #include <linux/sockios.h>
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -189,7 +188,7 @@ static int status_reconnect(struct status *status) ...@@ -189,7 +188,7 @@ static int status_reconnect(struct status *status)
{ {
int fd; int fd;
printf("reconnect\n"); printf("reconnect: %s\n", status->ident);
fd = tcp_connect(status->host, status->port); fd = tcp_connect(status->host, status->port);
if (fd >= 0) { if (fd >= 0) {
poll_add(fd, POLLIN | POLLERR); poll_add(fd, POLLIN | POLLERR);
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
*/ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define _GNU_SOURCE
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <pthread.h> #include <pthread.h>
......
...@@ -22,3 +22,4 @@ screen -S console -X screen -t console_azel console_azel ...@@ -22,3 +22,4 @@ screen -S console -X screen -t console_azel console_azel
screen -S console -X screen -t console_manual console_manual screen -S console -X screen -t console_manual console_manual
screen -S console -X screen -t console_sattracker console_sattracker screen -S console -X screen -t console_sattracker console_sattracker
screen -S console -X screen -t console_weather console_weather screen -S console -X screen -t console_weather console_weather
screen -S console -X screen -t console_httpd console_httpd
frequency 250 frequency 250
trigger {
{ "immediate" }
}
blocks { blocks {
{ "random", "noise" } { "random", "noise" }
{ "filter_iir", "iir" } { "filter_iir", "iir" }
......
frequency 100 frequency 100
trigger {
{ "immediate" }
}
blocks { blocks {
{ "gain", "gain" } { "gain", "gain" }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "limit", "limit" } { "limit", "limit" }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "matrix_2x2", "matrix" } { "matrix_2x2", "matrix" }
......
frequency 100 frequency 100
trigger {
{ "immediate" }
}
blocks { blocks {
{ "not", "not" } { "not", "not" }
......
frequency 100 frequency 100
trigger {
{ "immediate" }
}
blocks { blocks {
{ "pid_aw", "pid" } { "pid_aw", "pid" }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "quantize", "quantize" } { "quantize", "quantize" }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "rangecheck", "rangecheck" } { "rangecheck", "rangecheck" }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "servo_state", "servo_state" } { "servo_state", "servo_state" }
......
...@@ -101,6 +101,8 @@ static void setpoint_generator_1d_calculate(struct controller_block *spg) ...@@ -101,6 +101,8 @@ static void setpoint_generator_1d_calculate(struct controller_block *spg)
cur_v = priv->cur_v; cur_v = priv->cur_v;
if (*priv->reset) { if (*priv->reset) {
struct command_entry entry;
priv->cmd_x = *priv->reset_x; priv->cmd_x = *priv->reset_x;
priv->cur_x = priv->cmd_x; priv->cur_x = priv->cmd_x;
priv->cur_done = true; priv->cur_done = true;
...@@ -108,6 +110,9 @@ static void setpoint_generator_1d_calculate(struct controller_block *spg) ...@@ -108,6 +110,9 @@ static void setpoint_generator_1d_calculate(struct controller_block *spg)
priv->cmd_v = 0.0; priv->cmd_v = 0.0;
priv->cur_v = 0.0; priv->cur_v = 0.0;
priv->id = COMMAND_ID_NONE; priv->id = COMMAND_ID_NONE;
controller_command_queue_read(priv->command, &entry);
return; return;
} }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "setpoint_generator_1d", "spg", "spg", "na" } { "setpoint_generator_1d", "spg", "spg", "na" }
......
...@@ -233,6 +233,8 @@ static void setpoint_generator_3d_calculate(struct controller_block *spg) ...@@ -233,6 +233,8 @@ static void setpoint_generator_3d_calculate(struct controller_block *spg)
t_max_a = priv->t_max_a; t_max_a = priv->t_max_a;
if (*priv->reset) { if (*priv->reset) {
struct command_entry entry;
priv->cmd_x = *priv->reset_x; priv->cmd_x = *priv->reset_x;
cur_x = priv->cmd_x; cur_x = priv->cmd_x;
priv->cur_done = true; priv->cur_done = true;
...@@ -248,6 +250,8 @@ static void setpoint_generator_3d_calculate(struct controller_block *spg) ...@@ -248,6 +250,8 @@ static void setpoint_generator_3d_calculate(struct controller_block *spg)
priv->start_t = 0; priv->start_t = 0;
priv->id = COMMAND_ID_NONE; priv->id = COMMAND_ID_NONE;
controller_command_queue_read(priv->command, &entry);
goto set_output; goto set_output;
} }
......
frequency 10 frequency 10
trigger {
{ "immediate" }
}
blocks { blocks {
{ "setpoint_generator_3d", "spg", "spg", "na" } { "setpoint_generator_3d", "spg", "spg", "na" }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment