describeBit method

String describeBit(
  1. int bitPosition,
  2. int bitValue
)

Helper function to describe the function of each bit according to the common ESC/POS standard

Implementation

String describeBit(int bitPosition, int bitValue) {
  bool isSet = bitValue != 0;
  switch (bitPosition) {
    case 0:
      return "Possibly reserved/model specific";
    case 1:
      return isSet ? "Possible additional drawer indicator" : "Normal";
    case 2:
      return isSet ? "Drawer open" : "Drawer closed";
    case 3:
      return isSet ? "Printer OFFLINE" : "Printer ONLINE";
    case 4:
      return isSet
          ? "Model specific indicator (Could be paper sensor)"
          : "Normal";
    case 5:
      return isSet ? "Cover OPEN" : "Cover CLOSED";
    case 6:
      return isSet ? "Manual paper feed activated" : "Normal paper feed";
    case 7:
      return isSet ? "ERROR present" : "No error";
    default:
      return "Unknown";
  }
}