brewco/setup.c

changeset 458
43a8ecb53637
parent 450
8fe99759c27f
child 459
1f88be70f253
--- a/brewco/setup.c	Sat Dec 12 21:47:04 2015 +0100
+++ b/brewco/setup.c	Sat Dec 12 22:17:25 2015 +0100
@@ -209,7 +209,7 @@
 
 void editPID(pid_var *pid)
 {
-    int		index = 1, key, val;
+    int		idx = 1, key, val;
     char	pmpt[81];
     double	Kp, Ki, Kd;
 
@@ -220,14 +220,14 @@
 	prompt(0, NULL);
 	prompt(135, NULL);
 
-	if (index == 1)
+	if (idx == 1)
 	    prompt(402, NULL);
-	else if (index == 5)
+	else if (idx == 5)
 	    prompt(404, NULL);
 	else
 	    prompt(403, NULL);
 
-	switch (index) {
+	switch (idx) {
 	    case 1:	snprintf(pmpt, Config.lcd_cols + 1, "PID Kp: %5.2f", PID_getKp(pid));
 			break;
 	    case 2:	snprintf(pmpt, Config.lcd_cols + 1, "PID Ki: %5.2f", PID_getKi(pid));
@@ -248,10 +248,10 @@
 	    return;
     	}
 
-    	if ((key == KEY_UP) && (index > 1))
-	    index--;
-    	if ((key == KEY_DOWN) && (index < 5))
-	    index++;
+    	if ((key == KEY_UP) && (idx > 1))
+	    idx--;
+    	if ((key == KEY_DOWN) && (idx < 5))
+	    idx++;
 
     	if (key == KEY_ENTER) {
 
@@ -259,7 +259,7 @@
 	    Ki = PID_getKi(pid);
 	    Kd = PID_getKd(pid);
 
-	    switch(index) {
+	    switch(idx) {
 		case 1:	editDouble(&Kp, 0.5, 50, (char *)"PID Kp");
 			PID_setTunings(pid, Kp, Ki, Kd);
 			break;
@@ -287,7 +287,7 @@
 void editSensor(char *uuid, char *text)
 {
     char		pmpt[81];
-    int			i, old, choices, index = 1, key;
+    int			i, old, choices, idx = 1, key;
     devices_list	*device;
 
     if (debug)
@@ -329,13 +329,13 @@
 	}
 	prompt(200, pmpt);	/* Display current sensor */
 	i = 1;
-	if (index == 1) {
+	if (idx == 1) {
 	    snprintf(pmpt, Config.lcd_cols + 1, "N/A");
 	} else {
 	    for (device = Config.devices; device; device = device->next) {
 		if (device->direction == DEVDIR_IN_ANALOG) {
 		    i++;
-		    if (i == index) {
+		    if (i == idx) {
 			snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description);
 		    }
 		}
@@ -346,9 +346,9 @@
 
 	if (choices == 1)
 	    prompt(405, NULL);
-	else if (index == 1)
+	else if (idx == 1)
 	    prompt(402, NULL);
-	else if (index == choices)
+	else if (idx == choices)
 	    prompt(404, NULL);
 	else
 	    prompt(403, NULL);
@@ -360,33 +360,33 @@
 	    return;
 	}
 
-	if ((key == KEY_UP) && (index > 1))
-	    index--;
-	if ((key == KEY_DOWN) && (index < choices))
-	    index++;
+	if ((key == KEY_UP) && (idx > 1))
+	    idx--;
+	if ((key == KEY_DOWN) && (idx < choices))
+	    idx++;
 	
-	if ((key == KEY_ENTER) && (index != old)) {
+	if ((key == KEY_ENTER) && (idx != old)) {
 	    /*
 	     * Select new sensor.
 	     */
-	    if (index == 1) {
+	    if (idx == 1) {
 		/*
 		 * Disable the sensor
 		 */
 		strncpy(uuid, (char *)"00000000-0000-0000-0000-000000000000", 36);
-		old = index;
+		old = idx;
 	    } else {
 		i = 1;
 		for (device = Config.devices; device; device = device->next) {
 		    if (device->direction == DEVDIR_IN_ANALOG) {
 			i++;
-			if (i == index) {
+			if (i == idx) {
 			    strncpy(uuid, device->uuid, 36);
 			    break;
 			}
 		    }
 		}
-		old = index;
+		old = idx;
 	    }
 	}
     }
@@ -397,7 +397,7 @@
 void editRelay(char *uuid, char *text)
 {
     char                pmpt[81];
-    int                 i, old, choices, index = 1, key;
+    int                 i, old, choices, idx = 1, key;
     devices_list        *device;
 
     if (debug)
@@ -439,13 +439,13 @@
         }
         prompt(200, pmpt);      /* Display current relay */
         i = 1;
-        if (index == 1) {
+        if (idx == 1) {
             snprintf(pmpt, Config.lcd_cols + 1, "N/A");
         } else {
             for (device = Config.devices; device; device = device->next) {
                 if (device->direction == DEVDIR_OUT_ANALOG) {
                     i++;
-                    if (i == index) {
+                    if (i == idx) {
                         snprintf(pmpt, Config.lcd_cols + 1, "%s", device->description);
                     }
                 }
@@ -455,9 +455,9 @@
 
         if (choices == 1)
             prompt(405, NULL);
-        else if (index == 1)
+        else if (idx == 1)
             prompt(402, NULL);
-        else if (index == choices)
+        else if (idx == choices)
             prompt(404, NULL);
         else
             prompt(403, NULL);
@@ -469,33 +469,33 @@
             return;
         }
 
-        if ((key == KEY_UP) && (index > 1))
-            index--;
-        if ((key == KEY_DOWN) && (index < choices))
-            index++;
+        if ((key == KEY_UP) && (idx > 1))
+            idx--;
+        if ((key == KEY_DOWN) && (idx < choices))
+            idx++;
 
-        if ((key == KEY_ENTER) && (index != old)) {
+        if ((key == KEY_ENTER) && (idx != old)) {
             /*
              * Select new output.
              */
-            if (index == 1) {
+            if (idx == 1) {
                 /*
                  * Disable the output
                  */
                 strncpy(uuid, (char *)"00000000-0000-0000-0000-000000000000", 36);
-                old = index;
+                old = idx;
             } else {
                 i = 1;
                 for (device = Config.devices; device; device = device->next) {
                     if (device->direction == DEVDIR_OUT_ANALOG) {
                         i++;
-                        if (i == index) {
+                        if (i == idx) {
                             strncpy(uuid, device->uuid, 36);
                             break;
                         }
                     }
                 }
-                old = index;
+                old = idx;
             }
         }
     }
@@ -508,7 +508,7 @@
  */
 void editUnit(units_list *unit)
 {
-    int		index = 1, key;
+    int		idx = 1, key;
     char	pmpt[81], *uuid;
     uLong	ocrc, ncrc;
 
@@ -524,14 +524,14 @@
 	prompt(0, NULL);
 	prompt(131, NULL);
 
-	if (index == 1)
+	if (idx == 1)
 	    prompt(402, NULL);
-	else if (index == 21)
+	else if (idx == 21)
 	    prompt(404, NULL);
 	else
 	    prompt(403, NULL);
 
-	switch (index) {				//   12345678901234567890
+	switch (idx) {				//   12345678901234567890
 	    case 1:	snprintf(pmpt, Config.lcd_cols + 1, "Unit name:");
 			prompt(200, pmpt);
 			snprintf(pmpt, Config.lcd_cols + 1, "%s", unit->name);
@@ -609,13 +609,13 @@
 	    return;
 	}
 
-	if ((key == KEY_UP) && (index > 1))
-	    index--;
-	if ((key == KEY_DOWN) && (index < 21))
-	    index++;
+	if ((key == KEY_UP) && (idx > 1))
+	    idx--;
+	if ((key == KEY_DOWN) && (idx < 21))
+	    idx++;
 
 	if (key == KEY_ENTER) {
-	    switch(index) {
+	    switch(idx) {
 		case 1:		// name
 				break;
 		case 2:		uuid = xstrcpy(unit->hlt_sensor.uuid);

mercurial