Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

Implements configurable movement times for raise/lower operations with command banking to prevent relay conflicts during physical movement. Applies to momentary mode only; latched mode relays switch instantly without timing.

Configuration Changes

  • Added raiseTimeInMs and lowerTimeInMs to relay config for independent movement durations
  • Times are optional (feature disabled if 0 or unset)

Behavior Changes

Command Banking:

  • Commands issued during movement are banked (only latest command retained)
  • Banked commands execute after movement completes
  • Commands ignored if destination already matches current position

Momentary Mode:

// User calls Raise() while device is lowering
Lower();  // Starts 30s movement timer, sets _isMoving
Raise();  // Banks command, returns immediately

// After 30s timer expires:
// - _isMoving cleared
// - Banked Raise() executes automatically

Latched Mode:

  • No timing applied (relays maintain state, can switch mid-movement)

Implementation

  • _isMoving flag prevents concurrent relay activation
  • _requestedState enum (None/Raise/Lower) stores single banked command
  • DisposeMovementTimer() ensures cleanup before new timer creation
  • OnMovementComplete() callback handles timer expiry and banked command execution

Example Config

{
  "relays": {
    "raise": {
      "deviceKey": "relay-1",
      "pulseTimeInMs": 500,
      "raiseTimeInMs": 30000
    },
    "lower": {
      "deviceKey": "relay-2", 
      "pulseTimeInMs": 500,
      "lowerTimeInMs": 45000
    }
  }
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • crl.entrust.net
    • Triggering command: /usr/bin/dotnet dotnet build PepperDash.Essentials.4Series.sln (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Essentials/Essentials/PepperDash.Essentials.4Series.sln --packages /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/8E3C38744AF97AEA71D98A0334D7EC97/missingpackages_workingdir --packages /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/missingpackages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal --configfile /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/nugetconfig/nuget.config --force (dns block)
  • ocsp.entrust.net
    • Triggering command: /usr/bin/dotnet dotnet build PepperDash.Essentials.4Series.sln (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Essentials/Essentials/PepperDash.Essentials.4Series.sln --packages /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/8E3C38744AF97AEA71D98A0334D7EC97/missingpackages_workingdir --packages /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/missingpackages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal --configfile /home/REDACTED/work/Essentials/.codeql-scratch/dbs/csharp/working/nugetconfig/nuget.config --force (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

On ScreenLiftController.cs, create a branch called feature/add-raise-lower-time

we need to add a cofig value for time in ms for each of the raise and lower functions.

When raise or lower is called, we need to set a flag (_requestedState) for isMoving that will time out after the defined time value for its direction of travel. While the device isMoving, prevent other methhods from activating the relays. If a method is called while isMoving is on, bank that command and execute it after the isMoving flag is cleared. Only allow for one command to be banked, either raise or lower. Once isMoving is cleared, if the current state is the same as what the banked command would do, ignore it.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 27, 2025 20:09
Co-authored-by: erikdred <88980320+erikdred@users.noreply.github.com>
… from latched mode

Co-authored-by: erikdred <88980320+erikdred@users.noreply.github.com>
Co-authored-by: erikdred <88980320+erikdred@users.noreply.github.com>
Copilot AI changed the title [WIP] Add configurable time for raise and lower functions Add movement timing and command banking to ScreenLiftController Dec 27, 2025
Copilot AI requested a review from erikdred December 27, 2025 20:21
@erikdred erikdred force-pushed the copilot/featureadd-raise-lower-time branch from 7f03f51 to a7ff2e8 Compare December 27, 2025 23:20
Copy link
Contributor

@erikdred erikdred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and working in the field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants