当前位置: 首页>>代码示例>>C++>>正文


C++ resetTimer函数代码示例

本文整理汇总了C++中resetTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ resetTimer函数的具体用法?C++ resetTimer怎么用?C++ resetTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了resetTimer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runScreenTimeoutTimer

void runScreenTimeoutTimer()
{
	uint16_t xval = 0;
	uint16_t yval = 0;
	TOUCH_VAL(&xval, &yval);

	if(yval | xval)
	{
		resetTimer(&screenTimeout,SECONDS_TO_SCREEN_TIMEOUT);
		TREADMILL_STATE=NO_MOVEMENT;
		startTimer(&screenTimeout);
	}
	else if(TREADMILL_STATE==NO_MOVEMENT)
	{
		runSecondsTimer(&screenTimeout);
		if(checkTimerIfExpired(&screenTimeout))
		{
			TREADMILL_STATE=TIMED_OUT;
		}
	}
	else if(TREADMILL_STATE==MOVING)
	{
		resetTimer(&screenTimeout,SECONDS_TO_SCREEN_TIMEOUT);
	}

}
开发者ID:NateZimmer,项目名称:blarg,代码行数:26,代码来源:treadmill.c

示例2: autonomous

task autonomous() // main task basically, but this will run if we are put itno autonomous mode
{
	MVR = 77;
	MVL = 77;
	resetTimer(T2);
	while (true)
	{
		change = full;
		if (time1[T1]>200)
		{
			Speed();
			resetTimer(T1);
			SensorValue[LeftSpeed] = 0;
			SensorValue[RightSpeed] = 0;
			Pid();
		}
		change = full;
		flyWheelRun();
		if (time1[T2]>2000)
		{
			Staggershot();
		}
	}

}
开发者ID:mrpitner,项目名称:334rf,代码行数:25,代码来源:Comp+Robot+2.0.c

示例3: pre_auton

void pre_auton() // this is where we can reset values/timers etc
{
	SensorValue[LeftSpeed] = 0;
	SensorValue[RightSpeed] = 0;
	resetTimer(T1);
	resetTimer(T2);
	resetTimer(T4);
}
开发者ID:mrpitner,项目名称:334rf,代码行数:8,代码来源:Comp+Robot+2.0.c

示例4: resetTimer

void QStreamCubeChat::disconnect()
{
    channelId_.clear();
    //lastMessageId_.clear();
    lastMessageId_ = "0";

    resetTimer( updateTimerId_ );
    resetTimer( reconnectTimerId_ );
}
开发者ID:c0deum,项目名称:BroChat,代码行数:9,代码来源:qstreamcubechat.cpp

示例5: SpeedControls2

void SpeedControls2()
{
	if(vexRT[Btn8UXmtr2] == 1)
	{
		change = full;
		MVR = 77;
		MVL = 77;
		wait1Msec(20);
		resetTimer(T4);
	}
	if(vexRT[Btn7LXmtr2] == 1 || vexRT[Btn7RXmtr2] == 1)
	{
		change = 0;
		MVR = 0;
		MVL = 0;
		wait1Msec(20);
		resetTimer(T4);
	}
	if(vexRT[Btn8RXmtr2] == 1 || vexRT[Btn8LXmtr2] == 1)
	{
		change = mid;
		MVR = 64;
		MVL = 64;
		wait1Msec(20);
		resetTimer(T4);
	}
	if(vexRT[Btn8DXmtr2] == 1)
	{
		change = close;
		MVR = 58;
		MVL = 58;
		wait1Msec(20);
		resetTimer(T4);
	}

	if(vexRT[Btn7DXmtr2] == 1)
	{
		if(MVR >=0)
		{
			change = change -1;
			wait1Msec(20);
		}
	}

	if(vexRT[Btn7UXmtr2] == 1)
	{
		change = change +1;
		wait1Msec(20);
	}

	if(vexRT[Btn7UXmtr2] == 1)
	{
		MVR = MVR+1;
		MVL = MVL+1;
		wait1Msec(200);
	}
}
开发者ID:mrpitner,项目名称:334rf,代码行数:57,代码来源:Comp+Robot+2.0.c

示例6: waitForMovementToFinish

/*void waitForMovementToFinish(motorGroup *group, int timeout=DEF_WAIT_TIMEOUT) {
	waitForMovementToFinish(timeout, 1, group);
}*/
void waitForMovementToFinish(motorGroup *group, int timeout=DEF_WAIT_TIMEOUT) {	//TODO: delete this as soon as possible
	long movementTimer = resetTimer();

	while (time(movementTimer) < timeout) {	//wait for targeting to stabilize
		if (group->moving==TARGET && !errorLessThan(group, group->waitErrorMargin))
				movementTimer = resetTimer();

		EndTimeSlice();
	}

	while (group->moving!=TARGET && group->moving!=NO) EndTimeSlice();
}
开发者ID:DHS-Robotics,项目名称:VEX_Prebuilt_Includes,代码行数:15,代码来源:motorGroup.c

示例7: SpeedControls

void SpeedControls()
{

	if(vexRT[Btn8U] == 1)
	{
		change = full;
		MVR = 65;
		MVL = 65;
		wait1Msec(20);
		resetTimer(T4);
	}
	if(vexRT[Btn8D] == 1)
	{
		change = 0;
		MVR = 0;
		MVL = 0;
		wait1Msec(20);
		resetTimer(T4);
	}
	if(vexRT[Btn8R] == 1)
	{
		change = mid;
		MVR = 50;
		MVL = 50;
		wait1Msec(20);
		resetTimer(T4);
	}
	if(vexRT[Btn8L] == 1)
	{
		change = close;
		MVR = 40;
		MVL = 40;
		wait1Msec(20);
		resetTimer(T4);
	}

	if(vexRT[Btn7D] == 1)
	{
		if(MVR >=0)
		{
			change = change -1;
			wait1Msec(20);
		}
	}

	if(vexRT[Btn7U] == 1)
	{
		change = change +1;
		wait1Msec(20);
	}

}
开发者ID:mrpitner,项目名称:334rf,代码行数:52,代码来源:Comp+Robot+2.0.c

示例8: FD_ZERO

bool Socket::think()
{
	if(connecting)
	{
		fd_set monitor;
		timeval tv;
		tv.tv_sec = 0;
		tv.tv_usec = 0;
		FD_ZERO(&monitor);
		FD_SET(s, &monitor);
		select(s+1, 0, &monitor, 0, &tv);
		
		if(FD_ISSET(s, &monitor))
		{
			int status;
			socklen_t len = sizeof(status);
			getsockopt(s, SOL_SOCKET, SO_ERROR, (char *)&status, &len);
			if(status != 0) // Error
			{
				error = ErrorConnect;
				return true;
			}
			
			connected = true;
			connecting = false;
			resetTimer();
		}
		else
			checkTimeout();
	}
	
	return error != ErrorNone;
}
开发者ID:a-sf-mirror,项目名称:gusanos,代码行数:33,代码来源:tcp.cpp

示例9: QPlainTextEdit

TextEditor::TextEditor(QWidget *parent) : QPlainTextEdit(parent)
{
    lineNumberArea = new LineNumberArea(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();

    QFont font("consolas",9);
    const int tabStop = 4;  // 4 characters
    QFontMetrics metrics(font);
    setTabStopWidth(tabStop * metrics.width(' '));
    setFont(font);
    setLineWrapMode(QPlainTextEdit::NoWrap);

    m_highlighter = new Highlighter(document());

    m_autoUpdate = false;
    m_timer = new QTimer();
    m_timer->setSingleShot(true);
    m_timer->setInterval(1000);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(updateShader()));
    connect(this, SIGNAL(textChanged()), this, SLOT(resetTimer()));
}
开发者ID:XT95,项目名称:VisualLiveSystem,代码行数:27,代码来源:texteditor.cpp

示例10: readResponse

void readResponse(outstandingQuery *queries,int *slot,int &nrOfQueries,char *serverflag,SYSTEMTIME &timer){
#else
void readResponse(outstandingQuery *queries,int *slot,int &nrOfQueries,char *serverflag,timeval &timer){
#endif
    int tmpNr = 1;
    for(int i=0;i<MAXQUERIES;i++){
        
        if(queries[i].running){
			//cout << "reading from index: "<<i<<endl;
            if(serverflag[i] == '1'){
                if(slot[i] == -1){
                    
                    queries[i].running = 0;
                    nrOfQueries--;
                    cout << endl<<"query "<< i << " is done in: " <<TimerStop(queries[i].startTime)<< " sec"<<endl;
                }else{
                    //TODO: Remove testmode
                    
                    repeated = 0;
                    resetTimer(timer);
                    cout <<"Q"<<i<<": "<<slot[i] << " ";
                    if(queries[i].testRun){
                        cout << endl;
                    }else{
                        fflush(0);
                    }
                    
                }
                serverflag[i] = '0';
            }
        }
    }
    
}
开发者ID:aipoyun,项目名称:Multithreaded-Client-Server,代码行数:34,代码来源:Client.cpp

示例11: executeAutomovement

int executeAutomovement(motorGroup *group, int debugStartCol) {
	switch (group->moving) {
		case TARGET:
			if (group->posPID.kP != 0) {
				int powerLimit = (group->autoStillSpeeding && errorLessThan(group, group->autoSSmargin) ? group->stillSpeed : 127);	//limit power if autoStillSpeeding conditions are met
				group->posPID.integralMax = powerLimit;
				int PIDpower = PID_runtime(group->posPID, getPosition(group), debugStartCol);
				setPower(group, copysign(PIDpower, limit(fabs(PIDpower), 0, powerLimit)));
			}
			break;

		case MANEUVER:
			if (group->forward == (getPosition(group) < group->targetPos)) {
				group->maneuverTimer = resetTimer();
				setPower(group, group->movePower);
			}
			else if (time(group->maneuverTimer) > group->maneuverTimeout) {
				setPower(group, group->endPower);
				group->moving = NO;
			}
			break;

		case DURATION:
			if (time(group->maneuverTimer) > group->moveDuration) {
				setPower(group, group->endPower);
				group->moving = NO;
			}
			else {
				setPower(group, group->movePower);
			}
			break;
	}

	return getPower(group);	//TODO: be better
}
开发者ID:DHS-Robotics,项目名称:VEX_Prebuilt_Includes,代码行数:35,代码来源:motorGroup.c

示例12: recv

bool Socket::readChunk()
{
	dataBegin = dataEnd = 0;
	
	int r = recv(s, staticBuffer, 1024, 0);
	if(r != -1)
	{
		if(r == 0)
		{
			connected = false;
			return true; // No more data
		}
		dataBegin = staticBuffer;
		dataEnd = staticBuffer + r;
		resetTimer();
	}
	else if(sockError() != EWOULDBLOCK)
	{
		error = ErrorRecv;
		return true; // Error
	}
	else
	{
		checkTimeout();
	}
	
	return error != ErrorNone;
}
开发者ID:a-sf-mirror,项目名称:gusanos,代码行数:28,代码来源:tcp.cpp

示例13: initialize

// initializes MSP 430 and the other electronics
void initialize()
{
    // stop watch dog timer
    WDTCTL = WDTPW + WDTHOLD;
  
    // set CPU clock speed
    BCSCTL1 = _BCS_CLK;
    DCOCTL = _DCO_CLK;

    // set launchpad board LED and button pin directions
    P1DIR_bit.P0 = _OUTPUT;
    P1DIR_bit.P3 = _INPUT;
    P1DIR_bit.P6 = _OUTPUT;

    // turn on internal pull-up resistor for launchpad push button
    P1REN_bit.P3 = _HIGH;
    
    // configure for fuel cell car
    _initMotorController();
#ifdef _RESET_MOT_CNTL
    _resetMotorController();
#endif
    _initADC();

    // set switch pin direction
    P2DIR_bit._P_SWITCH = _INPUT;
    
    // set LED light bar pin directions to output
    P2DIR |= _LED_MASK;

    //enable the elapsed time timer
    resetTimer();
    __enable_interrupt();  // enable global interrupts
}
开发者ID:Rich143,项目名称:Fuel-Cell-Car,代码行数:35,代码来源:UW_GENE_121.cpp

示例14: checkState

//The check state function checks if a flag has been set, and if it has, it both resets the flag and changes and counters / states
void checkState(){
   if(checkTimer()){  //If the timer flag is set
      if(state == RED)
	 state = GREEN;
      else
	 ++state;

      //PORTC = ~PORTC;  //Debugging code
      resetTimer();

      if(state == YELLOW)
	 OCR1A = 7813; //Set the timer to 1 second (with 1024 prescaler)
      else
	 OCR1A = 23438;//Set the timer to 3 seconds (with 1024 prescaler)

      //Debugging USART statements
      if(state == RED)
	 USART_send_string("RED                           \r");
      else if (state == GREEN)
	 USART_send_string("GREEN                         \r");
      else
	 USART_send_string("YELLOW                        \r");
   }

}
开发者ID:Nrpickle,项目名称:EECS162,代码行数:26,代码来源:main.c

示例15: turnLeft

void turnLeft(int time)
{
  resetTimer();
  setMotor(MOTOR_A, -100);
  setMotor(MOTOR_B, -100);
  while (time1() < time);
}
开发者ID:arunjey,项目名称:Cplusplus-Code,代码行数:7,代码来源:trackce2.cpp


注:本文中的resetTimer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。