Skip to content

Commit

Permalink
fix projector error message display (openhab#11953)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
Signed-off-by: Nick Waterton <n.waterton@outlook.com>
  • Loading branch information
mlobstein authored and NickWaterton committed Apr 27, 2022
1 parent 823e1a1 commit 2dd7d57
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public enum EpsonProjectorCommandType {
VREVERSE("verticalreverse", SwitchItem.class),
BACKGROUND("background", StringItem.class),
ERR_CODE("errcode", NumberItem.class),
ERR_MESSAGE("errmessage", StringItem.class),;
ERR_MESSAGE("errmessage", StringItem.class);

private final String text;
private Class<? extends Item> itemClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ public int getError() throws EpsonProjectorCommandException, EpsonProjectorExcep
* Error Code Description
*/
public String getErrorString() throws EpsonProjectorCommandException, EpsonProjectorException {
int err = queryInt("ERR?");
int err = queryHexInt("ERR?");
return ErrorMessage.forCode(err);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,29 @@
*/
@NonNullByDefault
public enum ErrorMessage {
NO_ERROR(0, "No error"),
ERROR1(1, "Fan error"),
ERROR3(3, "Lamp failure at power on"),
ERROR4(4, "High internal temperature error"),
ERROR6(6, "Lamp error"),
ERROR7(7, "Open Lamp cover door error"),
ERROR8(8, "Cinema filter error"),
ERROR9(9, "Electric dual-layered capacitor is disconnected"),
ERROR10(10, "Auto iris error"),
ERROR11(11, "Subsystem error"),
ERROR12(12, "Low air flow error"),
ERROR13(13, "Air filter air flow sensor error"),
ERROR14(14, "Power supply unit error (ballast)"),
ERROR15(15, "Shutter error"),
ERROR16(16, "Cooling system error (peltier element)"),
ERROR17(17, "Cooling system error (pump)"),
ERROR18(18, "Static iris error"),
ERROR19(19, "Power supply unit error (disagreement of ballast)"),
ERROR20(20, "Exhaust shutter error"),
ERROR21(21, "Obstacle detection error"),
ERROR22(22, "IF board discernment error");
NO_ERROR(0, "00 : No error"),
ERROR1(1, "01 : Fan error"),
ERROR3(3, "03 : Lamp failure at power on"),
ERROR4(4, "04 : High internal temperature error"),
ERROR6(6, "06 : Lamp error"),
ERROR7(7, "07 : Open Lamp cover door error"),
ERROR8(8, "08 : Cinema filter error"),
ERROR9(9, "09 : Electric dual-layered capacitor is disconnected"),
ERROR10(10, "0A : Auto iris error"),
ERROR11(11, "0B : Subsystem error"),
ERROR12(12, "0C : Low air flow error"),
ERROR13(13, "0D : Air filter air flow sensor error"),
ERROR14(14, "0E : Power supply unit error (ballast)"),
ERROR15(15, "0F : Shutter error"),
ERROR16(16, "10 : Cooling system error (peltier element)"),
ERROR17(17, "11 : Cooling system error (pump)"),
ERROR18(18, "12 : Static iris error"),
ERROR19(19, "13 : Power supply unit error (disagreement of ballast)"),
ERROR20(20, "14 : Exhaust shutter error"),
ERROR21(21, "15 : Obstacle detection error"),
ERROR22(22, "16 : IF board discernment error"),
ERROR23(23, "17 : Communication error of \"Stack projection function\""),
ERROR24(24, "18 : I2C error");

private final int code;
private final String message;
Expand All @@ -64,7 +66,9 @@ public static String forCode(int code) {
try {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst().get().getMessage();
} catch (NoSuchElementException e) {
return "Unknown error code: " + code;
// for example, will display 10 as '0A' to match format of error codes in the epson documentation
return "Unknown error code (hex): "
+ String.format("%2s", Integer.toHexString(code)).replace(' ', '0').toUpperCase();
}
}
}

0 comments on commit 2dd7d57

Please sign in to comment.