Wireless transmission stability

I integrated the temperature and humidity sensor rak1901, ultraviolet sensor rak12019, ultrasonic sensor rak18032 and gas sensor into the rak19001 substrate, and connected them with the rak7268cv2 gateway. The sensor data could be transmitted to the gateway, but after a few days (about a week), the sensor data could be transferred to the gateway. The data suddenly can not reach the gateway, the serial port connection is interrupted, the serial port no longer prints data.
what is the problem,?how to locate it?

Welcome to the forum @harthun

If the device is not responding on the USB/Serial port anymore, it is most likely your code crashed.

What WisBlock Core module are you using?
Are you using RUI3 or open source Arduino BSP?
Can you share your code?

The WisBlock core I use is rak4630, which has been rolled back and downgraded from rui3 to Arduino BSP. My code is to integrate the example codes of temperature and humidity sensor rak1901, ultraviolet sensor rak12019 and ultrasonic sensor 18032 etc.
Now I wonder if it is the problem of connecting the code with lora.
The following are some function definitions of the code, which are also transplanted from the transmission routine.

Can you share the full code. You can attach the .ino file here.

This part:

should throw compilation errors, line 38 makes no sense.

Do you have a RAK4630/RAK4631 for CN470? Is there a (L) marking somewhere on the label of the Core module?