Skip to content

Commit

Permalink
Fixed conditional bug using SPARK_WLAN_START and SPARK_WLAN_SLEEP
Browse files Browse the repository at this point in the history
  • Loading branch information
satishgn committed Mar 6, 2014
1 parent e5ef750 commit a565007
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
23 changes: 10 additions & 13 deletions src/main.cpp
Expand Up @@ -173,7 +173,7 @@ int main(void)

#ifdef SPARK_WIRING_ENABLE
#ifdef SPARK_WLAN_ENABLE
if(!SPARK_WLAN_START || !SPARK_CLOUD_CONNECT || SPARK_CLOUD_CONNECTED)
if((!SPARK_WLAN_START || SPARK_WLAN_SLEEP) || (!SPARK_CLOUD_CONNECT || SPARK_CLOUD_CONNECTED))
{
if(!SPARK_FLASH_UPDATE && !IWDG_SYSTEM_RESET)
{
Expand Down Expand Up @@ -266,23 +266,20 @@ void Timing_Decrement(void)
}

#ifdef SPARK_WLAN_ENABLE
if(!SPARK_WLAN_START)
if(!SPARK_WLAN_START || SPARK_WLAN_SLEEP)
{
//Do nothing
}
else if(!SPARK_WLAN_SLEEP)
else if(SPARK_FLASH_UPDATE)
{
if(SPARK_FLASH_UPDATE)
if (TimingFlashUpdateTimeout >= TIMING_FLASH_UPDATE_TIMEOUT)
{
if (TimingFlashUpdateTimeout >= TIMING_FLASH_UPDATE_TIMEOUT)
{
//Reset is the only way now to recover from stuck OTA update
NVIC_SystemReset();
}
else
{
TimingFlashUpdateTimeout++;
}
//Reset is the only way now to recover from stuck OTA update
NVIC_SystemReset();
}
else
{
TimingFlashUpdateTimeout++;
}
}
else if(!WLAN_SMART_CONFIG_START && BUTTON_GetDebouncedTime(BUTTON1) >= 3000)
Expand Down
2 changes: 1 addition & 1 deletion src/spark_wiring.cpp
Expand Up @@ -637,7 +637,7 @@ void delay(unsigned long ms)
}

#ifdef SPARK_WLAN_ENABLE
if (!SPARK_WLAN_START)
if (!SPARK_WLAN_START || SPARK_WLAN_SLEEP)
{
//Do not yield for SPARK_WLAN_Loop()
}
Expand Down

0 comments on commit a565007

Please sign in to comment.