Core without Cloud [Fixed]

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

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! :smile:

Ok. I’ll be patient… :wink:

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. :frowning:
  • Reset does not fix this…

My fault?

Thanks @Frido. I haven’t turned off the WLAN in a while, but that’s surprising—I’ll test this this week.

@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?

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

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

Pull request has been initiated - thanks @Frido and @henriquepss!

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?

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(). :wink:

Try:

#include "application.h"
int led = D7; 
void setup() 
{
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  delay(500);
  digitalWrite(led, LOW);
  delay(500);
}

void loop() 
{
}