fix projector error message display (#11953)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
pull/11961/head
mlobstein 2022-01-04 02:28:34 -06:00 committed by GitHub
parent 770e897f36
commit e9537f2cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 24 deletions

View File

@ -54,7 +54,7 @@ public enum EpsonProjectorCommandType {
VREVERSE("verticalreverse", SwitchItem.class), VREVERSE("verticalreverse", SwitchItem.class),
BACKGROUND("background", StringItem.class), BACKGROUND("background", StringItem.class),
ERR_CODE("errcode", NumberItem.class), ERR_CODE("errcode", NumberItem.class),
ERR_MESSAGE("errmessage", StringItem.class),; ERR_MESSAGE("errmessage", StringItem.class);
private final String text; private final String text;
private Class<? extends Item> itemClass; private Class<? extends Item> itemClass;

View File

@ -644,7 +644,7 @@ public class EpsonProjectorDevice {
* Error Code Description * Error Code Description
*/ */
public String getErrorString() throws EpsonProjectorCommandException, EpsonProjectorException { public String getErrorString() throws EpsonProjectorCommandException, EpsonProjectorException {
int err = queryInt("ERR?"); int err = queryHexInt("ERR?");
return ErrorMessage.forCode(err); return ErrorMessage.forCode(err);
} }
} }

View File

@ -26,27 +26,29 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
*/ */
@NonNullByDefault @NonNullByDefault
public enum ErrorMessage { public enum ErrorMessage {
NO_ERROR(0, "No error"), NO_ERROR(0, "00 : No error"),
ERROR1(1, "Fan error"), ERROR1(1, "01 : Fan error"),
ERROR3(3, "Lamp failure at power on"), ERROR3(3, "03 : Lamp failure at power on"),
ERROR4(4, "High internal temperature error"), ERROR4(4, "04 : High internal temperature error"),
ERROR6(6, "Lamp error"), ERROR6(6, "06 : Lamp error"),
ERROR7(7, "Open Lamp cover door error"), ERROR7(7, "07 : Open Lamp cover door error"),
ERROR8(8, "Cinema filter error"), ERROR8(8, "08 : Cinema filter error"),
ERROR9(9, "Electric dual-layered capacitor is disconnected"), ERROR9(9, "09 : Electric dual-layered capacitor is disconnected"),
ERROR10(10, "Auto iris error"), ERROR10(10, "0A : Auto iris error"),
ERROR11(11, "Subsystem error"), ERROR11(11, "0B : Subsystem error"),
ERROR12(12, "Low air flow error"), ERROR12(12, "0C : Low air flow error"),
ERROR13(13, "Air filter air flow sensor error"), ERROR13(13, "0D : Air filter air flow sensor error"),
ERROR14(14, "Power supply unit error (ballast)"), ERROR14(14, "0E : Power supply unit error (ballast)"),
ERROR15(15, "Shutter error"), ERROR15(15, "0F : Shutter error"),
ERROR16(16, "Cooling system error (peltier element)"), ERROR16(16, "10 : Cooling system error (peltier element)"),
ERROR17(17, "Cooling system error (pump)"), ERROR17(17, "11 : Cooling system error (pump)"),
ERROR18(18, "Static iris error"), ERROR18(18, "12 : Static iris error"),
ERROR19(19, "Power supply unit error (disagreement of ballast)"), ERROR19(19, "13 : Power supply unit error (disagreement of ballast)"),
ERROR20(20, "Exhaust shutter error"), ERROR20(20, "14 : Exhaust shutter error"),
ERROR21(21, "Obstacle detection error"), ERROR21(21, "15 : Obstacle detection error"),
ERROR22(22, "IF board discernment 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 int code;
private final String message; private final String message;
@ -64,7 +66,9 @@ public enum ErrorMessage {
try { try {
return Arrays.stream(values()).filter(e -> e.code == code).findFirst().get().getMessage(); return Arrays.stream(values()).filter(e -> e.code == code).findFirst().get().getMessage();
} catch (NoSuchElementException e) { } 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();
} }
} }
} }