Author Topic: Slider not reliably logging event  (Read 432 times)

MaMikee

  • RFduino Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Slider not reliably logging event
« on: December 14, 2016, 08:37:12 AM »
I've put a slider on my iPhone 5 screen that only calls the ui_event () routine about a third of the time when I move it.

Anyone else seen this?  Is it a known problem with a workaround?

Thanks,

mcb

JeffNYC

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Slider not reliably logging event
« Reply #1 on: February 21, 2017, 08:04:46 PM »
Also seeing this problem.  Any solutions?

JeffNYC

  • RFduino Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Slider not reliably logging event - SOLUTION
« Reply #2 on: February 22, 2017, 04:45:54 PM »
I figured out what was causing the problem and wanted to share it here in case others encounter this.  The problem was I did not have any delay mechanism in my loop() code so the Simblee-Phone communication was getting overloaded as I added more elements and data exchange.  So while initially with a 'light' interface there were no delay issues or lost actions, as I developed the page the problems began to appear and worsen to point of being unusable.

Here's what you need to be sure to have in your code to avoid this:
Code: [Select]
unsigned long updateRate = 200; // in milliseconds  (200ms worked for me, but I've seen 500ms in other examples)

void loop() {
  unsigned long loopTime = millis();
 
  if (SimbleeForMobile.updatable && updateRate < (loopTime - lastUpdated)){
    lastUpdated = loopTime;

   // put all your SimbleeForMobile.updateValue (or Text) calls inside here

  {
...
}

I wish the documentation had been clearer on this.  But I hope this helps others!