Author Topic: SimbleeForMobile.drawSegment does not always work  (Read 122 times)

AKotowski

  • RFduino Jr. Member
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
SimbleeForMobile.drawSegment does not always work
« on: August 30, 2017, 12:47:29 PM »
In the attached sketch, drawSegment works as expected by providing a value and highlighting the selected segment when touched.  In more complex surroundings it does not seem to work.  In  the SimbleeUITest example the Segment on the Switch/Segment screen is a solid blue bar with no text visible.  The slave segment has numbers 1 to 4.  Selecting segments on the blue bar updates the Segment display with the selected segment and clears the slave segment.  Touching the slave segment also clears the slave segment display.  The segment functions, but the display is just a solid bar.
Is this a bug in SFM, or a problem with the code?

Code: [Select]
#include <SimbleeForMobile.h>

uint8_t segment, value;

void setup() {
  // put your setup code here, to run once:
  SimbleeForMobile.deviceName = "Segment";
  SimbleeForMobile.advertisementData = "Data";
//  SimbleeForMobile.domain = "template.simblee.com";
  SimbleeForMobile.begin();
}

void loop() {
  SimbleeForMobile.process(); 
  delay(250);
}

void ui()

  SimbleeForMobile.beginScreen(GRAY, PORTRAIT);
 
  char *titles[] = { "Zero", "One", "Two", "Three", "Four" };
  segment = SimbleeForMobile.drawSegment(25, 50, 250, titles, countof(titles), RED);
  SimbleeForMobile.updateValue(segment, 1);
 
  SimbleeForMobile.drawText(50, 100, "Value:", BLACK, 14);

  value = SimbleeForMobile.drawText(150, 100, 10, BLACK, 14);

  SimbleeForMobile.setEvents(segment, EVENT_RELEASE);

  SimbleeForMobile.endScreen();
}

void ui_event(event_t &event)
{
  if (event.id == segment) {
       SimbleeForMobile.updateValue(value, event.value);
  }
}



tolson

  • Global Moderator
  • *****
  • Posts: 855
  • Karma: +20/-0
    • View Profile
    • Thomas Olson Consulting
Re: SimbleeForMobile.drawSegment does not always work
« Reply #1 on: September 04, 2017, 12:38:38 PM »
Sorry, I am not following your description about some other sketch. Can you provide a minimum sketch showing exactly what you are describing.

The provided minimal sketch works and does not show what you are describing. The only problem I have with your sketch is the bright red on light grey is hard on the eyes to focus.

AKotowski

  • RFduino Jr. Member
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: SimbleeForMobile.drawSegment does not always work
« Reply #2 on: September 05, 2017, 07:04:44 AM »
Sorry, thats what I tried to do.  But then it works as in my post.  However in the SimbleeForMobile example files there is a sketch named SimbleeUITest.  This program demonstrates the problem.  In the Test switch/segmment API's a blue segment is displayed but all that is visible is a solid blue bar.  The bar works as a segment but just appears as a bar.  Some experimentation led to the realization that when a value is assigned to the segment, it displays as a solid blue bar.

tolson

  • Global Moderator
  • *****
  • Posts: 855
  • Karma: +20/-0
    • View Profile
    • Thomas Olson Consulting
Re: SimbleeForMobile.drawSegment does not always work
« Reply #3 on: September 05, 2017, 08:45:33 AM »
Hopefully, the Pros from RFdigital will address their example.

AKotowski

  • RFduino Jr. Member
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: SimbleeForMobile.drawSegment does not always work
« Reply #4 on: September 07, 2017, 05:56:17 PM »
Yep,  they found the cause:
Dont use the following commands:
1.) SimbleeForMobile.beginScreen(CLEAR);
2.) SimbleeForMobile.beginScreen(0xFF112244);

The following works:
  SimbleeForMobile.beginScreen(CLEAR);