I have a puzzling issue happening and hope that someone has come across it before. My description will be somewhat vague. It is happening in a program that has about 2000 lines of code. This is an arduino compatible plc. Automation Direct P1AM-100 to be specific. It is a MKRZero compatible unit..
So in a nutshell I am using this plc to do building HVAC control. It consists of several modules with various types of inputs and outputs there are about 60 points. Combinations of digital inputs, outputs, analogue inputs, outputs, and relay outputs.
I interface with it though a program written with Xojo using the xojo URL connection control to an ethernet module in the plc setup. Using a pc as a HID I send data from the pc to the plc using json with the ArduinoJson Library.
Everything is working remarkably well and has been up and running for several years.
I use a sqllite db to store the inputs, outputs, control, etc information.
I changed some of the records recently and made it so that the offending ID is now being used.
Now to the problem.
I have a table that has all of the controls source, means to turn the outputs on and off, it may reference another modules inputs or may refer to a function in the plc.
I have a readable point name and store it's id to the plc's memory. When I use the id of 30 the out put that that control id is tied to turns on no matter what. It is the only one that does it. It does not matter which module I use it on as soon as I use the id of thirty it turns on. if the id can be any number from 0 to 42 and it only occurs when the control has an id of 30. very strange. I have gone over the code for many hours trying to sort it out. None of my code is turning it on. My best guess unless someone knows is that it may be happening in the library from the plc mfg.
I thought it could be a mkrZero memory issue but I am using only 35% of space.
I store the control ids in an array of unsigned 8bit integers for use while the program is running.
It looks something like this;
This is a global array. One of many
ModuleNameContol[id]
as soon as it becomes
ModuleNameContol[30]
the output that has this element assigned to turns on.
I can work around it by not using that id, but any ideas are appreciated.