Project Background
The HMI handles temperature acquisition, industrial camera preview and image storage, equipment status display and process-script execution. Site feedback focused on interrupted temperature curves, unstable image-storage cadence, delayed preview and Sub temperature setpoints not changing as expected on hardware.
Diagnosis
The diagnosis covered site logs, database records, serial communication and the camera threading model. COM5 connected multiple Modbus temperature controllers at 9600 baud. The previous polling strategy frequently read a wide register range with typical responses of about 75 bytes. The camera path was also affected by the GUI event loop, slow database batches and grab-state locking.
Fix Implementation
High-frequency temperature polling was reduced to commonly used PV/SP/WorkingSP registers 1 to 5, bringing typical responses to about 15 bytes. Ramp Rate moved to independent low-frequency hardware readback. Setpoints were treated as Celsius values. Sub write success now requires an exact 0x06 response match and SP-register readback instead of only checking bytes written by the PC serial port.
Camera Path Changes
Camera acquisition was changed from GUI-timer dependency to a self-driven worker thread. Raw-frame and preview events are limited to one in-flight task. QPixmap remains in the GUI thread. JPEG storage is triggered by new frames and records the actual capture timestamp. Watchdogs were added for capture stalls and save scheduling.
Verification Result
The delivery stage completed SHA-256 consistency checks for 12 source files between the customer machine and local source, and a Debug build exited with code 0. To avoid occupying camera and serial resources in a non-interactive remote session, the program was not launched through SSH. Long-duration field validation should be recorded after the customer starts it on the local desktop.
Applicable Scenarios
This delivery pattern applies to existing industrial HMIs, equipment-control applications and field data-acquisition systems with intermittent failures, thread stalls, insufficient serial-protocol confirmation, or tightly coupled camera capture and storage paths. Production release and continuous-operation acceptance should follow site criteria, device access and customer records.