diff --git a/source/shoh/.cproject b/source/shoh/.cproject index b0b54ab..9a99684 100644 --- a/source/shoh/.cproject +++ b/source/shoh/.cproject @@ -86,8 +86,8 @@ - + @@ -257,6 +258,7 @@ + diff --git a/source/shoh/src/main.cpp b/source/shoh/src/main.cpp index 30bee65..8495385 100644 --- a/source/shoh/src/main.cpp +++ b/source/shoh/src/main.cpp @@ -17,11 +17,14 @@ int main(void) retarget_init(); - ThreadCommon::CommonManagers manager = {new ThreadCommon::ThreadManager, - new ThreadCommon::QueueManager}; - manager.tm->createTask(thread_master, "master", + ThreadCommon::ThreadManager *tm = new ThreadCommon::ThreadManager(); + ThreadCommon::QueueManager *qm = new ThreadCommon::QueueManager(); + ThreadCommon::CommonManagers *manager = new ThreadCommon::CommonManagers; + manager->tm = tm; + manager->qm = qm; + manager->tm->createTask(thread_master, "master", configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL, - static_cast(&manager)); + static_cast(manager)); vTaskStartScheduler (); return 1; diff --git a/source/shoh/src/peripherals/retarget_uart.cpp b/source/shoh/src/peripherals/retarget_uart.cpp index f30510d..7396211 100644 --- a/source/shoh/src/peripherals/retarget_uart.cpp +++ b/source/shoh/src/peripherals/retarget_uart.cpp @@ -11,7 +11,7 @@ static LpcDebugUart *dbgu; void retarget_init() { - LpcPinMap none = {-1, -1}; // unused pin has negative values in it + //LpcPinMap none = {-1, -1}; // unused pin has negative values in it //Sadly, it seems that only USART0 is redirected to USB. //It means that those are pins PIO0_18 and PIO0_19 LpcPinMap txpin = { 0, 19 }; // transmit pin that goes to debugger's UART->USB converter diff --git a/source/shoh/src/threads/common/ThreadCommon.h b/source/shoh/src/threads/common/ThreadCommon.h index 7d6b85c..0aa05c0 100644 --- a/source/shoh/src/threads/common/ThreadCommon.h +++ b/source/shoh/src/threads/common/ThreadCommon.h @@ -77,15 +77,6 @@ namespace ThreadCommon ThreadManager * tm; QueueManager * qm; } CommonManagers; - - /* global variables */ - /* 'receiver'_'what'_'sender'_q */ - /* - extern QueueHandle_t master_event_all_q; - extern QueueHandle_t relay_event_master_q; - extern QueueHandle_t manager_event_master_q; - extern QueueHandle_t ui_event_manager_q; - */ } #endif /*__THREAD_COMMON_H_*/ diff --git a/source/shoh/src/threads/logging/Log.h b/source/shoh/src/threads/logging/Log.h index 65536b6..714eb62 100644 --- a/source/shoh/src/threads/logging/Log.h +++ b/source/shoh/src/threads/logging/Log.h @@ -37,7 +37,7 @@ extern QueueHandle_t logging_queue; #define C_ERROR "ERROR" #endif -#define LOG_BUFFER_MAX_CAP 500 +#define LOG_BUFFER_MAX_CAP 256 #define LOG_MESSAGE_MAX_CAP 150 #define _LOG_STREAMOUT(message, message_length) \ @@ -58,7 +58,7 @@ static void create_log_line(const char * _status, va_end(args); char buffer [LOG_BUFFER_MAX_CAP] = {0}; int buffer_len = snprintf(buffer, LOG_BUFFER_MAX_CAP, - "[%s] [File: %s] [Line: %ld] %.*s", + "[%s] [File: %s] [Line: %d] %.*s", _status, _location, _line, diff --git a/source/shoh/src/threads/logging/Logging.cpp b/source/shoh/src/threads/logging/Logging.cpp index ab1176c..731968e 100644 --- a/source/shoh/src/threads/logging/Logging.cpp +++ b/source/shoh/src/threads/logging/Logging.cpp @@ -20,11 +20,14 @@ Logging::~Logging() { void Logging::taskFunction() { - char data[LOG_BUFFER_MAX_CAP] = {0}; - xQueueReceive(q, static_cast(data), portMAX_DELAY); - mutex.lock(); - printf("%s\n", data); - mutex.unlock(); + for(;;) + { + char data[LOG_BUFFER_MAX_CAP] = {0}; + xQueueReceive(q, static_cast(data), portMAX_DELAY); + mutex.lock(); + printf("%s\n", data); + mutex.unlock(); + } } void thread_logging(void* pvParams) diff --git a/source/shoh/src/threads/master/Master.cpp b/source/shoh/src/threads/master/Master.cpp index ba16029..2e49314 100644 --- a/source/shoh/src/threads/master/Master.cpp +++ b/source/shoh/src/threads/master/Master.cpp @@ -86,7 +86,7 @@ void Master::taskFunction() { void thread_master(void* pvParams) { ThreadCommon::CommonManagers * manager = static_cast(pvParams); - manager->qm->createQueue(50, + manager->qm->createQueue(5, LOG_BUFFER_MAX_CAP, ThreadCommon::QueueManager::logging_message_all); logging_queue = manager->qm->getQueue(ThreadCommon::QueueManager::logging_message_all); @@ -111,9 +111,6 @@ void thread_master(void* pvParams) { LOG_INFO("Master is creating tasks"); - manager->tm->createTask(thread_master, "master", - configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL, - static_cast(manager)); manager->tm->createTask(thread_manager, "manager", configMINIMAL_STACK_SIZE * 10,tskIDLE_PRIORITY + 1UL, static_cast(manager)); diff --git a/source/shoh/src/threads/user_interface/UserInterface.cpp b/source/shoh/src/threads/user_interface/UserInterface.cpp index 2668308..a58a6f7 100644 --- a/source/shoh/src/threads/user_interface/UserInterface.cpp +++ b/source/shoh/src/threads/user_interface/UserInterface.cpp @@ -68,7 +68,7 @@ void UserInterface::handleLCD(LiquidCrystal *lcd, const char *str) { lcd->setCursor(0, 0); lcd->print(str); - LOG_INFO("Printing [%s] on LCD"); + LOG_INFO("Printing [%s] on LCD", str); } }