diff --git a/package.json b/package.json index b50ae32f1..8a90807d6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "open-plc-editor", "description": "OpenPLC Editor - IDE capable of creating programs for the OpenPLC Runtime", - "version": "4.2.9", + "version": "4.2.10", "license": "GPL-3.0", "author": { "name": "Autonomy Logic" diff --git a/src/frontend/data/constants/app-version.ts b/src/frontend/data/constants/app-version.ts index 661f491e9..3b99e5528 100644 --- a/src/frontend/data/constants/app-version.ts +++ b/src/frontend/data/constants/app-version.ts @@ -18,4 +18,4 @@ * compares a per-deploy `BUILD_ID` (git commit SHA), not this version, so a * stale tab is detected on every deploy even without a version bump. */ -export const APP_VERSION = '4.2.9' +export const APP_VERSION = '4.2.10' diff --git a/src/frontend/store/__tests__/project-validation-variables.test.ts b/src/frontend/store/__tests__/project-validation-variables.test.ts index 3a058464d..5c1611677 100644 --- a/src/frontend/store/__tests__/project-validation-variables.test.ts +++ b/src/frontend/store/__tests__/project-validation-variables.test.ts @@ -507,6 +507,15 @@ describe('updateVariableValidation', () => { expect(result.ok).toBe(true) }) + it.each(['%QX0.0', '%IX0.0', '%MX0.0', '%MX3.7'])( + 'accepts every valid IEC area prefix for BOOL locations (%s)', + (location) => { + const boolVar = makeVariable('Test', 'BOOL', '') + const result = updateVariableValidation([], { location }, boolVar) + expect(result.ok).toBe(true) + }, + ) + it('returns ok: true when location is valid for WORD type', () => { const wordVar = makeVariable('Test', 'WORD', '') const result = updateVariableValidation([], { location: '%QW0' }, wordVar) diff --git a/src/frontend/store/slices/project/validation/variables.ts b/src/frontend/store/slices/project/validation/variables.ts index b8baf4ee2..24a570ac9 100644 --- a/src/frontend/store/slices/project/validation/variables.ts +++ b/src/frontend/store/slices/project/validation/variables.ts @@ -153,7 +153,7 @@ const variableLocationValidation = (variableLocation: string, variableType: stri const variableLocationValidationErrorMessage = (variableType: string) => { switch (variableType.toUpperCase()) { case 'BOOL': - return 'Valid locations: %QX0.0..7, %IX0.0..7 (change the number to the desired location)' + return 'Valid locations: %QX0.0..7, %IX0.0..7, %MX0.0..7 (change the number to the desired location)' case 'INT': case 'UINT': case 'WORD': diff --git a/src/frontend/utils/PLC/address-constants/types.ts b/src/frontend/utils/PLC/address-constants/types.ts index 7ef3179a2..5ab477d40 100644 --- a/src/frontend/utils/PLC/address-constants/types.ts +++ b/src/frontend/utils/PLC/address-constants/types.ts @@ -1,6 +1,7 @@ export const PLC_ADDRESS_PREFIX = { BOOL_OUTPUT: '%QX', BOOL_INPUT: '%IX', + BOOL_MEMORY: '%MX', WORD_OUTPUT: '%QW', WORD_INPUT: '%IW', WORD_MEMORY: '%MW', @@ -12,7 +13,10 @@ export const PLC_ADDRESS_PREFIX = { LWORD_MEMORY: '%ML', } as const -export const BOOL_LOCATION_REGEX = /^%[QI]X\d+\.\d$/ +// Accept every valid IEC area prefix — input (I), output (Q) and memory (M). +// `%MX` memory bits are legitimate (e.g. Modbus coils) and were previously +// rejected here, unlike the word-width regexes below which already allow M. +export const BOOL_LOCATION_REGEX = /^%[QIM]X\d+\.\d$/ export const WORD_LOCATION_REGEX = /^%[QIM]W\d+$/ export const DWORD_LOCATION_REGEX = /^%[QIM]D\d+$/ export const LWORD_LOCATION_REGEX = /^%[QIM]L\d+$/