[Partially solved] ISR from SoftwareSerial port

/dev:
Unfortunately, this is highly dependent on execution time (variable), not a timer (consistent).

I understand ... But here the idea of delay implemented, too. (Text output every N iterations). It helped at first. But the code is growing, so I decided to look for another solution.

/dev:
I'm not sure the Nextion library can get and set the label of b0 during b0's callback.

I spied it in the official examples Nextion. This works if there is no interference on the transmission line

/dev:
And using delay is bad.

I do not use the delay. I gave an example of where he wanted to show that the delay does not affect the result. The problem in setText and setValue (anything that clogs the transmission line).

/dev:
Serial can operate in full duplex, so you must be doing something wrong.

Probably...

/dev:
Do you set page=-1 at the end of loop? If not, you will set bt00 every time.
You can't read the temperature (1 second) and print the temperature (5ms) every time.

My previous reply had the correct structure. You didn't like it? :wink:

Status button is installed only once (because pump_state_show = false), when moving to the page 0.

		case 0:
			if (pump_state && pump_state_show)
			{
				pump_state_show = 0;
				bt00.setValue(pump_state);
			}

Your structure is good :wink: , but I can not use it for some reason:

  • I always need to know the current page and enter it in the loop, to always show the current sensor values.
  • If I do text output outside structure switch-case, Nextion works delusional.

For example p.2:

void loop()
{
	nexLoop(nex_listen_list);
	Serial.println(readTemperature(SensorWater));
	t11.setText("dgdgdfg");
	t22.setText("dffsdsd");
	t41.setText("sdfsfsf");
	switch(page)
	{
		case 0:
			if (pump_state && pump_state_show)
			{
				pump_state_show = 0;
				bt00.setValue(pump_state);
			}
			break;
			...
		default:
		break;
	}
}

The text displayed on the current page, even on non-declared elements. Although for the elements t11, t22, t41 explicitly specified page. So do regular text output only being on the correct page.

Subtotal: probably have to do text output only when it changes. It is not clear how to make a drawing of the chart, because he will always be drawn, but would like to have a working button STOP...

Thanks,
Marat