
this is using the mbed os version 5-13-1
Diff: source/main-https.cpp
- Revision:
- 87:99b37d26ff2a
- Parent:
- 86:04fc2fcda7ec
- Child:
- 88:7ffa053be662
--- a/source/main-https.cpp Thu Mar 28 23:41:10 2019 +0000 +++ b/source/main-https.cpp Fri Mar 29 22:18:33 2019 +0000 @@ -45,29 +45,31 @@ const static char DEVICE_NAME_MAIN[] = "UBLOX-BLE"; static const uint16_t uuid16_list[] = {LEDService::LED_SERVICE_UUID}; char buffer[BUFFER_LEN]; +#ifdef ENABLE_UART_BACKGRND_DEMO uint8_t TxBuffer[TX_BUFFER_LEN]; uint8_t RxBuffer[RX_BUFFER_LEN]; +#endif static EventQueue eventQueue(/* event count */ 20 * EVENTS_EVENT_SIZE); //static EventQueue eventQueue2(/* event count */ 10 * EVENTS_EVENT_SIZE); LEDService *ledServicePtr; /* Queue and memory pool for AT to Wifi commands */ -static MemoryPool<wifi_cmd_message_t, 16> aT2WiFimPool; -static Queue<wifi_cmd_message_t, 16> aT2WiFiCmdQueue; +MemoryPool<wifi_cmd_message_t, 16> aT2WiFimPool; +Queue<wifi_cmd_message_t, 16> aT2WiFiCmdQueue; /* Queue and memory pool for WiFi to AT commands */ -static MemoryPool<at_resp_message_t, 16> wiFi2ATmPool; -static Queue<at_resp_message_t, 16> wiFi2ATCmdQueue; +MemoryPool<at_resp_message_t, 16> wiFi2ATmPool; +Queue<at_resp_message_t, 16> wiFi2ATCmdQueue; /* Queue and memory pool for AT to WiFi data */ -static MemoryPool<wifi_data_msg_t, 4> aT2WiFiDatamPool; -static Queue<wifi_data_msg_t, 4> aT2WiFiDataQueue; +MemoryPool<wifi_data_msg_t, PQDSZ> aT2WiFiDatamPool; +Queue<wifi_data_msg_t, PQDSZ> aT2WiFiDataQueue; /* Queue and memory pool for WiFi to AT data */ -static MemoryPool<at_data_msg_t, 4> wiFi2ATDatamPool; -static Queue<at_data_msg_t, 4> wiFi2ATDataQueue; +MemoryPool<at_data_msg_t, PQDSZ> wiFi2ATDatamPool; +Queue<at_data_msg_t, PQDSZ> wiFi2ATDataQueue; @@ -92,9 +94,9 @@ Thread atcmd_thread(ATCMD_THREAD_PRIORITY, 4*1024, &atcmd_stk[0]); #else // using global heap -Thread btle_thread(BTLE_THREAD_PRIORITY, 2*1024); -Thread wifi_thread(WIFI_THREAD_PRIORITY, 8*1024); -Thread atcmd_thread(ATCMD_THREAD_PRIORITY, 8*1024); +Thread btle_thread(BTLE_THREAD_PRIORITY, 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 */ @@ -134,7 +136,7 @@ _smutex.unlock(); } - +#ifdef ENABLE_UART_BACKGRND_DEMO static int uartExpectedRcvCount = 0; static int uartCharRcvCount = 0; static bool UartBusy = false; @@ -191,7 +193,6 @@ eventQueue.call(printUartRxResult); } } - void BackGndUartRead(uint8_t * rxBuffer, size_t bufSize, int rxLen) { UartBusy = true; @@ -243,6 +244,8 @@ } } +#endif + uint64_t lastTime = 0; uint64_t now = 0; uint32_t callCount = 0; @@ -400,6 +403,7 @@ #define BLE_STOP_START_ADV_SCAN_DEMO #define SKIP_WIFI_CONNECT_DEMO #define PAUSE_SECONDS 0 +#define PAUSE_SECONDS_BLE 2 int main() { //print_all_thread_info(); //print_heap_and_isr_stack_info(); @@ -429,7 +433,7 @@ peripheral->run(); btle_thread.start(callback(&queue, &EventQueue::dispatch_forever)); print_memory_info(); - printWaitAbortKeyPress(PAUSE_SECONDS); + printWaitAbortKeyPress(PAUSE_SECONDS_BLE); // give BLE time to settle //peripheral->stopAdvertising(); #ifndef DISABLE_WIFI // comment out wifi part @@ -541,6 +545,7 @@ false); //aTCmdManager->runMain(); atcmd_thread.start(callback(aTCmdManager, &ATCmdManager::runMain)); + //wiFiManager->runMain(); while(1) wait(0.1); //performFreeMemoryCheck();