O2 Sensor and Pump Working!
Hey Folks! Think I finally got the O2 system working. Finally!
I tried one more thing this morning to get the more generalized system working, but just kept hitting the same roadblock from different directions. The GUI and the Pump code just cannot see each other reliably enough. So as an alternative, I made the UI specific to the air pump. Doing this let me add some code to update the pumping code any time the user changes sensor settings in the UI.
There were a few more minor issues that came up as a result. For one thing, the sensor replaces itself when it changes mode, so I couldn't just keep a reference to the sensor. I had to re-acquire the sensor each time I needed it in case the old reference was dead.
But it's working now! I fired-up the ship, and the sensor tripped the O2 alarm, causing the air pump to start drawing from the O2 canister. It pumped until the room had 20% partial atmospheric pressure of O2, then the sensor turned the alarm off, and the pump followed suit!
I even had the crew start walking around from room to room, causing the pressure to drop as empty each room filled with O2 from the main room. And opening an external airlock seemed to eventually result in the pump keeping about a third of the normal O2 levels, struggling against pressure loss through the door.
In theory, setting up the N2 version should be a pretty quick copy-paste. I decided to change the artwork a bit so each sensor looked different. Basically, colors to match the canister types for the gas they detect. I haven't gotten that running yet, since there's a conduit issue I'm debugging. But I'm glad I can at least enjoy my weekend now that I've had a minor victory :)
Speaking of, I may be out of the office Monday. Still to be determined. But if you don't hear from me then, I'll be back Tuesday. Have a good one, all!