Nice step in the right direction. I'll assume this will extend into the Grand Central at some point: https://www.adafruit.com/product/4000
call and return
Assumptions:
The call command will call a section in its own script.
It cannot call a section in a different Script.
The return command will return to the line following the call command.
new value CountX
CountX = 1
Lots of code
call “add CountX"
//return comes to here
lots of other code
call “add CountX"
//return comes to here
More code
call “add CountX"
//return comes to here
Even More code
//Sub Routine
[add CountX]
CountX =+ 1
return
ditto Clearwatersbrewer request:
I use different configurations for different Brews that we repeat. Right now, I just make a copy of a config file and rename it.
I would also love to have better control of Elements, Workspaces and Interfaces. In addition to Export and Import, Cloning an Element on a Workspace would be great with 99% of the properties. Just leave the Name, Port and Interface to be assigned.
Which brings in a second point. Move an Element to a different Port and or Port and Interface rather than being read only.
Would also like the manual Workspace... button on an Element to also be a command in a script
move workspace "My Element" = "Workspace 2"
ditto Clearwatersbrewer request:
I use different configurations for different Brews that we repeat. Right now, I just make a copy of a config file and rename it.
"
<Configuration xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Devices>
<Device>
<Ports>
<DevicePort xmlns="" i:type="AnalogInPort">
<Enabled>true</Enabled>
<ID>c7bd553e-3a0b-4d9b-8eba-78b974fe5663</ID>
<Number>102</Number>
<PrimaryDisplayChannel>0</PrimaryDisplayChannel>
<RefreshMultiple>1</RefreshMultiple>
<AvgWeight>25</AvgWeight>
<CalValue>
<Calibrations>
<Calibration xmlns="" i:type="MultiplierCalibration">
<Enabled>true</Enabled>
<Multiplier>0.029297</Multiplier>
</Calibration>
<Calibration xmlns="" i:type="OffsetCalibration">
<Enabled>true</Enabled>
<Offset>-2</Offset>
</Calibration>
</Calibrations>
<Precision>1</Precision>
<Prefix></Prefix>
<RequestedValue>0</RequestedValue>
<Suffix>psi</Suffix>
</CalValue>
<PollRate>500</PollRate>
</DevicePort>
</Ports>
</Device>
</Devices>
<Workspaces>
<Workspace>
<Elements>
<Element xmlns="" i:type="DeviceElement">
<Appearance>
<BackgroundImageIndex>0</BackgroundImageIndex>
<BackgroundImages xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d7p1:string></d7p1:string>
<d7p1:string></d7p1:string>
<d7p1:string></d7p1:string>
</BackgroundImages>
<BorderVisibility>Default</BorderVisibility>
<CircularGaugeOptions>
<Layout>Full</Layout>
<MajorTickCount>11</MajorTickCount>
<MaxValue>100</MaxValue>
<MinValue>0</MinValue>
<MinorTickCount>4</MinorTickCount>
<Style>Default</Style>
</CircularGaugeOptions>
<DigitalGaugeOptions>
<DigitCount>1</DigitCount>
<Mode>Default</Mode>
<Style>Default</Style>
</DigitalGaugeOptions>
<DisplayKind>Text</DisplayKind>
<IndicatorOptions>
<OffColor>Off</OffColor>
<OnColor>Green</OnColor>
</IndicatorOptions>
<LinearGaugeOptions>
<MajorTickCount>11</MajorTickCount>
<MaxValue>100</MaxValue>
<MinValue>0</MinValue>
<MinorTickCount>4</MinorTickCount>
<Orientation>Vertical</Orientation>
<Style>Default</Style>
</LinearGaugeOptions>
<NameAlignment>Default</NameAlignment>
<NameBackColor i:nil="true" />
<NameFont i:nil="true" />
<NameForeColor i:nil="true" />
<NameVisibility>Default</NameVisibility>
<TextDisplayOptions>
<FalseText></FalseText>
<Precision>0</Precision>
<TrueText></TrueText>
</TextDisplayOptions>
<ValueAlignment>Default</ValueAlignment>
<ValueBackColor i:nil="true" />
<ValueEnlargement i:nil="true" />
<ValueFont i:nil="true" />
<ValueForeColor i:nil="true" />
<Visibility>Default</Visibility>
</Appearance>
<Enabled>false</Enabled>
<Height>140</Height>
<ID>cebca8ea-4210-42bc-b0ff-964702240fea</ID>
<Name>Bain Marie Pressure</Name>
<UserControl>false</UserControl>
<Width>180</Width>
<X>600</X>
<Y>310</Y>
<PortID>c7bd553e-3a0b-4d9b-8eba-78b974fe5663</PortID>
</Element>
</Elements>
<Name>Workspace 1</Name>
</Workspace>
</Workspaces>
</Configuration>
Hi. Not sure what you are saying here... is this a request? The subroutine function was added in v1.1, so this exists as you have written it. You cannot call a section in a different script - variables like your "CountX" are local to the script and will not cross scripts. If you want to run a different script, you can use the 'start' command to do it (and use a Global to cross data back and forth).
What I thought. Related to using Scripts to reset an Element for a different brew. For example, a Bitter Hop Timer for 90 minutes vs 60 minutes. Would be nice if you could so as to create a Script for different Brews with its own Timers, Alarms and Temperatures. I know it can be done with Scripts as before 1.1x
You could do it with regular scripts and different timers quite a few different ways. It would just be nice to be able to change it where it is most easy and without a lot of script or thought. I think you added the Alarm on the Timer to make it more user friendly and it is. If we only brewed the same beer all the time, it would not be an issue at all. It is just that you created the "easy way" but only able to change manually.Why not just leave the threshold at zero, then change the timer value with the script?
new datetime trigger
trigger = "04-30-2019 10:00:00 PM"
print trigger
new time change
change = 1:00:00
new datetime future
future = trigger + change
print future
if future > trigger
print "Yes"
else
print "Nope"
endif
stop "Test"
Hi BC users,
I received a couple of questions about date/time manipulation, so wanted to post up a sample that may shed some light. In this "Test" script example, we define a date/time variable named 'trigger', assign it to a date/time, then print it (to the Output tab). We then define a time variable 'change', and make it one hour. We then define another date/time, and add the 'change' time variable to it, then print it. Finally, we compare the two date/time variables and generate a print out as a result (will always resolve to "Yes" here).
If you wanted to do a comparison to the current time, use the intrinsic 'now' variable (for example: trigger = now). Also, if you wanted to add days rather than hours, you can include days in the time variable (for example: change = 1:00:00:00).
Hopefully this sheds some light. Please let us know if you have any questions, issues, or concerns!
Code:new datetime trigger trigger = "04-30-2019 10:00:00 PM" print trigger new time change change = 1:00:00 new datetime future future = trigger + change print future if future > trigger print "Yes" else print "Nope" endif stop "Test"
Enter your email address to join: