BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Joystick Write Interval Overwritten By Slider

Hardware/Software Details

Blynk library version: 0.6.1
IDE: Arduino
IDE version: 1.8.12
Board type: Arduino Pro Mini
Additional modules: HC-05
App Version: 2.27.14
Platform: Android

Steps to reproduce

  1. Create app with a joystick and a slider (vertical or horizontal)
  2. Set slider “Send on release” to ON
  3. Set joystick “Write interval” to a large value (1sec)
  4. Print something in joystick BLYNK_WRITE to know when it’s being called
  5. Start app and move joystick to confirm print is happening at 1sec interval
  6. Move the slider to new value
  7. Now move the joystick again after changing the slider

Expected Result

Joystick BLYNK_WRITE should always be called at 1sec interval.

Actual Result

Joystick BLYNK_WRITE is being called at 100ms when the write interval setting is still set to 1sec after adjusting the slider.

Notes

Stopping the app and changing the slider “Send on release” to OFF and re-running does not change the result after it is in this state. You must change the “Send on release” to OFF in the slider settings and then close/reopen the app for the joystick write interval to fix itself.

This line in the documentation leads to some confusion, as it mentions enabling “Send on release” when there is only a write interval in the joystick settings. I believe the interval was implemented later and it just wasn’t updated:

For example, when you move joystick widget, commands are streamed to the hardware, during a single joystick move you can send dozens of commands. There are use-cases where it’s needed, however creating such a load may lead to hardware overload and reset. Send On Release is a recommended setting for majority of applications. This is also a default setting.

Related Issues

These issues were just a few that I found mentioning something similar:


Code

My setup is a little unorthodox as it’s a bluetooth module wired straight to Serial in direct connect mode (through an accompanying voltage divider/capacitor and a transistor to invert the HC-05 state pin for auto reset). This allows me to wireless program the arduino pro mini over the same serial device since it does not have usb (hence the 57600 baud rate set in the code and also in the HC-05 AT settings). However that doesn’t seem to be related to this issue, and is instead an app UI issue. I can provide a schematic for anyone who is interested, as this was an awesome little hack that works great. The limitations are: 1) No blynk debug without a seperate software serial, which is why I’m using terminal.print() instead of Serial.print() here. 2) The slower baud rate limits how complex your app is and the number of widgets and relies heavily on intervals and timers to not overflow/flood the buffer, which is why a joystick spamming at 100ms is undesirable.


#define BLYNK_USE_DIRECT_CONNECT
#include <BlynkSimpleSerialBLE.h>
#define SerialBLE  Serial

#define VPIN_TERMINAL V0
#define VPIN_JOYSTICK V1
#define VPIN_VSLIDER V2

char auth[] = "*****"

WidgetTerminal terminal(VPIN_TERMINAL);

BLYNK_WRITE(VPIN_JOYSTICK)
{
  terminal.print(F("X:" ));
  terminal.print(param[0].asInt());
  terminal.print(F(" Y:"));
  terminal.print(param[1].asInt());
  terminal.print(F(" t:"));
  terminal.println(millis());
  terminal.flush();
}

BLYNK_WRITE(VPIN_VSLIDER)
{
  terminal.print(F("S:"));
  terminal.print(param[0].asInt());
  terminal.print(F(" t:"));
  terminal.println(millis());
  terminal.flush();
}

void setup() {
  SerialBLE.begin(57600);
  Blynk.begin(SerialBLE, auth);

  terminal.clear();
  terminal.println(F("Blynk v" BLYNK_VERSION));
  terminal.flush();
}

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

Did my last hope of due diligence and joined the app’s beta program.
No go with version 2.28.0, same issue.

To summarize there seem to be two issues in the app:

  1. Slider resets joystick write interval to 100ms (no matter what it’s set to in the settings) after slider value has changed, and when the sliders “Send on release” setting is ON.
  2. Turning OFF sliders “Send on release” setting and re-running doesn’t fix the joystick write interval issue until app is restarted (even if joystick write interval value is changed). After restarting the app, joystick write interval works as intended.
1 Like

Thank you for a such detailed report. I will this thread later when the issue will be fixed.

Of course! The result of being a QA engineer in a past life and the persistence of debugging till it works. Honestly I don’t think I would have figured it out if it wasn’t for the hardware limitation in this setup which was causing crashes on the real sketch.The closing of the app part to reset it was driving me crazy and the hardest to pin down, since it would work sometimes and not others. Mainly after returning to the debugging after hours of banging my head against the wall haha.

Thanks for everything, this app is incredible and I know what it’s like keeping something as complex as this maintained!

1 Like

Right, actually we added this write frequency for BLE/Bluetooth widgets, as they usually cant handle lots of write commands, which can be produced by such widgets.

Super cool catch. I will upload tomorrow a beta update with a fix to this issue.

1 Like

Sounds good, I look forward to it! Thanks again for the quick response and fix. Always open to further QA testing if needed too :wink:

1 Like

Just tested the new beta (looks like it’s the same version number v2.28.0, just updated 4/16) with the same code posted above, seems to work great!

No crashes on my real sketch either so I couldn’t be happier! Will hopefully share the full project with the community when I have a little more time to polish and do a proper write-up.

Thanks again for the speedy fix, I really appreciate it!

2 Likes