
this is using the mbed os version 5-13-1
Diff: source/main-https.cpp
- Branch:
- PassingRegression
- Revision:
- 109:c274780ff609
- Parent:
- 108:3c8fb2c6e7bf
- Child:
- 112:a0999ea4ece0
--- a/source/main-https.cpp Mon May 06 20:18:02 2019 +0000 +++ b/source/main-https.cpp Wed May 08 19:38:35 2019 +0000 @@ -57,8 +57,8 @@ uint8_t TxBuffer[TX_BUFFER_LEN]; uint8_t RxBuffer[RX_BUFFER_LEN]; #endif -static EventQueue eventQueue(/* event count */ 32 * EVENTS_EVENT_SIZE); -//static EventQueue eventQueue2(/* event count */ 10 * EVENTS_EVENT_SIZE); +static EventQueue eventQueue_atcmd(/* event count */ 32 * EVENTS_EVENT_SIZE); +static EventQueue eventQueue_wifi(/* event count */ 32 * EVENTS_EVENT_SIZE); LEDService *ledServicePtr; @@ -103,14 +103,15 @@ #else // using global heap Thread btle_thread(BTLE_THREAD_PRIORITY, 1024); -Thread wifi_thread(WIFI_THREAD_PRIORITY, 6*1024); +Thread wifi_thread(WIFI_THREAD_PRIORITY, 4*1024); Thread atcmd_thread(ATCMD_THREAD_PRIORITY, 4*1024); #endif /* create a semaphore to synchronize the threads */ Semaphore sync_sema; -Thread evt_thread; +Thread atcmd_evt_thread(osPriorityNormal, 1024); +Thread wifi_evt_thread; #include "network-helper.h" /* List of trusted root CA certificates @@ -302,7 +303,7 @@ dbg_printf(LOG, "%d", i); dbg_printf(LOG, "\n"); wait(0.5); - eventQueue.dispatch(500); // Dispatch time - 500msec + eventQueue_atcmd.dispatch(500); // Dispatch time - 500msec } } @@ -316,7 +317,7 @@ sprintf(fmtstr, "BLE: loop # %d\n", i); peripheral->sendBLEUartData(fmtstr); wait(0.5); - eventQueue.dispatch(500); // Dispatch time - 500msec + eventQueue_atcmd.dispatch(500); // Dispatch time - 500msec if(device->readable()){ dbg_printf(LOG, "keypress detected aborting....\n"); device->getc(); @@ -437,7 +438,7 @@ dbg_printf(LOG, "ERROR: No WiFiInterface found.\n"); } wiFiManager = new WiFiManager(wifi_config, network, - eventQueue, + eventQueue_wifi, &aT2WiFimPool, &aT2WiFiCmdQueue, &wiFi2ATmPool, &wiFi2ATCmdQueue, &aT2WiFiDatamPool, &aT2WiFiDataQueue, @@ -448,8 +449,8 @@ int stop = Kernel::get_ms_count(); dbg_printf(LOG, "\n The Wifi Network scan took %d ms or %4.1f seconds\n", (stop - start), (float)((stop - start)/1000.0)); // run on separate thread; - evt_thread.start(callback(wifi_demo, network)); - evt_thread.join(); + wifi_evt_thread.start(callback(wifi_demo, network)); + wifi_evt_thread.join(); network->disconnect(); delete network; dbg_printf(LOG, "\n Wifi-Demo completed - restarting BLE \n\n"); @@ -531,11 +532,12 @@ print_memory_info(); // dispatch event queue on event thread dbg_printf(LOG, "\r\n [MAIN THREAD] Thread Id = %X\r\n", (uint32_t)ThisThread::get_id()); - dbg_printf(LOG, "\r\n [EVENT THREAD] Thread Id = %X\r\n", (uint32_t)evt_thread.get_id()); - evt_thread.start(callback(&eventQueue, &EventQueue::dispatch_forever)); + dbg_printf(LOG, "\r\n [EVENT THREAD] Thread Id = %X\r\n", (uint32_t)wifi_evt_thread.get_id()); + wifi_evt_thread.start(callback(&eventQueue_wifi, &EventQueue::dispatch_forever)); + atcmd_evt_thread.start(callback(&eventQueue_atcmd, &EventQueue::dispatch_forever)); dbg_printf(LOG, "\r\n++++++ Starting ATCmdmanager ++++++ \r\n"); ATCmdManager *aTCmdManager = new ATCmdManager(USBTX, USBRX, peripheral, - eventQueue, wiFiManager, + eventQueue_atcmd, wiFiManager, &aT2WiFimPool, &aT2WiFiCmdQueue, &wiFi2ATmPool, &wiFi2ATCmdQueue, &aT2WiFiDatamPool, &aT2WiFiDataQueue,