本文整理汇总了C++中GrillPid类的典型用法代码示例。如果您正苦于以下问题:C++ GrillPid类的具体用法?C++ GrillPid怎么用?C++ GrillPid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GrillPid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rfSourceNotify
static void rfSourceNotify(RFSource &r, unsigned char event)
{
for (unsigned char i=0; i<TEMP_COUNT; ++i)
if ((pid.Probes[i]->getProbeType() == PROBETYPE_RF12) &&
((rfMap[i] == RFSOURCEID_ANY) || (rfMap[i] == r.getId()))
)
{
if (event == RFEVENT_Remove)
pid.Probes[i]->calcTemp(0);
else if (r.isNative())
pid.Probes[i]->setTemperatureC(r.Value / 10.0f);
else
{
unsigned int val = r.Value;
unsigned char adcBits = rfmanager.getAdcBits();
// If the remote is lower resolution then shift it up to our resolution
if (adcBits < pid.getAdcBits())
val <<= (pid.getAdcBits() - adcBits);
pid.Probes[i]->calcTemp(val);
}
} /* if probe is this source */
if (event & (RFEVENT_Add | RFEVENT_Remove))
outputRfStatus();
}
示例2: reportFanParams
static void reportFanParams(void)
{
print_P(PSTR("HMFN" CSV_DELIMITER));
SerialX.print(pid.getMinFanSpeed(), DEC);
Serial_csv();
SerialX.print(pid.getMaxFanSpeed(), DEC);
Serial_csv();
SerialX.print(pid.getMinServoPos(), DEC);
Serial_csv();
SerialX.print(pid.getMaxServoPos(), DEC);
Serial_csv();
SerialX.print(pid.getOutputFlags(), DEC);
Serial_nl();
}
示例3: newTempsAvail
static void newTempsAvail(void)
{
static unsigned char pidCycleCount;
updateDisplay();
++pidCycleCount;
if ((pidCycleCount % 0x20) == 0)
outputRfStatus();
outputCsv();
// We want to report the status before the alarm readout so
// receivers can tell what the value was that caused the alarm
checkAlarms();
if (g_LogPidInternals)
pid.pidStatus();
if ((pidCycleCount % 0x04) == 1)
outputAdcStatus();
ledmanager.publish(LEDSTIMULUS_Off, LEDACTION_Off);
ledmanager.publish(LEDSTIMULUS_LidOpen, pid.isLidOpen());
ledmanager.publish(LEDSTIMULUS_FanOn, pid.isOutputActive());
ledmanager.publish(LEDSTIMULUS_FanMax, pid.isOutputMaxed());
ledmanager.publish(LEDSTIMULUS_PitTempReached, pid.isPitTempReached());
ledmanager.publish(LEDSTIMULUS_Startup, pid.getPitStartRecover() == PIDSTARTRECOVER_STARTUP);
ledmanager.publish(LEDSTIMULUS_Recovery, pid.getPitStartRecover() == PIDSTARTRECOVER_RECOVERY);
#ifdef HEATERMETER_RFM12
rfmanager.sendUpdate(pid.getPidOutput());
#endif
}
示例4: 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();
}
示例5: updateStatus
void ProbeAlarm::updateStatus(int value)
{
// Low: Arming point >= Thresh + 1.0f, Trigger point < Thresh
// A low alarm set for 100 enables at 101.0 and goes off at 99.9999...
if (getLowEnabled())
{
if (value >= (getLow() + 1))
Armed[ALARM_IDX_LOW] = true;
else if (value < getLow() && Armed[ALARM_IDX_LOW])
Ringing[ALARM_IDX_LOW] = true;
}
// High: Arming point < Thresh - 1.0f, Trigger point >= Thresh
// A high alarm set for 100 enables at 98.9999... and goes off at 100.0
if (getHighEnabled())
{
if (value < (getHigh() - 1))
Armed[ALARM_IDX_HIGH] = true;
else if (value >= getHigh() && Armed[ALARM_IDX_HIGH])
Ringing[ALARM_IDX_HIGH] = true;
}
if (pid.isLidOpen())
Ringing[ALARM_IDX_LOW] = Ringing[ALARM_IDX_HIGH] = false;
}
示例6: outputCsv
static void outputCsv(void)
{
#ifdef HEATERMETER_SERIAL
print_P(PSTR("HMSU" CSV_DELIMITER));
pid.status();
Serial_nl();
#endif /* HEATERMETER_SERIAL */
}
示例7: reportLidParameters
static void reportLidParameters(void)
{
print_P(PSTR("HMLD" CSV_DELIMITER));
SerialX.print(pid.LidOpenOffset, DEC);
Serial_csv();
SerialX.print(pid.getLidOpenDuration(), DEC);
Serial_nl();
}
示例8: storeProbeType
static void storeProbeType(unsigned char probeIndex, unsigned char probeType)
{
unsigned char ofs = getProbeConfigOffset(probeIndex, offsetof( __eeprom_probe, probeType));
if (ofs != 0)
{
pid.setProbeType(probeIndex, probeType);
econfig_write_byte((unsigned char *)ofs, probeType);
}
}
示例9: storeSetPoint
void storeSetPoint(int sp)
{
// If the setpoint is >0 that's an actual setpoint.
// 0 or less is a manual fan speed
boolean isManualMode;
if (sp > 0)
{
config_store_word(setPoint, sp);
pid.setSetPoint(sp);
isManualMode = false;
}
else
{
pid.setPidOutput(-sp);
isManualMode = true;
}
config_store_byte(manualMode, isManualMode);
}
示例10: 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;
}
}
示例11: storeLidParam
void storeLidParam(unsigned char idx, int val)
{
if (val < 0)
val = 0;
switch (idx)
{
case 0:
pid.LidOpenOffset = val;
config_store_byte(lidOpenOffset, val);
break;
case 1:
pid.setLidOpenDuration(val);
config_store_word(lidOpenDuration, val);
break;
case 2:
if (val)
pid.resetLidOpenResumeCountdown();
else
pid.LidOpenResumeCountdown = 0;
break;
}
}
示例12: storePidParam
static void storePidParam(char which, float value)
{
unsigned char k;
switch (which)
{
case 'b': k = 0; break;
case 'p': k = 1; break;
case 'i': k = 2; break;
case 'd': k = 3; break;
default:
return;
}
pid.setPidConstant(k, value);
unsigned char ofs = offsetof(__eeprom_data, pidConstants[0]);
econfig_write_block(&pid.Pid[k], (void *)(ofs + k * sizeof(float)), sizeof(value));
}
示例13: hmcoreLoop
void hmcoreLoop(void)
{
#ifdef HEATERMETER_SERIAL
serial_doWork();
#endif /* HEATERMETER_SERIAL */
#ifdef HEATERMETER_RFM12
if (rfmanager.doWork())
ledmanager.publish(LEDSTIMULUS_RfReceive, LEDACTION_OneShot);
#endif /* HEATERMETER_RFM12 */
Menus.doWork();
if (pid.doWork())
newTempsAvail();
tone_doWork();
ledmanager.doWork();
}
示例14: eepromLoadBaseConfig
static void eepromLoadBaseConfig(unsigned char forceDefault)
{
// The compiler likes to join eepromLoadBaseConfig and eepromLoadProbeConfig s
// this union saves stack space by reusing the same memory area for both structs
union {
struct __eeprom_data base;
struct __eeprom_probe probe;
} config;
econfig_read_block(&config.base, 0, sizeof(__eeprom_data));
forceDefault = forceDefault || config.base.magic != EEPROM_MAGIC;
if (forceDefault != 0)
{
memcpy_P(&config.base, &DEFAULT_CONFIG[forceDefault - 1], sizeof(__eeprom_data));
econfig_write_block(&config.base, 0, sizeof(__eeprom_data));
}
pid.setSetPoint(config.base.setPoint);
pid.LidOpenOffset = config.base.lidOpenOffset;
pid.setLidOpenDuration(config.base.lidOpenDuration);
memcpy(pid.Pid, config.base.pidConstants, sizeof(config.base.pidConstants));
if (config.base.manualMode)
pid.setPidOutput(0);
setLcdBacklight(config.base.lcdBacklight);
#ifdef HEATERMETER_RFM12
memcpy(rfMap, config.base.rfMap, sizeof(rfMap));
#endif
pid.setUnits(config.base.pidUnits == 'C' ? 'C' : 'F');
pid.setMinFanSpeed(config.base.minFanSpeed);
pid.setMaxFanSpeed(config.base.maxFanSpeed);
pid.setOutputFlags(config.base.pidOutputFlags);
g_HomeDisplayMode = config.base.homeDisplayMode;
pid.setMinServoPos(config.base.minServoPos);
pid.setMaxServoPos(config.base.maxServoPos);
for (unsigned char led = 0; led<LED_COUNT; ++led)
ledmanager.setAssignment(led, config.base.ledConf[led]);
}
示例15: reportFanParams
static void reportFanParams(void)
{
print_P(PSTR("HMFN" CSV_DELIMITER));
SerialX.print(pid.getFanMinSpeed(), DEC);
Serial_csv();
SerialX.print(pid.getFanMaxSpeed(), DEC);
Serial_csv();
SerialX.print(pid.getServoMinPos(), DEC);
Serial_csv();
SerialX.print(pid.getServoMaxPos(), DEC);
Serial_csv();
SerialX.print(pid.getOutputFlags(), DEC);
Serial_csv();
SerialX.print(pid.getFanMaxStartupSpeed(), DEC);
Serial_csv();
SerialX.print(pid.getFanActiveFloor(), DEC);
Serial_csv();
SerialX.print(pid.getServoActiveCeil(), DEC);
Serial_nl();
}