thermferm/rdconfig.c

changeset 66
805f1d285acd
parent 58
e8e7b46b705b
child 69
df5d983dab1b
--- a/thermferm/rdconfig.c	Thu Jun 19 15:49:29 2014 +0200
+++ b/thermferm/rdconfig.c	Fri Jun 20 17:42:36 2014 +0200
@@ -22,7 +22,6 @@
 
 #include "thermferm.h"
 
-#ifdef HAVE_WIRINGPI_H
 
 bool		debug = FALSE;
 static char	*mypath;
@@ -32,10 +31,12 @@
 
 
 
-static int getstr(char **);
-static int getint(char **);
+//static int getstr(char **);
+//static int getint(char **);
 static int getw1(char **);
+#ifdef HAVE_WIRINGPI_H
 static int getrcs(char **);
+#endif
 static int getuch(char **);
 static int getfloat(char **);
 //static int getbyt(char **);
@@ -49,10 +50,12 @@
  */
 key_list keytab[] = {
     {(char *)"w1therm",			getw1,		(char **)&Config.w1therms},
+#ifdef HAVE_WIRINGPI_H
     {(char *)"lcd_cols",		getint,		(char **)&Config.lcd_cols},
     {(char *)"lcd_rows",		getint,		(char **)&Config.lcd_rows},
     {(char *)"tx433",			getint,		(char **)&Config.tx433},
     {(char *)"rcswitch",		getrcs,		(char **)&Config.rcswitch},
+#endif
     {(char *)"cs_mode",			getuch,		(char **)&Config.cs_mode},
     {(char *)"cs_beerSet",		getfloat,	(char **)&Config.cs_beerSet},
     {(char *)"cs_fridgeSet",		getfloat,	(char **)&Config.cs_fridgeSet},
@@ -71,7 +74,9 @@
 void killconfig(void)
 {
     w1_therm	*tmp1, *old1;
+#ifdef HAVE_WIRINGPI_H
     rc_switch	*tmp2, *old2;
+#endif
 
     if (Config.name)
 	free(Config.name);
@@ -90,6 +95,7 @@
     Config.w1therms = NULL;
     Config.my_port = 6554;
 
+#ifdef HAVE_WIRINGPI_H
     Config.lcd_cols = 16;
     Config.lcd_rows = 2;
     Config.tx433 = -1;
@@ -105,6 +111,7 @@
 	free(tmp2);
     }
     Config.rcswitch = NULL;
+#endif
 
     defaultControlSettings();
     defaultControlConstants();
@@ -117,7 +124,9 @@
     int		rc = 0;
     FILE	*fp;
     w1_therm    *tmp1;
+#ifdef HAVE_WIRINGPI_H
     rc_switch   *tmp2;
+#endif
 
     if (getenv((char *)"USER") == NULL) {
 	mypath = xstrcpy((char *)"/root");
@@ -138,6 +147,7 @@
     fprintf(fp, "# Configuration file for thermferm %s\n", VERSION);
     fprintf(fp, "\n");
 
+#ifdef HAVE_WIRINGPI_H
     fprintf(fp, "# Radio controllers 433 MHz.\n");
     fprintf(fp, "#\n");
     fprintf(fp, "tx433	%d\n", Config.tx433);
@@ -148,6 +158,7 @@
     fprintf(fp, "lcd_cols	%d\n", Config.lcd_cols);
     fprintf(fp, "lcd_rows	%d\n", Config.lcd_rows);
     fprintf(fp, "\n");
+#endif
 
     fprintf(fp, "# DS18B20 temperature sensors on the 1-wire bus.\n");
     fprintf(fp, "#\n");
@@ -157,6 +168,7 @@
     }
     fprintf(fp, "\n");
 
+#ifdef HAVE_WIRINGPI_H
     fprintf(fp, "# RC switches that we want to control.\n");
     fprintf(fp, "#\n");
     fprintf(fp, "# kwd		address	alias\n");
@@ -164,6 +176,7 @@
 	fprintf(fp, "rcswitch	%s	%s\n", tmp2->address, tmp2->alias);
     }
     fprintf(fp, "\n");
+#endif
 
     fprintf(fp, "# Control Settings.\n");
     fprintf(fp, "#\n");
@@ -286,6 +299,7 @@
 
 
 
+/*
 static int getstr(char **dest)
 {
     if (debug)
@@ -294,9 +308,11 @@
     *dest = xstrcpy(v);
     return 0;
 }
+*/
 
 
 
+/*
 static int getint(char **dest)
 {
     if (debug)
@@ -308,6 +324,7 @@
 	*((int*)dest)=atoi(v);
     return 0;
 }
+*/
 
 
 
@@ -362,6 +379,7 @@
 
 
 
+#ifdef HAVE_WIRINGPI_H
 static int getrcs(char **dest)
 {
     char        *p, *q = NULL, *r = NULL;
@@ -399,6 +417,7 @@
 
     return 0;
 }
+#endif
 
 
 
@@ -467,5 +486,4 @@
 }
 */
 
-#endif
 

mercurial