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);
|
PulseOutput(RaiseRelay, RaiseRelayConfig.PulseTimeInMs);
|
||||||
|
|
||||||
// Set moving flag and start timer if movement time is configured
|
// Set moving flag and start timer if movement time is configured
|
||||||
if (RaiseRelayConfig.MovementTimeInMs > 0)
|
if (RaiseRelayConfig.RaiseTimeInMs > 0)
|
||||||
{
|
{
|
||||||
_isMoving = true;
|
_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;
|
break;
|
||||||
}
|
}
|
||||||
case eScreenLiftControlMode.latched:
|
case eScreenLiftControlMode.latched:
|
||||||
{
|
{
|
||||||
LatchedRelay.Off();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -245,23 +246,24 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
|||||||
PulseOutput(LowerRelay, LowerRelayConfig.PulseTimeInMs);
|
PulseOutput(LowerRelay, LowerRelayConfig.PulseTimeInMs);
|
||||||
|
|
||||||
// Set moving flag and start timer if movement time is configured
|
// Set moving flag and start timer if movement time is configured
|
||||||
if (LowerRelayConfig.MovementTimeInMs > 0)
|
if (LowerRelayConfig.LowerTimeInMs > 0)
|
||||||
{
|
{
|
||||||
_isMoving = true;
|
_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;
|
break;
|
||||||
}
|
}
|
||||||
case eScreenLiftControlMode.latched:
|
case eScreenLiftControlMode.latched:
|
||||||
{
|
{
|
||||||
LatchedRelay.On();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,7 +273,7 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when movement timer completes
|
/// Called when movement timer completes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void OnMovementComplete(object o)
|
private void OnMovementComplete(object o)
|
||||||
{
|
{
|
||||||
Debug.LogMessage(LogEventLevel.Debug, this, $"Movement complete");
|
Debug.LogMessage(LogEventLevel.Debug, this, $"Movement complete");
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,15 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
|||||||
public int PulseTimeInMs { get; set; }
|
public int PulseTimeInMs { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
[JsonProperty("movementTimeInMs")]
|
[JsonProperty("raiseTimeInMs")]
|
||||||
public int MovementTimeInMs { get; set; }
|
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