Skip to content

Instantly share code, notes, and snippets.

@mikewl
Created February 28, 2014 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikewl/9272772 to your computer and use it in GitHub Desktop.
Save mikewl/9272772 to your computer and use it in GitHub Desktop.
/* Connect to Spark Cloud by default */
bool FIRST_RUN_NO_HANDSHAKE = false;
//#define ENABLE_CLOUD
#ifdef ENABLE_CLOUD
SPARK_SOCKET_HANDSHAKE = 1;
#else
SPARK_SOCKET_HANDSHAKE = 0;
FIRST_RUN_NO_HANDSHAKE = true;
#endif
/* Main loop */
while (1)
{
#ifdef SPARK_WLAN_ENABLE
SPARK_WLAN_Loop();
#endif
#ifdef SPARK_WIRING_ENABLE
#ifdef SPARK_WLAN_ENABLE
if(SPARK_WIRING_APPLICATION || SPARK_HANDSHAKE_COMPLETED || FIRST_RUN_NO_HANDSHAKE)
{
if(!SPARK_FLASH_UPDATE && !IWDG_SYSTEM_RESET)
{
#endif
if((SPARK_WIRING_APPLICATION != 1) && (NULL != setup))
{
//Execute user application setup only once
setup();
SPARK_WIRING_APPLICATION = 1;
#ifndef CLOUD_ENABLE
FIRST_RUN_NO_HANDSHAKE = false;
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment