this is using the mbed os version 5-13-1
Diff: source/WiFiManager.cpp
- Branch:
- PassingRegression
- Revision:
- 109:c274780ff609
- Parent:
- 108:3c8fb2c6e7bf
- Child:
- 110:c722dda4f2ff
--- a/source/WiFiManager.cpp Mon May 06 20:18:02 2019 +0000
+++ b/source/WiFiManager.cpp Wed May 08 19:38:35 2019 +0000
@@ -42,13 +42,19 @@
wifiBusy = 0;
wifiWatchdogTimer.start();
watchdogCnt = 0;
- _event_queue.call_every(10000, this, &WiFiManager::callWifiWatchDog);
+ //_event_queue.call_every(10000, this, &WiFiManager::callWifiWatchDog);
+ watchDogTick.attach(this, &WiFiManager::callWifiWatchDogIsr, 10000.0); // call flip function every 2 seconds
}
WiFiManager::~WiFiManager()
{
}
//#define DISABLE_WATCHDOG
+
+void WiFiManager::callWifiWatchDogIsr()
+{
+ _event_queue.call(this, &WiFiManager::callWifiWatchDog);
+}
void WiFiManager::callWifiWatchDog()
{
#ifdef DISABLE_WATCHDOG
@@ -208,12 +214,14 @@
case WIFI_CMD_SEND_HTTPS_REQ:
{
wifiBusy = 1;
+#ifdef SEND_DEBUG_MESSAGES
if(responseString == NULL)
{
responseString = (char *) malloc(100);
sprintf(responseString, "\r\nHTTP REQUEST RECEIVED\r\n");
sendATresponseString(AT_EVENT);
}
+#endif
dbg_printf(LOG, "before call to send http request \n");
dbg_printf(LOG, "\r\n[WIFI-MAN] Received HTTPS request...\r\n");
print_memory_info();
@@ -225,19 +233,25 @@
int event_id = _event_queue.call(this, &WiFiManager::createSendHttpsRequest);
backgroundTaskCompleted = false;
int msecCount = 0;
- while(!backgroundTaskCompleted && msecCount < 1000)
+ int oldChunkNum = chunkNum;
+ while(!backgroundTaskCompleted && msecCount < 6000)
{
msecCount++;
wait_ms(10);
+ if(oldChunkNum != chunkNum) // new payload received
+ {
+ oldChunkNum = chunkNum;
+ msecCount = 0;
+ }
}
if(backgroundTaskCompleted)
{
- queueATresponse(AT_INTERNET_CONFIG_RESP);
+ //queueATresponse(AT_INTERNET_CONFIG_RESP);
result = true;
}
else
{
- _event_queue.cancel(event_id);
+ //_event_queue.cancel(event_id);
result = false;
}
backgroundTaskCompleted = false;
@@ -961,7 +975,6 @@
sprintf(responseString, "\r\nHTTPS BODY CALLBACK RECEIVED\r\n");
sendATresponseString(AT_EVENT);
}
-
sendResponseDownloadData(AT_HTTPS_RESP_DOWNLOAD, (uint8_t *)at, length);
}
@@ -1157,9 +1170,11 @@
http_req_cfg->method,
full_url,
callback(this, &WiFiManager::body_callback));
+#ifdef SEND_DEBUG_MESSAGES
responseString = (char *) malloc(100);
sprintf(responseString, "\r\nHTTP REQUEST OBJECT CREATED\r\n");
sendDebugMessage();
+#endif
#else
https_request = new HttpsRequest(network,
SSL_CA_PEM,
@@ -1188,6 +1203,7 @@
//mbed_stats_heap_t heap_stats;
//mbed_stats_heap_get(&heap_stats);
dbg_printf(LOG, "Heap size: %lu / %lu bytes\r\n", heap_stats.current_size, heap_stats.reserved_size);
+#ifdef SEND_DEBUG_MESSAGES
responseString = (char *) malloc(200);
sprintf(responseString, "\r\nABOUT TO SEND HTTP REQUEST\r\n");
sendDebugMessage();
@@ -1198,6 +1214,7 @@
responseString = (char *) malloc(100);
sprintf(responseString, "\r\nRETURNED FROM SENDING HTTP REQUEST\r\n");
sendDebugMessage();
+#endif
}
#else
setHttpsHeader("Host", http_req_cfg->hostName);