Subversion Repositories heating

Rev

Rev 8 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8 Rev 9
Line 103... Line 103...
103
 
103
 
104
			sleep(1);
104
			sleep(1);
105
			continue;
105
			continue;
106
		}
106
		}
107
 
107
 
108
		if (pos < (sizeof(buf) - 1))
108
		if (pos < (int)(sizeof(buf) - 1))
109
		{
109
		{
110
			buf[pos] = ch;
110
			buf[pos] = ch;
111
			buf[pos+1] = 0;
111
			buf[pos+1] = 0;
112
			pos++;
112
			pos++;
113
 
113
 
114
			if (ch == 0x0d)
114
			if (ch == 0x0d)
115
			{
115
			{
-
 
116
				debug("Templogger: " + ToString(buf));
-
 
117
 
116
				if (strstr(buf, "Templog 2.5") != NULL)
118
				if (strstr(buf, "Templog 2.5") != NULL)
117
				{
119
				{
118
					ch = '1';
120
					ch = '1';
119
					write (fd_serial, &ch, 1);
121
					write (fd_serial, &ch, 1);
120
				}
122
				}
121
				else if (isdigit(buf[0]))
123
				else if (isdigit(buf[0]))
122
				{
124
				{
123
					string temps = buf;
125
					string temps = buf;
124
					vector<string> s = split(temps, ' ');
126
					vector<string> s = split(temps, ' ');
125
 
127
 
126
					if (outPos != 0 && outPos <= s.size())
128
					if (outPos != 0 && outPos <= (int)s.size())
127
						outside = strtod(s.at(outPos - 1).c_str(), NULL);
129
						outside = strtod(s.at(outPos - 1).c_str(), NULL);
128
					// save all temperatures
130
					// save all temperatures
129
					for (int i = 0; i < s.size(); i++)
131
					for (int i = 0; i < (int)s.size(); i++)
130
						allTemps[i] = strtod(s.at(i).c_str(), NULL);
132
						allTemps[i] = strtod(s.at(i).c_str(), NULL);
131
				}
133
				}
132
 
134
 
133
				pos = 0;
135
				pos = 0;
134
			}
136
			}
Line 138... Line 140...
138
	stop = false;
140
	stop = false;
139
}
141
}
140
 
142
 
141
double temperature::getTemp (int pos)
143
double temperature::getTemp (int pos)
142
{
144
{
143
	if (pos <= MAX_TEMPS)
145
	if (pos && pos <= MAX_TEMPS)
144
		return allTemps[pos-1];
146
		return allTemps[pos-1];
145
 
147
 
146
	return 100.0;
148
	return 100.0;
147
}
149
}
148
 
150