Skip to content

Commit

Permalink
feat: add Illumar Smart Lamp
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed May 12, 2024
1 parent 16ec44a commit bb7a717
Show file tree
Hide file tree
Showing 38 changed files with 1,310 additions and 87 deletions.
12 changes: 12 additions & 0 deletions core/src/main/java/mrtjp/projectred/core/BundledSignalsLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ public static void applyChangeMask(byte[] source, byte[] dest, int mask) {
}
}

public static int applyAndGetChangeMask(@Nullable byte[] source, byte[] dest) {
int mask = 0;
for (int i = 0; i < 16; i++) {
byte newVal = source == null ? 0 : source[i];
if (dest[i] != newVal) {
dest[i] = newVal;
mask |= 1 << i;
}
}
return mask;
}

public static byte[] raiseSignal(@Nullable byte[] signal, @Nullable byte[] source) {
if (signal == null) signal = new byte[16];
if (source == null) return signal;
Expand Down
Loading

0 comments on commit bb7a717

Please sign in to comment.