mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
Split movement time into separate raise/lower times and remove timing from latched mode
Co-authored-by: erikdred <88980320+erikdred@users.noreply.github.com>
This commit is contained in:
@@ -196,23 +196,24 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
PulseOutput(RaiseRelay, RaiseRelayConfig.PulseTimeInMs);
|
||||
|
||||
// Set moving flag and start timer if movement time is configured
|
||||
if (RaiseRelayConfig.MovementTimeInMs > 0)
|
||||
if (RaiseRelayConfig.RaiseTimeInMs > 0)
|
||||
{
|
||||
_isMoving = true;
|
||||
_movementTimer = new CTimer(OnMovementComplete, RaiseRelayConfig.MovementTimeInMs);
|
||||
|
||||
// Dispose previous timer if exists
|
||||
if (_movementTimer != null)
|
||||
{
|
||||
_movementTimer.Stop();
|
||||
_movementTimer.Dispose();
|
||||
}
|
||||
|
||||
_movementTimer = new CTimer(OnMovementComplete, RaiseRelayConfig.RaiseTimeInMs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eScreenLiftControlMode.latched:
|
||||
{
|
||||
LatchedRelay.Off();
|
||||
|
||||
// Set moving flag and start timer if movement time is configured
|
||||
if (LatchedRelayConfig.MovementTimeInMs > 0)
|
||||
{
|
||||
_isMoving = true;
|
||||
_movementTimer = new CTimer(OnMovementComplete, LatchedRelayConfig.MovementTimeInMs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -245,23 +246,24 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
PulseOutput(LowerRelay, LowerRelayConfig.PulseTimeInMs);
|
||||
|
||||
// Set moving flag and start timer if movement time is configured
|
||||
if (LowerRelayConfig.MovementTimeInMs > 0)
|
||||
if (LowerRelayConfig.LowerTimeInMs > 0)
|
||||
{
|
||||
_isMoving = true;
|
||||
_movementTimer = new CTimer(OnMovementComplete, LowerRelayConfig.MovementTimeInMs);
|
||||
|
||||
// Dispose previous timer if exists
|
||||
if (_movementTimer != null)
|
||||
{
|
||||
_movementTimer.Stop();
|
||||
_movementTimer.Dispose();
|
||||
}
|
||||
|
||||
_movementTimer = new CTimer(OnMovementComplete, LowerRelayConfig.LowerTimeInMs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eScreenLiftControlMode.latched:
|
||||
{
|
||||
LatchedRelay.On();
|
||||
|
||||
// Set moving flag and start timer if movement time is configured
|
||||
if (LatchedRelayConfig.MovementTimeInMs > 0)
|
||||
{
|
||||
_isMoving = true;
|
||||
_movementTimer = new CTimer(OnMovementComplete, LatchedRelayConfig.MovementTimeInMs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -271,7 +273,7 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
/// <summary>
|
||||
/// Called when movement timer completes
|
||||
/// </summary>
|
||||
void OnMovementComplete(object o)
|
||||
private void OnMovementComplete(object o)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, this, $"Movement complete");
|
||||
|
||||
|
||||
@@ -20,9 +20,15 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
public int PulseTimeInMs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MovementTimeInMs - time in milliseconds for the movement to complete
|
||||
/// Gets or sets the RaiseTimeInMs - time in milliseconds for the raise movement to complete
|
||||
/// </summary>
|
||||
[JsonProperty("movementTimeInMs")]
|
||||
public int MovementTimeInMs { get; set; }
|
||||
[JsonProperty("raiseTimeInMs")]
|
||||
public int RaiseTimeInMs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LowerTimeInMs - time in milliseconds for the lower movement to complete
|
||||
/// </summary>
|
||||
[JsonProperty("lowerTimeInMs")]
|
||||
public int LowerTimeInMs { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user