Squashed commit of the following:

commit a3ccfab0a42414aa169792356bfc47ee8d0d2d7b
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Sep 23 13:56:59 2014 -0400

    Implement zero latch (used to reduce brownout latency) in Java

    Change-Id: I3bf4ffbf20cf3d8a42da4fa1755b4306c49ede34

commit 0af37dfcc0d1172974519c44126973c302385d55
Author: Kevin O'Connor <koconnor@usfirst.org>
Date:   Tue Sep 23 13:03:07 2014 -0400

    Implement zero latch (used to improve brownout latency) in C++

    Change-Id: I62bedd1af65d367c32e2ab0b5a4fc679776eecb5

Change-Id: Ic27f37a9ab45aad82c1f7154d4edfbccfaa19229
This commit is contained in:
Kevin O'Connor
2014-09-26 17:20:57 -04:00
parent 19b2d05236
commit d72ee199fe
13 changed files with 50 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ public class Jaguar extends SafePWM implements SpeedController {
setBounds(2.31, 1.55, 1.507, 1.454, .697);
setPeriodMultiplier(PeriodMultiplier.k1X);
setRaw(m_centerPwm);
setZeroLatch();
UsageReporting.report(tResourceType.kResourceType_Jaguar, getChannel());
LiveWindow.addActuator("Jaguar", getChannel(), this);

View File

@@ -393,37 +393,37 @@ public class PWM extends SensorBase implements LiveWindowSendable {
HALUtil.checkStatus(status.asIntBuffer());
}
protected void setZeroLatch()
{
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
PWMJNI.latchPWMZero(m_port, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
}
private int getMaxPositivePwm() {
return m_maxPwm;
}
;
private int getMinPositivePwm() {
return m_eliminateDeadband ? m_deadbandMaxPwm : m_centerPwm + 1;
}
;
private int getCenterPwm() {
return m_centerPwm;
}
;
private int getMaxNegativePwm() {
return m_eliminateDeadband ? m_deadbandMinPwm : m_centerPwm - 1;
}
;
private int getMinNegativePwm() {
return m_minPwm;
}
;
private int getPositiveScaleFactor() {
return getMaxPositivePwm() - getMinPositivePwm();
} ///< The scale for positive speeds.

View File

@@ -34,6 +34,7 @@ public class Talon extends SafePWM implements SpeedController {
setBounds(2.037, 1.539, 1.513, 1.487, .989);
setPeriodMultiplier(PeriodMultiplier.k2X);
setRaw(m_centerPwm);
setZeroLatch();
LiveWindow.addActuator("Talon", getChannel(), this);
UsageReporting.report(tResourceType.kResourceType_Talon, getChannel());

View File

@@ -36,6 +36,7 @@ public class Victor extends SafePWM implements SpeedController {
setBounds(2.027, 1.525, 1.507, 1.49, 1.026);
setPeriodMultiplier(PeriodMultiplier.k2X);
setRaw(m_centerPwm);
setZeroLatch();
LiveWindow.addActuator("Victor", getChannel(), this);
UsageReporting.report(tResourceType.kResourceType_Victor, getChannel());

View File

@@ -11,6 +11,7 @@ public class PWMJNI extends DIOJNI {
public static native void freePWMChannel(ByteBuffer digital_port_pointer, IntBuffer status);
public static native void setPWM(ByteBuffer digital_port_pointer, short value, IntBuffer status);
public static native short getPWM(ByteBuffer digital_port_pointer, IntBuffer status);
public static native void latchPWMZero(ByteBuffer digital_port_pointer, IntBuffer status);
public static native void setPWMPeriodScale(ByteBuffer digital_port_pointer, int squelchMask, IntBuffer status);
public static native ByteBuffer allocatePWM(IntBuffer status);
public static native void freePWM(ByteBuffer pwmGenerator, IntBuffer status);