首先这个被触发:返回程序预触发状态
if ((temperatureChannel[channelID].currentTemperature > temperatureChannel[channelID].highLimit) | (temperatureChannel[channelID].currentTemperature < temperatureChannel[channelID].lowLimit))
activateAlarm(channelID);
激活警报被触发,然后从那里:
void activateAlarm(int channelID);
{ while (temperatureChannel[channelID].currentTemperature > temperatureChannel[channelID].highLimit || temperatureChannel[channelID].currentTemperature < temperatureChannel[channelID].lowLimit)
{
logSubsystem(temperatureChannel[channelID].currentTemperature);
}
}
然后报警画面被触发与下面的情况:
int logSubsystem(int currentTemperature)
case 'F': //if user input is 'F'
case 'f': //if user input is 'f'
currentTemperature--;
printf("your current exceeded temp is %i\n \n", currentTemperature);
if (currentTemperature <= 100 || currentTemperature >= 50);
compareLimit();
break; //exits loop
如何设置此功能,以便用户使用F递减并获取当前温度t o低于极限(< 100,或> 50),那么它将返回到compareLimit函数,并且对上限/下限触发状态的要求将为FALSE,将程序返回到其原始的预警状态?
没有足够的上下文。根据你的问题,你可能需要:1.一个'while'循环,2.'longjmp()',3。 – 2013-03-27 15:22:07
我还能告诉你什么?我只是不想给你带来不必要的代码 – 2013-03-27 15:26:34
这也没关系。特别是,我会很喜欢'activateAlarm()'函数。 – 2013-03-27 15:27:36