[paradoxalarm] Fix Paradox EVOHD zone parsing fail #10572 (#15441)

* Fix Paradox EVOHD zone parsing fail #10572

* Root cause is that EVOHD and EVO192 have much more zones which are
stored in a different memory map model. They should be treated the same
way. Fix is simple and can be downported to 3.x if decided by the
maintainers

Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
This commit is contained in:
Konstantin Polihronov 2023-08-22 09:47:12 +03:00 committed by GitHub
parent 42ba975660
commit 5f31eeb506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -193,7 +193,7 @@ public class EvoCommunicator extends GenericCommunicator implements IParadoxComm
private void createZoneOpenedFlags(ZoneStateFlags result, byte[] firstPage, byte[] secondPage) { private void createZoneOpenedFlags(ZoneStateFlags result, byte[] firstPage, byte[] secondPage) {
int pageOffset = panelType == PanelType.EVO48 ? 34 : 40; int pageOffset = panelType == PanelType.EVO48 ? 34 : 40;
byte[] firstBlock = Arrays.copyOfRange(firstPage, 28, pageOffset); byte[] firstBlock = Arrays.copyOfRange(firstPage, 28, pageOffset);
if (panelType != PanelType.EVO192) { if (!PanelType.isBigRamEvo(panelType)) {
result.setZonesOpened(firstBlock); result.setZonesOpened(firstBlock);
} else { } else {
byte[] secondBlock = Arrays.copyOfRange(secondPage, 0, 12); byte[] secondBlock = Arrays.copyOfRange(secondPage, 0, 12);
@ -205,7 +205,7 @@ public class EvoCommunicator extends GenericCommunicator implements IParadoxComm
private void createZoneTamperedFlags(ZoneStateFlags result, byte[] firstPage, byte[] secondPage) { private void createZoneTamperedFlags(ZoneStateFlags result, byte[] firstPage, byte[] secondPage) {
int pageOffset = panelType == PanelType.EVO48 ? 46 : 52; int pageOffset = panelType == PanelType.EVO48 ? 46 : 52;
byte[] firstBlock = Arrays.copyOfRange(firstPage, 40, pageOffset); byte[] firstBlock = Arrays.copyOfRange(firstPage, 40, pageOffset);
if (panelType != PanelType.EVO192) { if (!PanelType.isBigRamEvo(panelType)) {
result.setZonesTampered(firstBlock); result.setZonesTampered(firstBlock);
} else { } else {
byte[] secondBlock = Arrays.copyOfRange(secondPage, 12, 24); byte[] secondBlock = Arrays.copyOfRange(secondPage, 12, 24);
@ -217,7 +217,7 @@ public class EvoCommunicator extends GenericCommunicator implements IParadoxComm
private void createZoneLowbatteryFlags(ZoneStateFlags result, byte[] firstPage, byte[] secondPage) { private void createZoneLowbatteryFlags(ZoneStateFlags result, byte[] firstPage, byte[] secondPage) {
int pageOffset = panelType == PanelType.EVO48 ? 58 : 64; int pageOffset = panelType == PanelType.EVO48 ? 58 : 64;
byte[] firstBlock = Arrays.copyOfRange(firstPage, 52, pageOffset); byte[] firstBlock = Arrays.copyOfRange(firstPage, 52, pageOffset);
if (panelType != PanelType.EVO192) { if (!PanelType.isBigRamEvo(panelType)) {
result.setZonesLowBattery(firstBlock); result.setZonesLowBattery(firstBlock);
} else { } else {
byte[] secondBlock = Arrays.copyOfRange(secondPage, 24, 36); byte[] secondBlock = Arrays.copyOfRange(secondPage, 24, 36);

View File

@ -59,6 +59,10 @@ public enum PanelType {
} }
} }
public static boolean isBigRamEvo(PanelType panelType) {
return panelType == EVO192 || panelType == EVOHD;
}
public int getPartitions() { public int getPartitions() {
return partitions; return partitions;
} }