This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
decode_field <- function(x) { | |
nms <- c("No alarm", "Tape Break", "Beta Count Failure", "High Tape Delta Pressure (Tape Advance)", "Pressure Sensor Failure", "Flow Failure", "Nozzle Failure", "Internal Hardware (SPI bus) Failure", "Low Battery", "Delta Temperature Setpoint Exceeded", "Pump Over Temp 48C") | |
nms[bitwAnd(x, c(0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512)) > 0] | |
} | |
decode_field(8) | |
#> [1] "Pressure Sensor Failure" | |
decode_field(64 + 2) | |
#> [1] "Beta Count Failure" | |
#> [2] "Internal Hardware (SPI bus) Failure" | |
decode_field(1 + 32 + 128) |