ST-node-ethernet-ip icon indicating copy to clipboard operation
ST-node-ethernet-ip copied to clipboard

I can't write to a tag, that does reads successfully.

Open William-Brumble opened this issue 2 years ago • 2 comments

Summary:

I want to write to some indexes inside an array in a program scope tag. I'm able to read the tags, but when I attempt to write I get the following error:

Error: TIMEOUT occurred while writing Writing Tag: Program:[program].[tag-name]

Do you guys have a discord server?

Current Behavior:

When attempting to write to a tag array it's rejecting the promise on a TIMEOUT error.

Expected Behavior:

Write to manipulated tag array indexes.

Context

export const sendCommand = async (command: Command) => {
    try {
        const PLC = new Controller();
        await PLC.connect(command.ip, command.slot);

        const programName = command.commandTag.split(":")[1].split(".")[0];
        const tagName = command.commandTag.split(".")[1];
        const tagObj = new Tag(tagName, programName, Types.REAL, 0, 1, 1000);

        await PLC.readTag(tagObj);

        for (let i = 0; i < command.parameters.length; i++) {
            const parameter = command.parameters[i];
            tagObj.value[i] = parameter.value;
        }
        tagObj.value[command.offsetNum] = command.command;

        await PLC.writeTag(tagObj); // rejects this promise

        await PLC.disconnect();
    } catch (error) {
        console.log(error);
    }
};

Environment:

  • Package version (Use npm list - e.g. 1.0.6): 2.6.7
  • Node Version (Use node --version - e.g. 9.8.0): 18.16.1
  • Operating System and version: Ubuntu 23.04
  • Controller Type (eg 1756-L83E/B): 1756-L84E
  • Controller Firmware (eg 30.11): 32.013

William-Brumble avatar Nov 23 '23 16:11 William-Brumble

To update this issue, it was being caused by the large array, 1k elements. When I lowered the number of elements the timeouts went away.

William-Brumble avatar Dec 16 '23 02:12 William-Brumble

Yep. That is a bug / missing implementation. Latest commit should work 59141c7 . pull from repo and try out. Not published to NPM yet. You will have to run npm run build where it installed to compile the Typescript.

SerafinTech avatar Dec 18 '23 02:12 SerafinTech