Nevertheless, I did some more investigations based on the helpful discussions here. I understood, that there is a problem, using oled.print(float) and zunoSendReport() together. So in the first step I checked what is happening, when I call these methods in different cycles of the main loop. I saw a significant improvement of stability. Instead of about every 140 cycles the device was blocked only every 900 cycles.
That lead me to the last test. Instead of writing a float value to the oled display, I divided into 2 integers, which I write in a sequence to the display (see the attached nasty lines of code ).
With that solution the device isn't blocked anymore and running smoothly as desired
Now I can go on to finish my project of controlling my Mitsubishi A/C systems via HC 2.
The only thing to do is, to create some PCBs and put all the things together in a case
Code: Select all
ds1820.scanAloneSensor(addr1);
// obtaining readings from the sensor ds18b20
temperature = ds1820.getTemperature(addr1);
// make scaled word value for report
temp=int((temperature*100));
// send data to channel
// data will be send in case of a change of value only
if (abs(temp - lastTemp) >= 5)
{
//zunoSendReport(1);
lastTemp = temp; // store the actual value for the next compare
oled.gotoXY(72,2);
//oled.print(temperature); // This will cause the Z-UNO to block
// Some nasty lines of code to avoid blocking
// The float value for the temperature is converted into 2 integers
// to write them to the OLED display
int temp4Display = ((highByte(temp) * 256 ) + lowByte(temp));
int temp4DisplayH = temp4Display / 100;
int temp4DisplayL = temp4Display - (temp4DisplayH * 100);
oled.print(temp4DisplayH);
oled.print(",");
oled.print(temp4DisplayL);
zunoSendReport(1);
}
delay(30000);