Frido
December 29, 2013, 7:28pm
1
Hi there,
I managed to compile the latest firmware from git, write my own app w/o the web-GUI and compile/flash it via USB on my Mac.
How to modify the source to
get a stable (as possible) running core
without connection to the cloud
with TCPClient functions
Searched the forum already…
Cheers,
Frido.
2 Likes
zachary
December 30, 2013, 4:36am
2
Hi @Frido —short answer: It’s in our backlog and moderately high priority but not possible right now.
There’s a #define for turning off the Wi-Fi capabilities completely, but no simple way to use TCPClient without the Cloud connection. The firmware’s open source—if you can make it happen before we do, please submit a pull request!
Frido
December 30, 2013, 2:08pm
3
Ok. I’ll be patient…
So I tried:
application.cpp:
#include "application.h"
int led = D7;
void setup()
{
pinMode(led, OUTPUT);
}
void loop()
{
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
}
make… dfu-util…
RGB-LED flashes slow in the well known manner, as it’s connected to the cloud
D7-LED blinks!
now I comment line 37 in platform_config.h:
//#define SPARK_WLAN_ENABLE
now it’s undefined and therefore WiFi should be disabled, right?
make clean… make…dfu-util…
now:
RGB-LED flashes fast the same way as if it lost the connection to the cloud
D7-led stays off.
Reset does not fix this…
My fault?
zachary
December 30, 2013, 5:00pm
4
Thanks @Frido . I haven’t turned off the WLAN in a while, but that’s surprising—I’ll test this this week.
mohit
December 30, 2013, 6:18pm
5
@Frido Yes, I’m able to replicate this too. I had not commented out the SPARK_WLAN_ENABLE in a while. Seems like a bug. I’ll add this to the backlog.
@satishgn could you confirm this as well?
Frido
January 11, 2014, 3:28pm
7
My solution:
in main.cpp insert code after line 191
#ifndef SPARK_WLAN_ENABLE
ApplicationSetupOnce = 1;
LED_RGB_OVERRIDE =1;
LED_On(LED_RGB);
#endif
now comment Line 37 in platform_config.h (therefore SPARK_WLAN_ENABLE is undefined) and my little blinking code works solid as a rock!
Cheers,
Frido.
P.S. Can anybody fork and submit a pull request? I’m a noob to git!
1 Like
Frido
January 12, 2014, 5:11pm
8
Fix with a bug! It got caught in a loop with setup().
First fix for the fix:
in main.cpp insert code after line 191
#ifndef SPARK_WLAN_ENABLE
if (LED_RGB_OVERRIDE!=1) ApplicationSetupOnce = 1;
LED_RGB_OVERRIDE =1;
LED_On(LED_RGB);
#endif
zach
January 13, 2014, 5:48am
9
Pull request has been initiated - thanks @Frido and @henriquepss !
particle-iot:master
← henriquesa:master
opened 03:17AM - 12 Jan 14 UTC
Reviewing this week, but there it is if anyone wants to get at it early.
Having trouble understanding why do you need the if (LED_RGB_OVERRIDE!=1) before setting AplicationSetupOnce to 1, could you clarify please?
Frido
January 13, 2014, 10:17pm
11
Without this, setup() is not only called once but again and again and again…
Figured this out by turning D7 on and off in setup() and doing nothing in loop().
Try:
#include "application.h"
int led = D7;
void setup()
{
pinMode(led, OUTPUT);
digitalWrite(led, HIGH);
delay(500);
digitalWrite(led, LOW);
delay(500);
}
void loop()
{
}