this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Files at this revision

API Documentation at this revision

Comitter:
ocomeni
Date:
Sun May 19 11:25:28 2019 +0000
Branch:
PassingRegression
Parent:
114:b11bb96c09f3
Child:
116:2296cf274661
Commit message:
refactored main program so BLE and WIFI manager not automatically started unless defines are set.; Tested on python platform and working ok. Need some more testing for stability.

Changed in this revision

source/main-https.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/main-https.cpp	Sat May 18 15:44:48 2019 +0000
+++ b/source/main-https.cpp	Sun May 19 11:25:28 2019 +0000
@@ -139,6 +139,9 @@
 
 void printWaitAbortKeyPress(int numSecs, const char * printStr=NULL)
 {
+#ifdef DEBUG_ENABLED
+    return
+#endif
     dbg_printf(LOG, "%s", printStr);
     dbg_printf(LOG, "Waiting for %d seconds... [press key to abort]\n", numSecs);
     char fmtstr[20];
@@ -256,7 +259,6 @@
     wifi_thread.start(callback(wiFiManager, &WiFiManager::runMain));
     dbg_printf(LOG, "\r\n after starting wifi thread \r\n");
     printWaitAbortKeyPress(120, "Wait after WiFi Manager dispatch\r\n");
-    initialise_debug(NONE);
     // dispatch wifi event queue on event thread
     wifi_evt_thread.start(callback(&eventQueue_wifi, &EventQueue::dispatch_forever));
 }
@@ -292,7 +294,9 @@
 
 
 
-
+#define STARTUP_DEBUG_ENABLE
+//#define AUTO_START_BLE_MANAGER
+//#define AUTO_START_WIFI_MANAGER
 #define PAUSE_SECONDS   0
 #define PAUSE_SECONDS_BLE 0
 int main() {
@@ -307,12 +311,16 @@
     dbg_printf(LOG, "\r\n ++++++ PROGRAM STARTING -- reset count = %d ++++++ \r\n", reset_counter);
     setupDefaultWiFiConfig();
     setupDefaultBleConfig();
+#ifdef AUTO_START_BLE_MANAGER
     //btle_thread.start(callback(peripheral, &SMDevicePeripheral::run));
     start_BLE();
     printWaitAbortKeyPress(120, "Wait after BLE dispatch\r\n");
-    int start = Kernel::get_ms_count();
+#endif
+    //int start = Kernel::get_ms_count();
+#ifdef AUTO_START_WIFI_MANAGER
     start_WiFi();
     printWaitAbortKeyPress(120, "Wait after WiFi instantiation\r\n");
+#endif
     // dispatch atcmd event queue on event thread
     atcmd_evt_thread.start(callback(&eventQueue_atcmd, &EventQueue::dispatch_forever));
     dbg_printf(LOG, "\r\n++++++ Starting ATCmdmanager ++++++ \r\n");
@@ -326,6 +334,9 @@
     atcmd_thread.start(callback(aTCmdManager, &ATCmdManager::runMain));
     dbg_printf(LOG, "\r\n after starting atcmd thread \r\n");
     print_memory_info();
+#ifdef STARTUP_DEBUG_ENABLE
+    initialise_debug(NONE);
+#endif
     while(1)
     {
         switch(mainLoop)