本文整理汇总了C++中GrillPid::getUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ GrillPid::getUnits方法的具体用法?C++ GrillPid::getUnits怎么用?C++ GrillPid::getUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrillPid
的用法示例。
在下文中一共展示了GrillPid::getUnits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcTemp
void TempProbe::calcTemp(void)
{
const float ADCmax = (1 << (10+TEMP_OVERSAMPLE_BITS)) - 1;
if (_accumulatedCount != 0)
{
unsigned int ADCval = _accumulator / _accumulatedCount;
_accumulatedCount = 0;
// Units 'A' = ADC value
if (pid.getUnits() == 'A')
{
Temperature = ADCval;
return;
}
if (ADCval != 0) // Vout >= MAX is reduced in readTemp()
{
float R, T;
// If you put the fixed resistor on the Vcc side of the thermistor, use the following
R = Steinhart[3] / ((ADCmax / (float)ADCval) - 1.0f);
// If you put the thermistor on the Vcc side of the fixed resistor use the following
//R = Steinhart[3] * ADCmax / (float)Vout - Steinhart[3];
// Units 'R' = resistance, unless this is the pit probe (which should spit out Celsius)
if (pid.getUnits() == 'R' && this != pid.Probes[TEMP_PIT])
{
Temperature = R;
return;
};
// Compute degrees K
R = log(R);
T = 1.0f / ((Steinhart[2] * R * R + Steinhart[1]) * R + Steinhart[0]);
setTemperatureC(T - 273.15f);
} /* if ADCval */
else
Temperature = NAN;
} /* if accumulatedcount */
if (hasTemperature())
{
calcExpMovingAverage(TEMPPROBE_AVG_SMOOTH, &TemperatureAvg, Temperature);
Alarms.updateStatus(Temperature);
}
else
Alarms.silenceAll();
}
示例2: setTemperatureC
void TempProbe::setTemperatureC(float T)
{
// Sanity - anything less than -20C (-4F) or greater than 500C (932F) is rejected
if (T <= -20.0f || T > 500.0f)
Temperature = NAN;
else
{
if (pid.getUnits() == 'F')
Temperature = (T * (9.0f / 5.0f)) + 32.0f;
else
Temperature = T;
Temperature += Offset;
}
}
示例3: calcTemp
void TempProbe::calcTemp(void)
{
const float ADCmax = (1 << (10+TEMP_OVERSAMPLE_BITS)) - 1;
if (_accumulatedCount != 0)
{
unsigned int ADCval = _accumulator / _accumulatedCount;
_accumulatedCount = 0;
// Units 'A' = ADC value
if (pid.getUnits() == 'A')
{
Temperature = ADCval;
return;
}
if (ADCval != 0) // Vout >= MAX is reduced in readTemp()
{
if (_probeType == PROBETYPE_TC_ANALOG)
{
float mvScale = Steinhart[3];
// Commented out because there's no "divide by zero" exception so
// just allow undefined results to save prog space
//if (mvScale == 0.0f)
// mvScale = 1.0f;
// If scale is <100 it is assumed to be mV/C with a 3.3V reference
if (mvScale < 100.0f)
mvScale = 3300.0f / mvScale;
setTemperatureC(ADCval / ADCmax * mvScale);
}
else {
float R, T;
// If you put the fixed resistor on the Vcc side of the thermistor, use the following
R = Steinhart[3] / ((ADCmax / (float)ADCval) - 1.0f);
// If you put the thermistor on the Vcc side of the fixed resistor use the following
//R = Steinhart[3] * ADCmax / (float)Vout - Steinhart[3];
// Units 'R' = resistance, unless this is the pit probe (which should spit out Celsius)
if (pid.getUnits() == 'R' && this != pid.Probes[TEMP_PIT])
{
Temperature = R;
return;
};
// Compute degrees K
R = log(R);
T = 1.0f / ((Steinhart[2] * R * R + Steinhart[1]) * R + Steinhart[0]);
setTemperatureC(T - 273.15f);
} /* if PROBETYPE_INTERNAL */
} /* if ADCval */
else
Temperature = NAN;
} /* if accumulatedcount */
if (hasTemperature())
{
calcExpMovingAverage(TEMPPROBE_AVG_SMOOTH, &TemperatureAvg, Temperature);
Alarms.updateStatus(Temperature);
}
else
Alarms.silenceAll();
}
示例4: updateDisplay
void updateDisplay(void)
{
// Updates to the temperature can come at any time, only update
// if we're in a state that displays them
state_t state = Menus.getState();
if (!isMenuHomeState())
return;
char buffer[17];
unsigned char probeIdxLow, probeIdxHigh;
// Fixed pit area
lcd.setCursor(0, 0);
if (state == ST_HOME_ALARM)
{
toneEnable(true);
if (ALARM_ID_TO_IDX(g_AlarmId) == ALARM_IDX_LOW)
lcdprint_P(PSTR("** ALARM LOW **"), false);
else
lcdprint_P(PSTR("** ALARM HIGH **"), false);
probeIdxLow = probeIdxHigh = ALARM_ID_TO_PROBE(g_AlarmId);
} /* if ST_HOME_ALARM */
else
{
toneEnable(false);
/* Big Number probes overwrite the whole display if it has a temperature */
if (g_HomeDisplayMode >= TEMP_PIT && g_HomeDisplayMode <= TEMP_AMB)
{
TempProbe *probe = pid.Probes[g_HomeDisplayMode];
if (probe->hasTemperature())
{
lcdPrintBigNum(probe->Temperature);
return;
}
}
/* Default Pit / Fan Speed first line */
int pitTemp;
if (pid.Probes[TEMP_CTRL]->hasTemperature())
pitTemp = pid.Probes[TEMP_CTRL]->Temperature;
else
pitTemp = 0;
if (!pid.getManualOutputMode() && !pid.Probes[TEMP_CTRL]->hasTemperature())
memcpy_P(buffer, LCD_LINE1_UNPLUGGED, sizeof(LCD_LINE1_UNPLUGGED));
else if (pid.LidOpenResumeCountdown > 0)
snprintf_P(buffer, sizeof(buffer), PSTR("Pit:%3d"DEGREE"%c Lid%3u"),
pitTemp, pid.getUnits(), pid.LidOpenResumeCountdown);
else
{
char c1,c2;
if (pid.getManualOutputMode())
{
c1 = '^'; // LCD_ARROWUP
c2 = '^'; // LCD_ARROWDN
}
else
{
c1 = '[';
c2 = ']';
}
snprintf_P(buffer, sizeof(buffer), PSTR("Pit:%3d"DEGREE"%c %c%3u%%%c"),
pitTemp, pid.getUnits(), c1, pid.getPidOutput(), c2);
}
lcd.print(buffer);
// Display mode 0xff is 2-line, which only has space for 1 non-pit value
if (g_HomeDisplayMode == 0xff)
probeIdxLow = probeIdxHigh = state - ST_HOME_FOOD1 + TEMP_FOOD1;
else
{
// Display mode 0xfe is 4 line home, display 3 other temps there
probeIdxLow = TEMP_FOOD1;
probeIdxHigh = TEMP_AMB;
}
} /* if !ST_HOME_ALARM */
// Rotating probe display
for (unsigned char probeIndex=probeIdxLow; probeIndex<=probeIdxHigh; ++probeIndex)
{
if (probeIndex < TEMP_COUNT && pid.Probes[probeIndex]->hasTemperature())
{
loadProbeName(probeIndex);
snprintf_P(buffer, sizeof(buffer), PSTR("%-12s%3d"DEGREE), editString,
(int)pid.Probes[probeIndex]->Temperature);
}
else
{
// If probeIndex is outside the range (in the case of ST_HOME_NOPROBES)
// just fill the bottom line with spaces
memset(buffer, ' ', sizeof(buffer));
buffer[sizeof(buffer) - 1] = '\0';
}
lcd.setCursor(0, probeIndex - probeIdxLow + 1);
lcd.print(buffer);
}
}