Home Forum Community Jumps in measured data Reply To: Jumps in measured data

#5473
uRADMonitor
Keymaster

Thanks to your findings, I was able to identify a bug in the temperature encoding scheme:

uint16_t double2int(double val) {
	int8_t sintp = (int8_t)val;				//signed integer part
	int8_t sdecp = (val - sintp ) * 100;	//signed decimal part
	uint8_t udecp = sdecp>0?sdecp:-1*sdecp; //removed decimal sign
	uint8_t uintp = sintp + 127;			//convert to unsigned
	uint16_t res = (udecp << 8) | (uint16_t)uintp;		//pack it together
	return res;
}

The sign is lost when the integer part is 0, exactly all values between 0 and -1. The fix is added to the firmware as we speak, unless it can be solved on the server side.

For CO2, let’s continue herE: https://www.uradmonitor.com/topic/co2-sensor/