Recent Posts

Pages: [1] 2 3 ... 10
1
Support / Erratic behaviour when connecting to device
« Last post by jetty on Today at 11:56:43 AM »
If you're experiencing erratic behavior when connecting to the Simblee, here's something I found out the hard way.

ui(), ui_event are called from within SimbleeForMobile.process()

However SimbleeForMobile_onConnect() and SimbleeForMobile_onDisconnect are called asynchronously, presumably they're interrupts. (I couldn't find this documented anywhere).

If you're changing any variables for example in onConnect/onDisconnect, which you're also changing from loop(), you'll need to be aware they could change under you.

Also, it's common in the Simblee documentation to see this:
Code: [Select]
void SimbleeForMobile_onConnect()
{
  Serial.println("Mobile connected");
}

which will lead to random corruption of your serial stream.  It may effect other SimbleeForMobile callbacks too, I haven't verified all of them.
2
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by AKotowski on July 20, 2017, 10:27:29 AM »
Yes, updateW() solves my problem.
The app crashes regardless of the update frequency, even if updateRect() is only called once.
Thanks for your help
3
Interesting Uses & Applications / Simblee Flash Read/Write wrapper library
« Last post by blieber on July 20, 2017, 09:22:11 AM »
I wrote a FIFO-ish interface to make it easy to write to and read from flash memory on Simblee - https://github.com/blieber/arduino-flash-queue
4
Support / Re: dualMode for BLE+COM
« Last post by Tim on July 19, 2017, 11:15:56 PM »
I have clarity on this, thanks for replies from RF Digital support. This supplements info at:

http://forum.rfduino.com/index.php?topic=1357.0

When Simblee is connected to a BLE central and is in dualMode, it gives 10 ms slices of time to COM. This is enough time to send a COM message in LOW_LATENCY mode (3 ms latency) and receive an immediate reply from a receiving Simblee. Therefore, dualMode works only for LOW_LATENCY COM.

The only configuration of Simblees that dualMode works for is where you have one Simblee acting as a gateway, and one or more as nodes. The gateway can be connected to a BLE central and, via dualMode, also do COM messaging with one or more nodes. The nodes must use straight COM; they cannot maintain BLE connection. AND, while a COM message sent from the gateway (in between calls to its SimbleeBLE_onDualModeStart() and SimbleeBLE_onDualModeStop() routines) is broadcast to all nearby Simblees with COM stack started, only a single node can reply to the gateway, and it must do so immediately so the reply message reaches the gateway before the end of the 10 ms COM slice in which the original message was sent from the gateway.

This limits the use cases for Simblee's dualMode, but I can imagine there are many where it is very useful.

Hope helpful ...

Tim
5
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by AKotowski on July 19, 2017, 03:54:52 PM »
Thanks
6
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by tolson on July 19, 2017, 10:40:12 AM »
Since you really just wanted to change the width of the bargraph use...

SimbleeForMobile.updateW(ss, width);
I know this works.

Also, just thought, you are updating in the loop and would seem to be at a too high rate for
the SimbleeForMobile.process();

So need to scheme how to update the bargraph at a slower rate.
Could put delay(200) after the updateW, but being in the loop that slows down response to/from phone.

So best to use a update routine using millis and millisLast examples.

Don't know why SimbleForMobile.updateRect is not working so well. Perhaps way too many things to update in the loop too often.
Don't really need it since you can update just what needs to be updated. Other than that, I suggest calling RFdigital to get their attention on the matter.

7
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by AKotowski on July 19, 2017, 08:49:02 AM »
The offending line (36) //SimbleeForMobile.updateRect(ss, 80, 300, 150, 50);
is commented out.
Please try uncommenting that line
8
Bugs / Double restart when programming
« Last post by jetty on July 19, 2017, 07:05:58 AM »
When programming the device via the Arduino IDE, program is uploaded to Simblee, then the simblee starts running, then a fraction of a second later, device is reset a second time.

Operation should be just one reset.
9
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by tolson on July 18, 2017, 07:58:51 PM »
I don't know. This works for me. If it works for you, perhaps you can do a diff.

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

uint8_t toScreen2ButtonID;

uint8_t toScreen1ButtonID;

uint8_t currentScreen;


uint8_t ss;                                                    //AK

/*
 * Traditional Arduino setup routine
 *
 * Initialize the SimbleeForMobile environment.
 */
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Setup beginning");
 
  SimbleeForMobile.deviceName = "2Screens";                  //AK
  SimbleeForMobile.advertisementData = "Sample";

  //SimbleeForMobile.domain = "twoscreensak.simblee.com";         //AK // You should use your own domain
 
  SimbleeForMobile.begin();
 
  Serial.println("Setup completed");
}

void loop() {
  // put your main code here, to run repeatedly:
  // process must be called in the loop for Simblee UI
  if (SimbleeForMobile.updatable && currentScreen == 1){                                   //AK
    //SimbleeForMobile.updateRect(ss, 80, 300, 150, 50);              //AK
  };                                                                 //AK
  SimbleeForMobile.process();
}

void SimbleeForMobile_onConnect()
{
  currentScreen = -1;
}

void SimbleeForMobile_onDisconnect()
{
}

void ui()
{
  if(SimbleeForMobile.screen == currentScreen) return;
 
  currentScreen = SimbleeForMobile.screen;
  switch(currentScreen)
  {
    case 1:
      createScreen1();
      break;
       
    case 2:
      createScreen2();
      break;
           
   default:
      Serial.print("ui: Unknown screen requested: ");
      Serial.println(SimbleeForMobile.screen);
  }
}

void ui_event(event_t &event)
{
//  printEvent(event);
  if(event.id == toScreen1ButtonID && event.type == EVENT_RELEASE && currentScreen == 2)
  {
    SimbleeForMobile.showScreen(1);
  } else if(event.id == toScreen2ButtonID && event.type == EVENT_RELEASE && currentScreen == 1)
  {
    SimbleeForMobile.showScreen(2);
  }
}

void createScreen1()
{
  //
  // Portrait mode is the default, so that isn't required
  // here, but shown for completeness. LANDSCAPE could be
  // used for that orientation.
  //
  SimbleeForMobile.beginScreen(YELLOW, PORTRAIT);

  int textID = SimbleeForMobile.drawText(80, 60, "Screen 1", BLACK, 40);
  toScreen2ButtonID = SimbleeForMobile.drawButton(100, 200, 100, "Screen 2");

  ss = SimbleeForMobile.drawRect(80, 300, 100, 50, RED);                          //AK

  SimbleeForMobile.setEvents(toScreen2ButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}

void createScreen2()
{
  //
  // Default to Portrait orientation
  //
  SimbleeForMobile.beginScreen(WHITE);

  int textID = SimbleeForMobile.drawText(80, 60, "Screen 2", BLACK, 40);
  toScreen1ButtonID = SimbleeForMobile.drawButton(100, 200, 100, "Screen 1");

  SimbleeForMobile.setEvents(toScreen1ButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}

void printEvent(event_t &event)
{
  Serial.println("Event:");
  Serial.print("  ID: ");
  Serial.println(event.id);
 
  Serial.print("   Type: ");
  Serial.println(event.type);

  Serial.print("   Value: ");
  Serial.println(event.value);
 
  Serial.print("   Text: ");
  Serial.println(event.text);
 
  Serial.print("   Coords: ");
  Serial.print(event.x);
  Serial.print(",");
  Serial.println(event.y);
}
10
Simblee For Mobile / Re: updateRect() causes Android App to Crash
« Last post by AKotowski on July 18, 2017, 04:42:25 PM »
I've made the changes as you suggested, but still the same crash.  It does happen when the updateRect() occurs.  I can change the color of the rectangle, but when I update the rectangle the crash happens.  Here is the updated code:
Code: [Select]
#include <SimbleeForMobile.h>

uint8_t toScreen2ButtonID;
uint8_t toScreen1ButtonID;
uint8_t currentScreen;
uint8_t ss;                                                    //AK

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Setup beginning");
 
  SimbleeForMobile.deviceName = "2 ScreensAK";                  //AK
  SimbleeForMobile.advertisementData = "Sample";
//  SimbleeForMobile.domain = "twoscreensak.simblee.com";         //AK
  SimbleeForMobile.begin();
  Serial.println("Setup completed");
}

void loop() {
  delay(2000);
  if (SimbleeForMobile.updatable && currentScreen == 1 ){                                   //AK
    SimbleeForMobile.updateColor(ss, GRAY);
    SimbleeForMobile.updateRect(ss, 80, 300, 150, 50);              //AK
  };
  SimbleeForMobile.process(); 
}
void SimbleeForMobile_onConnect()
{
  currentScreen = -1;
}

void SimbleeForMobile_onDisconnect()
{
}

void ui()

  if(SimbleeForMobile.screen == currentScreen) return;
  currentScreen = SimbleeForMobile.screen;
  switch(SimbleeForMobile.screen)
  {
    case 1:
      createScreen1();
      break;
       
    case 2:
      createScreen2();
      break;
   default:
      Serial.print("ui: Uknown screen requested: ");
      Serial.println(SimbleeForMobile.screen);
  }
}

void ui_event(event_t &event)
{
//  printEvent(event);
  if(event.id == toScreen1ButtonID && event.type == EVENT_RELEASE && currentScreen == 2)
  {
    SimbleeForMobile.showScreen(1);
  } else if(event.id == toScreen2ButtonID && event.type == EVENT_RELEASE && currentScreen == 1)
  {
    SimbleeForMobile.showScreen(2);
  }
}

void createScreen1()
{
  SimbleeForMobile.beginScreen(YELLOW, PORTRAIT);

  uint8_t textID = SimbleeForMobile.drawText(80, 60, "Screen 1", BLACK, 40);
  toScreen2ButtonID = SimbleeForMobile.drawButton(100, 200, 100, "Screen 2");

  ss = SimbleeForMobile.drawRect(80, 300, 150, 50, RED);                          //AK
  SimbleeForMobile.setEvents(toScreen2ButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}
void createScreen2()
{
  SimbleeForMobile.beginScreen(WHITE);
  int textID = SimbleeForMobile.drawText(80, 60, "Screen 2", BLACK, 40);
  toScreen1ButtonID = SimbleeForMobile.drawButton(100, 200, 100, "Screen 1");
  SimbleeForMobile.setEvents(toScreen1ButtonID, EVENT_RELEASE);
  SimbleeForMobile.endScreen();
}

void printEvent(event_t &event)
{
  Serial.println("Event:");
  Serial.print("  ID: ");
  Serial.println(event.id);
 
  Serial.print("   Type: ");
  Serial.println(event.type); 

  Serial.print("   Value: ");
  Serial.println(event.value);
 
  Serial.print("   Text: ");
  Serial.println(event.text); 
 
  Serial.print("   Coords: ");
  Serial.print(event.x); 
  Serial.print(","); 
  Serial.println(event.y); 
}
Pages: [1] 2 3 ... 10