Skip to content

Ability to define duration of a constant instruction #54

Open
@philipstarkey

Description

@philipstarkey

Original report (archived issue) by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


An issue that wasted a lot of time for someone here is that they intended to set an output to a value for some amount of time, but it turned out that a function being called later in the script was setting the same output to some other value "in advance", something like:

def stage_1(t, duration):
    output.constant(t, value)
    return duration

def stage_2(t, duration):
    output.constant(t - offset, some_other_value)
    return duration

start()
t = 0
t += stage_1(t, duration_1)
t += stage_2(t, duration_2)
stop(t)

Ideally one would be able to specify a duration to the .constant() method in stage_1() so that any instructions to the same output within some duration will result in a compile time error.

Also, a ramp instruction should be able to have a duration provided that exceeds the actual ramping duration, so that the final value being held as a constant can also be guaranteed by the compiler not be be cut short of some desired length of time.

Not sure how easy this will be to add to labscript as is, so whilst anyone should feel free to hack it in if they want, I'll try to include it in labscript 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingminor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions