diff --git a/src/netdaemon/scripts/acc b/src/netdaemon/scripts/acc new file mode 100644 index 0000000..68bfe9d --- /dev/null +++ b/src/netdaemon/scripts/acc @@ -0,0 +1,4 @@ +HTTP/1.1 200 OK +Access-Control-Allow-Origin: * +Content-type: text/html + diff --git a/src/netdaemon/scripts/runSpeedCtrl b/src/netdaemon/scripts/runSpeedCtrl new file mode 100755 index 0000000..cc442a0 --- /dev/null +++ b/src/netdaemon/scripts/runSpeedCtrl @@ -0,0 +1,11 @@ +#!/bin/bash + +while true; do + NewVal=$((cat /home/eddy/bin/acc; /home/eddy/bin/SEWcontrol) | nc -w0 -lp 8080 | grep GET) + E=$(echo $NewVal | sed 's|.*setspeed=\([0-9\.]\+\).*|\1|' | grep "^[0-9]*[.]*[0-9]*$") +#' + if [ "x$E" != "x" ]; then + #echo "SPEED=$E" + (( E > 299 )) && (( E < 1301 )) && /home/eddy/bin/SEWcontrol -s $E || /home/eddy/bin/SEWcontrol -0 + fi +done diff --git a/src/netdaemon/scripts/rundaemons b/src/netdaemon/scripts/rundaemons new file mode 100755 index 0000000..5e70bd7 --- /dev/null +++ b/src/netdaemon/scripts/rundaemons @@ -0,0 +1,5 @@ +#!/bin/bash +/home/eddy/bin/serialsock -d /dev/ttyUSB0 -l /tmp/serv.log & +sleep 1 +/home/eddy/bin/netdaemon -g -s /tmp/www/ -N /home/eddy/tempadj.txt /tmp/netdaemon.log & +/home/eddy/bin/runSpeedCtrl & diff --git a/src/netdaemon/socket.c b/src/netdaemon/socket.c index 1f4c4b3..5396ef9 100644 --- a/src/netdaemon/socket.c +++ b/src/netdaemon/socket.c @@ -402,8 +402,7 @@ static void daemon_(int sock){ tgot = dtime(); process_T(); // get new temperatures & throw out bad results for(i = 0; i <= NCTRLR_MAX; ++i){ // scan over controllers - int N, p; - for(N = 0; N <= NCHANNEL_MAX; ++N) for(p = 0; p < 2; ++p){ + for(int N = 0; N <= NCHANNEL_MAX; ++N) for(int p = 0; p < 2; ++p){ double T = t_last[p][N][i]; char **buf; size_t *len; diff --git a/src/netdaemon/term.c b/src/netdaemon/term.c index 8580424..59d40c1 100644 --- a/src/netdaemon/term.c +++ b/src/netdaemon/term.c @@ -233,7 +233,10 @@ int poll_sensors(int N){ } } } - return 1; + if(N && ngot < MIN_SENSORS_AMOUNT){ // too little sensors for mirror controller + send_cmd(N, CMD_REINIT_SENSORS); // reinit sensors + } + return ngot; } /** @@ -270,6 +273,7 @@ int check_sensors(){ ++found; green(_("Found controller #%d\n"), i); LOGMSG("Found controller #%d", i); + send_cmd(i, CMD_LOWSPEED); break; } } diff --git a/src/netdaemon/term.h b/src/netdaemon/term.h index 42bdb43..5a9aa85 100644 --- a/src/netdaemon/term.h +++ b/src/netdaemon/term.h @@ -30,8 +30,8 @@ #define WAIT_TMOUT (0.5) // Main controller polling timeout - 1 second #define POLLING_TMOUT (1.0) -// Thermal polling timeout: 1.5 seconds -#define T_POLLING_TMOUT (1.5) +// Thermal polling timeout: 3 seconds +#define T_POLLING_TMOUT (3) // T measurement time interval - 30 seconds #define T_INTERVAL (30.0) // interval (in seconds) to remove too old measurements (if sensor not available now) @@ -39,13 +39,18 @@ // amount of measurement to plot mean graphs #define GRAPHS_AMOUNT (15) +// minimal amount of working sensors for one controller (if less - call "reinit" command) +#define MIN_SENSORS_AMOUNT (6) + // Protocol #define CMD_SENSORS_OFF 'F' #define CMD_SENSORS_OFF_LOCAL 'f' +#define CMD_REINIT_SENSORS 'I' #define CMD_VOLTAGE 'K' #define CMD_PING 'P' #define CMD_MEASURE_T 'T' #define CMD_MEASURE_LOCAL 't' +#define CMD_LOWSPEED 'V' #define ANS_PONG "PONG" extern time_t tmeasured[2][NCHANNEL_MAX+1][NCTRLR_MAX+1]; diff --git a/src/netdaemon/www/fans.html b/src/netdaemon/www/fans.html new file mode 100644 index 0000000..b8dce18 --- /dev/null +++ b/src/netdaemon/www/fans.html @@ -0,0 +1,74 @@ + + +
+ ++ New speed: + + +
+ Set speed:
+
+
+
+
+
+ Current: A. Speed: rpm. +
+ +