mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-09 12:56:02 -04:00
fixes some display components that don't handled high-z inputs correctly
This commit is contained in:
parent
8ee40a3d49
commit
e7dd999e3d
@ -71,7 +71,7 @@ public class ButtonLEDShape extends ButtonShape {
|
||||
public void drawTo(Graphic graphic, Style heighLight) {
|
||||
super.drawTo(graphic, heighLight);
|
||||
|
||||
boolean ledOn = ledValue == null || ledValue.getBool();
|
||||
boolean ledOn = ledValue == null || (ledValue.getBool() & !ledValue.isHighZ());
|
||||
boolean pressed = button != null && button.isPressed();
|
||||
|
||||
Vector center;
|
||||
|
@ -6,6 +6,7 @@
|
||||
package de.neemann.digital.draw.shapes;
|
||||
|
||||
import de.neemann.digital.core.Bits;
|
||||
import de.neemann.digital.core.ObservableValue;
|
||||
import de.neemann.digital.core.element.ElementAttributes;
|
||||
import de.neemann.digital.core.element.Keys;
|
||||
import de.neemann.digital.core.element.PinDescriptions;
|
||||
@ -67,13 +68,20 @@ public class RGBLEDShape implements Shape {
|
||||
@Override
|
||||
public void readObservableValues() {
|
||||
if (ioState != null) {
|
||||
long r = ioState.getInput(0).getValue() * 255 / max;
|
||||
long g = ioState.getInput(1).getValue() * 255 / max;
|
||||
long b = ioState.getInput(2).getValue() * 255 / max;
|
||||
long r = getCol(ioState.getInput(0));
|
||||
long g = getCol(ioState.getInput(1));
|
||||
long b = getCol(ioState.getInput(2));
|
||||
color = new Color((int) r, (int) g, (int) b);
|
||||
}
|
||||
}
|
||||
|
||||
long getCol(ObservableValue c) {
|
||||
if (c.isHighZ())
|
||||
return 0;
|
||||
else
|
||||
return c.getValue() * 255 / max;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTo(Graphic graphic, Style heighLight) {
|
||||
if (color == null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user