changeset 60:bbdf5642a7b7

Convert \r\n -> \n now _write() DTRT.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 08 Apr 2013 23:11:35 +0930
parents 488085e0c7e1
children 9c5db7fee912
files tempctrl.c
diffstat 1 files changed, 46 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/tempctrl.c	Mon Apr 08 23:10:47 2013 +0930
+++ b/tempctrl.c	Mon Apr 08 23:11:35 2013 +0930
@@ -239,7 +239,7 @@
 	    break;
 
 	default:
-	    printf("\r\nUnknown state %c, going to idle\n", currstate);
+	    printf("\nUnknown state %c, going to idle\n", currstate);
 	    nextstate = 'i';
 	    break;
     }
@@ -295,7 +295,7 @@
 	p += fmttemp(p, "Fm", tempt, ", ");
 	p += fmttemp(p, "Fr", fridge_temp, ", ");
 	p += fmttemp(p, "Am", ambient_temp, ", ");
-	sprintf(p, "St: %s, Fl: %s%s\r\n", state2long(currstate), 
+	sprintf(p, "St: %s, Fl: %s%s\n", state2long(currstate), 
 		forced ? "F" : "", 
 		stale ? "S" : "");
 	fputs(linebuf, stdout);
@@ -339,7 +339,7 @@
 tempctrl_load_or_init_settings(void) {
     /* XXX: todo */
     if (!flashreadblock(0, sizeof(settings), &settings)) {
-	fputs("CRC fails, loading defaults\r\n", stdout);
+	fputs("CRC fails, loading defaults\n", stdout);
 	tempctrl_default_settings();
 	tempctrl_write_settings();
     }
@@ -374,7 +374,7 @@
 	    break;
 
 	default:
-	    printf("Unknown state %c, setting idle\r\n", state);
+	    printf("Unknown state %c, setting idle\n", state);
 	    /* fallthrough */
 
 	case 'i':
@@ -403,37 +403,37 @@
     uint8_t 	ROM[8];
     
     if (argc < 1) {
-	printf("Unable to parse tc subcommand\r\n");
+	printf("Unable to parse tc subcommand\n");
 	return;
     }
 	
     if (!strcasecmp(argv[0], "help")) {
-	printf("tc help         This help\r\n"
-	       "tc save         Save settings to EEPROM\r\n"
-	       "tc load         Load or default settings from EEPROM\r\n"
-	       "tc dflt         Load defaults from flash\r\n"
-	       "tc list         List current settings\r\n"
-	       "tc mode [achin] Change control mode, must be one of\r\n"
-	       "                 a    Auto\r\n"
-	       "                 c    Always cool\r\n"
-	       "                 h    Always heat\r\n"
-	       "                 i    Always idle\r\n"
-	       "                 n    Like idle but don't log anything\r\n"
-	       "tc X Y          Set X to Y where X is one of\r\n"
-	       "                 targ Target temperature\r\n"
-	       "                 hys  Hysteresis range\r\n"
-	       "                 mhov Minimum heat overshoot\r\n"
-	       "                 mcov Minimum cool overshoot\r\n"
-	       "                 mcon Minimum cool on time\r\n"
-	       "                 mcoff        Minimum cool off time\r\n"
-	       "                 mhin Minimum heat on time\r\n"
-	       "                 mhoff        Minimum heat off time\r\n"
-	       "tc A B           Set temperature sensor ID\r\n"
-	       "                 Where A is ferm, frg or amb\r\n"
-	       "                 and B is of the form xx:xx:xx:xx:xx:xx:xx:xx\r\n"
-	       "\r\n"
-	       "                Times are in seconds\r\n"
-	       "                Temperatures are in hundredths of degrees Celcius\r\n"
+	printf("tc help         This help\n"
+	       "tc save         Save settings to EEPROM\n"
+	       "tc load         Load or default settings from EEPROM\n"
+	       "tc dflt         Load defaults from flash\n"
+	       "tc list         List current settings\n"
+	       "tc mode [achin] Change control mode, must be one of\n"
+	       "                 a    Auto\n"
+	       "                 c    Always cool\n"
+	       "                 h    Always heat\n"
+	       "                 i    Always idle\n"
+	       "                 n    Like idle but don't log anything\n"
+	       "tc X Y          Set X to Y where X is one of\n"
+	       "                 targ Target temperature\n"
+	       "                 hys  Hysteresis range\n"
+	       "                 mhov Minimum heat overshoot\n"
+	       "                 mcov Minimum cool overshoot\n"
+	       "                 mcon Minimum cool on time\n"
+	       "                 mcoff        Minimum cool off time\n"
+	       "                 mhin Minimum heat on time\n"
+	       "                 mhoff        Minimum heat off time\n"
+	       "tc A B           Set temperature sensor ID\n"
+	       "                 Where A is ferm, frg or amb\n"
+	       "                 and B is of the form xx:xx:xx:xx:xx:xx:xx:xx\n"
+	       "\n"
+	       "                Times are in seconds\n"
+	       "                Temperatures are in hundredths of degrees Celcius\n"
 	    );
 	return;
     }
@@ -451,14 +451,14 @@
 	return;
     }
     if (!strcasecmp(argv[0], "list")) {
-	printf("Fermenter ROM ID %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\r\n"
-	       "Fridge ROM ID    %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\r\n"
-	       "Ambient ROM ID   %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\r\n"
-	       "Mode - %c, Target - %d, Hystersis - %d\r\n"
-	       "Min heat overshoot - %d, Min cool overshoot - %d\r\n"
-	       "Min cool on time - %d, Min cool off time - %d\r\n"
-	       "Min heat on time - %d, Min heat off time - %d\r\n"
-	       "Cool: Port %c Pin %d Inv %d, Heat: Port %c Pin %d Inv %d\r\n"
+	printf("Fermenter ROM ID %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n"
+	       "Fridge ROM ID    %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n"
+	       "Ambient ROM ID   %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n"
+	       "Mode - %c, Target - %d, Hystersis - %d\n"
+	       "Min heat overshoot - %d, Min cool overshoot - %d\n"
+	       "Min cool on time - %d, Min cool off time - %d\n"
+	       "Min heat on time - %d, Min heat off time - %d\n"
+	       "Cool: Port %c Pin %d Inv %d, Heat: Port %c Pin %d Inv %d\n"
 	       "Log format: %s\n",
 	       settings.fermenter_ROM[0], settings.fermenter_ROM[1], settings.fermenter_ROM[2], settings.fermenter_ROM[3], 	
 	       settings.fermenter_ROM[4], settings.fermenter_ROM[5], settings.fermenter_ROM[6], settings.fermenter_ROM[7], 	
@@ -478,7 +478,7 @@
     }
     if (!strcasecmp(argv[0], "mode")) {
 	if (argc < 2) {
-	    fputs("Incorrect number of arguments\r\n", stdout);
+	    fputs("Incorrect number of arguments\n", stdout);
 	    return;
 	}
 	
@@ -492,7 +492,7 @@
 		break;
 		    
 	    default:
-		printf("Unknown mode character '%c'\r\n", argv[1][0]);
+		printf("Unknown mode character '%c'\n", argv[1][0]);
 		break;
 	}
 	return;
@@ -501,14 +501,14 @@
 	!strcasecmp(argv[0], "frg") ||
 	!strcasecmp(argv[0], "amb")) {
 	if (argc < 2) {
-	    fputs("Incorrect number of arguments\r\n", stdout);
+	    fputs("Incorrect number of arguments\n", stdout);
 	    return;
 	}
 	
 	if (sscanf(argv[1], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
 		   &ROM[0], &ROM[1], &ROM[2], &ROM[3],
 		   &ROM[4], &ROM[5], &ROM[6], &ROM[7]) != 8) {
-	    printf("Unable to parse ROM ID\r\n");
+	    printf("Unable to parse ROM ID\n");
 	} else {
 	    if (!strcasecmp(argv[0], "ferm"))
 		memcpy(&settings.fermenter_ROM, ROM, sizeof(ROM));
@@ -534,12 +534,12 @@
     /* Handle setting the multitude of variables
      * It's last to simplify things */
     if (argc < 3) {
-	fputs("Incorrect number of arguments for variable/value\r\n", stdout);
+	fputs("Incorrect number of arguments for variable/value\n", stdout);
 	return;
     }
     
     if (sscanf(argv[2], "%hd", &data) != 1) {
-	printf("Unable to parse value for variable\r\n");
+	printf("Unable to parse value for variable\n");
 	return;
     }
 
@@ -560,7 +560,7 @@
     } else if (!strcasecmp(argv[1], "mhoff")) {
 	settings.minheatofftime = data;
     } else {
-	printf("Unknown setting\r\n");
+	printf("Unknown setting\n");
     }
 }