Skip to content

Commit

Permalink
Other updates for status lights
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenleomiller committed Apr 13, 2019
1 parent 1365be2 commit 59e9ec2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
#Mon Apr 08 20:20:03 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=permwrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
zipStorePath=permwrapper/dists
11 changes: 9 additions & 2 deletions gradlew
@@ -1,5 +1,10 @@
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
Expand Down Expand Up @@ -126,8 +131,10 @@ if $cygwin ; then
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"`
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option

if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
Expand Down
6 changes: 4 additions & 2 deletions gradlew.bat
@@ -1,8 +1,10 @@
@if "%DEBUG%" == "" @echo off
@rem @rem
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

Expand Down
13 changes: 9 additions & 4 deletions src/main/deploy/config.properties
Expand Up @@ -21,10 +21,11 @@ useStormNet = true
useVision = true
useNavX = true
useIntake = true
useStatusLights = true

# TEST
testStormNet = false
testBackjack = false
useStatusLights = false


# ****************************************************************************************************
Expand Down Expand Up @@ -62,8 +63,10 @@ vacValve = 4
# **********
# DIO CHANNELS
# **********
vacPressureSensorLowDIO = 2
vacPressureSensorHighDIO = 3
vacPressureSensorLowDIO = 1
vacPressureSensorHighDIO = 0
vacInsufficientLightDIO = 2
vacArmedLightDIO = 3
ballProxSensorDIO = 4
hatchProxSensorDIO1 = 5
hatchProxSensorDIO2 = 6
Expand Down Expand Up @@ -148,6 +151,8 @@ udpListenerPort=5423
# **********
highVacuumKPa=70
lowVacuumKPa=60
warnVacuumKPa=40

maxVenturiTime = 5.0
hatchProxCount = 3

Expand All @@ -156,4 +161,4 @@ hatchProxCount = 3
# **********
dock_brightness = 15
visionTable = vision

elevatorPlacementPosition = 12150
1 change: 0 additions & 1 deletion src/main/deploy/r1.properties
Expand Up @@ -9,7 +9,6 @@ useStormNet = true
useBackjack = true
useIntake = true
useVision = true
useStatusLights = false

# Compressor channels
hatchValve = 1
Expand Down
Expand Up @@ -106,6 +106,8 @@ public void setStatusLights(StatusLight light, int state){

if (!Robot.useStatusLights) return;

// System.out.println("VacArmed.get = " + vacArmedLight.get() + " VacInsufficient.get = " + vacInsufficientLight.get());

switch(light){
// case Precision:
// if(s!=0) lightPort.writeString("0t\n"); else lightPort.writeString("0f\n");
Expand Down
Expand Up @@ -24,6 +24,7 @@ public class ValveControl extends Subsystem {

private final double highVacuum;
private final double lowVacuum;
private final double warnVacuum;

private double currentVac;

Expand Down Expand Up @@ -84,6 +85,7 @@ public ValveControl() {

highVacuum = StormProp.getNumber("highVacuumKPa",0.0);
lowVacuum = StormProp.getNumber("lowVacuumKPa",0.0);
warnVacuum = StormProp.getNumber("warnVacuumKPa",0.0);

addChild("Pressure Sensor", vacPressureSensor);

Expand All @@ -105,13 +107,7 @@ public void initDefaultCommand() {
public void periodic() {
manageVac(); // sets currentVac
if(Robot.useStatusLights){
if(currentVac < lowVacuum){
if(!lastState) Robot.setStatusLight(StatusLight.Vacuum, 1);
lastState = false;
}else if(currentVac > highVacuum){
if(lastState) Robot.setStatusLight(StatusLight.Vacuum, 0);
lastState = true;
}
Robot.setStatusLight(StatusLight.Vacuum, currentVac < warnVacuum ? 1 : 0);
}
}

Expand Down

0 comments on commit 59e9ec2

Please sign in to comment.