Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/data/constants/app-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/store/slices/project/validation/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/utils/PLC/address-constants/types.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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+$/
Loading