Compare commits

..

3 Commits

Author SHA1 Message Date
phyto
43a71bf468 DO WHAT THE FUCK YOU WANT 2019-07-30 21:20:33 +02:00
phyto
67aa367e1e increasing max temperature (canicule) 2019-07-30 21:19:44 +02:00
phyto
4a033432bf ending a ncurses proggy is not simple 2019-07-30 21:18:50 +02:00
7 changed files with 73 additions and 6 deletions

View File

@ -126,7 +126,7 @@ fclose(fp);
return 0; return 0;
} }
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
static void finish(int signal) static void finish(void)
{ {
endwin(); endwin();
fprintf(stderr, "end of pid %d\n", getpid()); fprintf(stderr, "end of pid %d\n", getpid());
@ -180,16 +180,18 @@ sleep(1);
initscr(); initscr();
nonl(); cbreak(); noecho(); nonl(); cbreak(); noecho();
keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */
atexit(finish);
sprintf(ligne, " Demonstrator pid:%d %s ", getpid(), device); sprintf(ligne, " Demonstrator pid:%d %s ", getpid(), device);
fond_ecran(ligne); fond_ecran(ligne);
traite_les_messages(serial_in, nbreloops, K); traite_les_messages(serial_in, nbreloops, K);
/* /*
* plop, on a fini, il faut restaurer la console * plop, on a fini, il faut restaurer la console
*/ */
finish(0); finish();
return 0; return 0;
} }

View File

@ -15,7 +15,7 @@ TMPFILE="/dev/shm/tmpdata"
echo $nbsamp echo $nbsamp
wc -l ${DATAFILE} wc -l ${DATAFILE}
tail -3000 < ${DATAFILE} > ${TMPFILE} tail -${nbsamp} < ${DATAFILE} > ${TMPFILE}
gnuplot << __EOC__ gnuplot << __EOC__
set term png size 1600,800 set term png size 1600,800
@ -27,7 +27,7 @@ set title "* Temperatures du Phytotron *"
set xdata time set xdata time
set timefmt "%s" set timefmt "%s"
set format x "%b %d\n%H:%M" set format x "%b %d\n%H:%M"
set yrange [ 0.0 : 30.0 ] set yrange [ 0.0 : 40.0 ]
plot "${TMPFILE}" using 1:3 title " inside" with lines, \ plot "${TMPFILE}" using 1:3 title " inside" with lines, \
"${TMPFILE}" using 1:4 title "ambient" with lines "${TMPFILE}" using 1:4 title "ambient" with lines
__EOC__ __EOC__

View File

@ -133,6 +133,8 @@ if (1 != foo)
{ {
fprintf(stderr, "%s : byte %d rd %d errno %d\n", fprintf(stderr, "%s : byte %d rd %d errno %d\n",
__func__, byte, foo, errno); __func__, byte, foo, errno);
/* XXX */
exit(1);
return -1; return -1;
} }
return (int)byte; return (int)byte;

View File

@ -3,6 +3,22 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/ */
/**********************************************************************
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
**********************************************************************/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <strings.h>

View File

@ -4,6 +4,22 @@
* ncurses seven segment display * ncurses seven segment display
*/ */
/**********************************************************************
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
**********************************************************************/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -1,3 +1,18 @@
/**********************************************************************
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
**********************************************************************/
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,9 +1,25 @@
/* /*
* DD2 Monitoring * DD2 Monitoring
* *
* ncurses seven segment display * ncurses linear vumeter display
*/ */
/**********************************************************************
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
**********************************************************************/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <strings.h>