Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tEditExpandSideBar::SetToNormal( bool animate )
{
    if ( ExpandedView() )
    {
        Collapse( animate );
    }
    if ( Hidden() )
    {
        if ( animate ) 
        {
            SlideIn();
        }
        else
        {
            MoveIn();
        }
        UpdateExpandCollapseItem();
    }
}
Ejemplo n.º 2
0
	void LinearActuatorNoPot::run() {
		runned();

		if (_state == ActuatorState_Initializing)
		{
			_runTime = millis() - _lastTime;
			if (Travel() > _actuatorLength)
			{
				enabled = false;
				_currentPosition = 0;
				Stop();
				Serial.println(_name + F(" actuator retracted and initialized"));
			}
		}
		else
		{
			float currentAngle = CurrentAngleFlipped();
			float delta = abs(currentAngle - _requestedAngle);
			Serial.print(_name + F(" tracking currentAngle: "));
			Serial.print(currentAngle);
			Serial.print(F(" _requestedAngle: "));
			Serial.print(_requestedAngle);
			Serial.print(F(" delta: "));
			Serial.print(delta);
			Serial.print(F(" _currentPosition: "));
			Serial.println(_currentPosition);
			if (delta <= histeresis)
			{
				Stop();
				Serial.println(_name + F(" actuator tracking complete "));
			}
			else if (currentAngle < _requestedAngle)
			{
				if (_state != ActuatorState_MovingOut)
				{
					MoveOut();
					_lastTime = millis();
					Serial.println(_name + F(" actuator MoveOut "));
				}
			}
			else if (currentAngle > _requestedAngle)
			{
				if (_state != ActuatorState_MovingIn)
				{
					MoveIn();
					_lastTime = millis();
					Serial.println(_name + F(" actuator MoveIn "));
				}
			}
			long now = millis();
			_runTime = now - _lastTime;
			_lastTime = now;
			if (_state == ActuatorState_MovingOut)
			{
				_currentPosition += Travel(); // inch step ((time in millis * 1000)  * speed
			}
			else if (_state == ActuatorState_MovingIn)
			{
				_currentPosition -= Travel(); // inch step ((time in millis * 1000)  * speed
			}
		}
	}