Slider Widget keeps resetting to 0 on Android only

Will do @Costas that was my next plan anyway

Will let you know if I find anything further.

Cheers

kev

Hi @Costas,

Not getting much further with this - It is not just the loop I thought it was it is any of them. ie if the simpletimer calls any loop as you are dragging the slider it jumps to zero. I have proven that the more frequently the loop is called the more the slider will do it so my loop that is called every 200 milliseconds really screws it up.

I even commented out the blynk_write(V29) code (my slider in question) to see if it was interaction with this call and the timer, and that proved it was the timer alone, as the slider still did it.

Would you consider this as a bug as it doesn’t do this in ios and consider a fix, or am I going to have try and work the code with simpletimer in a different fashion (haven’t a clue how though!!)?

Cheers

kev

@newdos perhaps go back to one of your earlier basic sketches that was working ok and add a 200ms timer to see if that indicates a Blynk bug.

I know Blynk have recently done some work with SimpleTimer and I think the minimum setting is now 10ms.

I have to say that the Slider widget is very popular and we are not seeing reports from others of the issue you have. That said most people will not have a 200ms timer in their project.

OK @Costas I will look at that an report back.

Meanwhile I also just had a thought - I note the actual Blynktimer states in the docs that it fixes some issues for use with Blynk. Might it be worth trying this library to see if works with the slider ?

Cheers

kev

I was just going to say upgrade to 0.4.7 if you haven’t already.

If you are using latest Blynk library, you are automatically using BlynkTimer.

@Gunner, @Costas

Ah ok guys guess that’s not going to make any difference then as I am already on v0.4.7. So even though I use simpletimer it’s automatically using blynktimer correct ?

Cheers

kev

Hi @Costas, @Gunner

Think I have found the cause. It seems to be caused by calling a void from a timer that has a virtualwrite within the loop

here is a cut down version of the code that runs on arduino

#include<SimpleTimer.h>
SimpleTimer timer;
int feedback1;            // AC feedback1 variable
int SetPoint1;            // Temp setting for room monitored by DHT22
int AC_Sens1_pin = 3;     // Relay 1 ac sens pin
char auth[] = "xxx";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  //Lets sync up all the store states for the V pins and load the appropriate variables listed below
  Blynk.syncVirtual(V29);            // SetPoint1
  timer.setInterval(200, AC_detect); // Check if the room is occupied via PIR sensor
}

void loop()
{
  Blynk.run();
  timer.run();
}

void AC_detect()
{
  feedback1 = digitalRead(AC_Sens1_pin);
  Blynk.virtualWrite(V2, feedback1); // update SWITCH widget state from AC input only if it has changed
}

BLYNK_WRITE(V29)  // Input from slider in app to set SetPoint1
{
  SetPoint1 = param.asInt();
  Serial.println(SetPoint1);
}

If you comment out the line in the AC_detect void that has the Blynk.virtualwrite in it, the slider works fine, put that line back in and it jumps around all over the place!!

I have also tried this with another loop not called so often ie every second - and if it has the virtualwrite in it, it screws up - take it out and its fine

So, I am hoping you guys will accept this a bug (unless you tell me otherwise!!)

Cheers

kev

@Dmitriy “feature” confirmed with library versions 0.4.6 and 0.4.7 i.e you can’t slide the slider if the slider function contains a virtualWrite.

@newdos good work digging out the feature. You asked in an earlier post how you could fix the issue.

'1. I actually never slide the slider. Might be partly due to the early days when sliding was a definite no, no but also I prefer to “dab” the slider where I think I want to set it at.

or

'2. Set a flag in the slider and then check for the flag outside of the slider function.

@Costas Slider on V29 jumps when you do virtualWrite(V2)? Did I correctly understand?

Yes it jumps to zero @Dmitriy if you move the slider as it is busy trying to do the virtualWrite to V2

Guys could you reproduce this issue with this logging build:
https://www.dropbox.com/s/rpxmo9si2hov9ab/blynk_2.13.3_log.apk?dl=0

And send me generated log?

To send log - open about screen from projects list screen, select ‘send log’ option.

Cheers @Costas glad we managed to isolate the issue and you are correct iif you dab the slider it works ok.

Am I right in assuming the bit @BlynkAndroidDev what reproducing is done by you guys ???

Cheers

kev

This issue is not reproducing on our side, so maybe we still not got smth of it. If it is possible, you could install that logging build and send us logs - so we could check what device is receiving and debug this issue more deeply.

ok no probs can you talk me through how I do this ??

Cheers

Kev

^^^

but do i need to install some code first or just what I was using anyway - what is thst dropbox file further up ???

Cheers

kev

unless i’m looking in he wrong place my about screen doesnt have a send log ???

just checked my ios device and that has send logs my android device doesnt ???

Any ideas i’m using version 2.12.5

Cheers

Kev

Newdos, its an installation file for a version of Blynk which has a broader logging ability.
You download it on your android and install it. You might need to allow “installations from unknown sources” first.

Then you follow the instructions. So start by downloading the apk from the dropbox link, on your android device and install it.