I noticed that sometimes some steps lose sync with the server value and they go to value +1 or -1.
And I’m pretty sure it is not me setting the value on the step, because in the code I do it only once at initialization and this happened while the code was running.
EDIT: I’m using the device selector. Might this be linked to the server sync problem when using the device selector? But until now they were related only to tables, LCD and terminal.
Could you please provide some steps in order to reproduce the issue? I’m not sure I got what you mean.
I don’t know what the steps ( what a pun ) to reproduce are.
But I have a device selector, and tabs. Inside a tab I have two steps used with device selector.
In my code I initialize once the step value (between 5 and 10). Then suddenly some steps’ label value goes to 1 or -1 (actually more on 1). I don’t know what is triggering it, but it seems related to the bug of tables, lcd and terminal with the device selector.
I made some tests, and just changing the selected device triggers the issue. Exactly as the other device selector bugs.
Android/ios? Local server or not? What are initial values in step? How do you set step values? Where +1/-1 comes from? What values do you set? What exactly happens when you switch device in device selector? What are actual values and what are expected?
- Android
- Public server
- The initial values are between 5 and 10, and I set them with JS library with v7.write(5) for example; When the code starts I see correctly in the app the steps with value 5.
- At this point I launch different devices/codes and the steps are set accordingly for every device. All the labels are correct.
- Then I change device with device selector, and some of the steps’ values went to 1/-1 (mainly 1). I don’t know where the 1/-1 came from.
- When the step is pressed I see correctly the ±1 in the reading of the step, but the label number is wrong.
Example: one step is set at 5 with v7.write(5). Then I switch with the device selector many times to different devices. I come back to the device where it was set at 5 and the value became 1. If I press the step, it changes the value correctly but starting from 1. For example I press + two times it becomes 3, but it should have been 7 (5+2).
Do you use the bridge? Do you have another widgets on that pin? Does remove/add widget solves the issue?
No bridge, no other widgets on same pin, removing and re-adding didn’t solve the issue
We were not able to reproduce, we need more details. Please post your code.
This is the JS code that uses the pin:
var blynk = new BlynkLib.Blynk(config.BLYNK_TOKEN, {
connector : new BlynkLib.TcpClient()
});
var v12 = new blynk.VirtualPin(12);
v12.on('write', function(param) {
if (parseInt(param) == 1){
config.BIG_DIVIDER++;
} else {
config.BIG_DIVIDER--;
}
});
blynk.on('connect', function() {
v12.write(config.BIG_DIVIDER);
}
That pin is not used elsewhere.
Have you any min/max values changes via ‘set property’ calls? As in your scenario, ‘1’ on pressing ‘+’ will immediately change to the min value of STEP widget, in your case it would be 5, and it could not be 2, as you describe.
@tulo if I’m correct you have ‘send step’ option switch to ‘yes’ and step - ‘1’, do you? @Dmitriy when the step widget sends not its value, but its step - device selector on sync should send its value (it seems we have no value in it in such case), as it seems device selector sends latest virtual write, which is its step value and not the widget’s value.
@tulo you could change ‘send step’ to ‘no’ and make some changes in your sketch, if needed, for current moment, before we’ll fix this issue.
Exactly…
This makes sense on why I see +1 and -1. It depends if I pressed + or - as last command.
Yep, we’ll fix that. For now, it is better to disable ‘send step’ option when using a device selector with the step widget.
This workaround seems to work.