[Solved] Slider widget glitch/lag

Guess you asked @wiipro? (as I have only one slider: on V11)

1 Like

yes

1 Like

I see that sometimes virtual write to pin 1 is coming to the app with a value = 0 when you are dragging the thumb of the slider, and itā€™s usual in the app - sometimes it even comes 2 times during 1 sec.

Thats strange, hmmmm. It doesnt make senseā€¦ Iā€™m not sending any values 2 times per sec, only one time/2secs and iā€™m only updating gauges and value displays. Also, iā€™ve checked it right know, and thereā€™s nothig which can send 0 from HW. Only actual value of slider. I will send you new log ASAP. Intial value of slider will be 255 and not 0 as before, because i thing that affected this in bad way.

Sometimes it is two times per second, usually - one time per 2. Here is log for virtual write to pin 1

00:34:29 messageId = 42232, actionId = 20, value = 2vw10
00:34:31 messageId = 42244, actionId = 20, value = 2vw10
00:34:31 messageId = 42251, actionId = 20, value = 2vw10
00:34:33 messageId = 42263, actionId = 20, value = 2vw10
00:34:34 messageId = 42270, actionId = 20, value = 2vw10
00:34:35 messageId = 42282, actionId = 20, value = 2vw10
00:34:37 messageId = 42294, actionId = 20, value = 2vw10
00:34:38 messageId = 42301, actionId = 20, value = 2vw10
00:34:39 messageId = 42313, actionId = 20, value = 2vw10
00:34:41 messageId = 42325, actionId = 20, value = 2vw10
00:34:42 messageId = 42332, actionId = 20, value = 2vw10
00:34:43 messageId = 42344, actionId = 20, value = 2vw10
00:34:45 messageId = 42357, actionId = 20, value = 2vw10
00:34:46 messageId = 42364, actionId = 20, value = 2vw10
00:34:47 messageId = 42376, actionId = 20, value = 2vw10
00:34:49 messageId = 42388, actionId = 20, value = 2vw10
00:34:50 messageId = 42395, actionId = 20, value = 2vw10
00:34:51 messageId = 42407, actionId = 20, value = 2vw10
00:34:53 messageId = 42419, actionId = 20, value = 2vw10
00:34:53 messageId = 42426, actionId = 20, value = 2vw10

1 Like

Ok, Iā€™ll wait for a new log

Sended

Almost the same story - a lot of virtual write with value=255 , except that sometimes appā€™s receives not only 255, but some other values

Could you attach here the screenshot of your sliderā€™s settings?

Sure:


But it doesnā€™t jump to 255, it jumps straight to 0, thats why it seems strange to me.

BTW: this is the function iā€™m calling every 2 seconds.

void push()
{
#ifndef TEST
	DateTime now = rtc.now();
#endif
	bool high = false;
	bool low = false;
	double watertemp = temp.getTemp();
	byte airtemp = dht.readTemperature();
	byte humidity = dht.readHumidity();
#ifndef BT
	if (watertemp > 35 && high == false) {
		Blynk.email("AquaDuino Temp Warning", "Water temperature is too high(>35Ā°C)");
		high = true;
	}
	if (watertemp < 35 && high == true) {
		high = false;
	}
	if (watertemp <22 && low == false) {
		Blynk.email("AquaDuino Temp Warning", "Water temperature is too low(<22Ā°C)");
		low = true;
	}
	if (watertemp >22 && low == true) {
		low = false;
	}
#endif
	Blynk.virtualWrite(V4, watertemp);
	Blynk.virtualWrite(V5, airtemp);
	Blynk.virtualWrite(V6, humidity);
	
#ifndef TEST
	Blynk.virtualWrite(V14, now.hour());
	Blynk.virtualWrite(V15, now.minute());
	byte MM = now.minute();
	byte HH = now.hour();
	int min = MM * 60;
	long hod = HH *3600L;
	secnow = hod + min;
#endif
}

I also tried setting timer to 10secs, but it doesnā€™t help tho. This function is the only one that is timed.

EDIT:
OK I GOT IT! :smiley: somewhere deep in my 800 lines of code was hidden one broken line which caused the troubles! Works great now guys. Sorry for bothering you with this shitty question.

2 Likes

mine still likes to run out of my finger sometimesā€¦

Iā€™m investigating your log - it also has some strange things, but most probably caused by some applicationā€™s bugs, iā€™ll later inform you.

Most of the time it is a bad sketch rather than a bad library that causes the problem and I started a post 1 hour ago to ask for your sketch. Then I thought better of it and cancelled the post.

I know and actually i was checking it three time line by line, but i was little sleepy, because Iā€™ve done that at around 11PM so i didnā€™t noticed it.

Do you have a bad sketch too @marvin7?

1 Like

Who knows? The device itself runs fine and does what it is supposed to do, but Iā€™m not a professional programmer. I wouldnā€™t be surprised if something would hide between over 1000 linesā€¦ (not including screen graphics bitmaps). Letā€™s wait for @BlynkAndroidDev findings, then we will be able to pinpoint possible bug.

Try a 10 line slider sketch.

@vshymanskyy could it be because of a kind of ā€œloopā€? To summarize:

this is called periodically (10secs),
Blynk.virtualWrite(V11, (int)(Tc_set * 2.0));

that is because Tc__set can be changed from hardware side too

this one is called by widget ā€œon releaseā€:

BLYNK_WRITE(V11) { // Blynk Temp SET slider
	int pinValue = param.asInt();
	pinValue = constrain(pinValue, 10, 50);
	Tc_set = (float)pinValue / 2.0;
	delay(200);
	Blynk.virtualWrite(V5, Tc_set); // this is a display widget
	delay(200);
	Serial.print(F("Restoring preset temperature threshold: Tset "));
	Serial.println(Tc_set, 1);
}

At most it works, but sometimes it ā€œgets illā€ I have to play with the slider for a while to catch it.

@Costas: I assume it just works :wink:

As I thought @marvin7, a bad sketch.

If you are dragging the slider when the 10s timer kicks in you get the crazy slider performance.

You would need to stop the timer in the slider function and then restart it at the end of the slider function.

1 Like