diff --git a/.cproject b/.cproject index 44ac3bd..74b66f6 100644 --- a/.cproject +++ b/.cproject @@ -39,10 +39,10 @@ + - @@ -98,8 +98,8 @@ - + @@ -143,8 +143,8 @@ - + diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index fbc9eab..f18a191 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -2,7 +2,7 @@ * @Description: * @Date: 2020-04-02 21:44:31 * @LastEditors: CK.Zh - * @LastEditTime: 2020-12-17 17:27:06 + * @LastEditTime: 2020-12-17 18:39:26 * @FilePath: \NaviKit_stm32\Core\Src\freertos.c */ /* USER CODE BEGIN Header */ @@ -112,11 +112,6 @@ const osThreadAttr_t PowerMonitTask_attributes = { .priority = (osPriority_t) osPriorityLow, .stack_size = 128 * 4 }; -/* Definitions for myMutex01 */ -osMutexId_t myMutex01Handle; -const osMutexAttr_t myMutex01_attributes = { - .name = "myMutex01" -}; /* Private function prototypes -----------------------------------------------*/ /* USER CODE BEGIN FunctionPrototypes */ @@ -197,9 +192,6 @@ void MX_FREERTOS_Init(void) { /* USER CODE BEGIN Init */ /* USER CODE END Init */ - /* Create the mutex(es) */ - /* creation of myMutex01 */ - myMutex01Handle = osMutexNew(&myMutex01_attributes); /* USER CODE BEGIN RTOS_MUTEX */ /* add mutexes, ... */ @@ -278,7 +270,7 @@ void StartDefaultTask(void *argument) Log(info,"Device ID: %u ", HAL_GetDEVID()); Log(info,"Chip UID: %u%u%u ", HAL_GetUIDw0(),HAL_GetUIDw1(),HAL_GetUIDw2); - if(osKernelGetInfo(&osVersion,id_buf,id_size)){ + if(osOK == osKernelGetInfo(&osVersion,id_buf,id_size)){ Log(info,"OS Kernel Version: %u ", osVersion.kernel ); Log(info,"OS Kernel ID: %s ",id_buf ); } @@ -542,7 +534,7 @@ void StartStateSwitchTask(void *argument) case shutdown: {//only from running state if((NaviKit.sys.sta == running))// && (NaviKit.som.shutdown_req == true) - enter_shutdown_state(); + enter_shutdown_state(); }break; case running: {//from sleep and shutdown state @@ -586,25 +578,20 @@ void StartPowerMonitTask(void *argument) { if(NaviKit.pmb.rails.out_24v > 26.4 || NaviKit.pmb.rails.out_24v < 21.6){ Log(error,"24V power rail exception:%f",NaviKit.pmb.rails.out_24v); -// printf("24V power rail exception:%f",NaviKit.pmb.rails.out_24v); } if(NaviKit.pmb.rails.out_5v > 5.5 || NaviKit.pmb.rails.out_5v < 4.5){ Log(error,"5V power rail exception:%f",NaviKit.pmb.rails.out_5v); -// printf("5V power rail exception:%f",NaviKit.pmb.rails.out_5v); } if(NaviKit.pmb.rails.out_12v > 13.2 || NaviKit.pmb.rails.out_12v < 10.8){ Log(error ,"12V power rail exception:%f",NaviKit.pmb.rails.out_12v); -// printf("12V power rail exception:%f",NaviKit.pmb.rails.out_12v); } if(NaviKit.pmb.rails.bkp_bat < 10){ Log(warning,"Backup power is not online"); -// printf("Backup power is not online"); } if(NaviKit.pmb.rails.main_pwr < 19){ Beep(100); Log(warning,"Main power has been lost, please shutdown computer as soon as possible"); -// printf("Main power has been lost, please shutdown computer as soon as possible"); - } + } osDelay(5000); } diff --git a/Core/Src/usart.c b/Core/Src/usart.c index 752328d..cb86f56 100644 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -1,10 +1,3 @@ -/* - * @Description: - * @Date: 2020-04-04 11:28:36 - * @LastEditors: CK.Zh - * @LastEditTime: 2020-12-17 17:28:53 - * @FilePath: \NaviKit_stm32\Core\Src\usart.c - */ /** ****************************************************************************** * @file usart.c diff --git a/NaviKit_stm32.ioc b/NaviKit_stm32.ioc index 1cdab66..be00c5a 100644 --- a/NaviKit_stm32.ioc +++ b/NaviKit_stm32.ioc @@ -69,8 +69,7 @@ FREERTOS.FootprintOK=true FREERTOS.HEAP_NUMBER=4 FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1 FREERTOS.INCLUDE_xTaskGetHandle=1 -FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configUSE_TICKLESS_IDLE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,configUSE_APPLICATION_TASK_TAG,FootprintOK,configUSE_IDLE_HOOK,configUSE_TICK_HOOK,configUSE_MALLOC_FAILED_HOOK,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY,HEAP_NUMBER,configTOTAL_HEAP_SIZE,configCHECK_FOR_STACK_OVERFLOW,configUSE_TASK_NOTIFICATIONS,Mutexes01 -FREERTOS.Mutexes01=myMutex01,Dynamic,NULL +FREERTOS.IPParameters=Tasks01,configMAX_TASK_NAME_LEN,configUSE_TICKLESS_IDLE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,configUSE_APPLICATION_TASK_TAG,FootprintOK,configUSE_IDLE_HOOK,configUSE_TICK_HOOK,configUSE_MALLOC_FAILED_HOOK,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY,HEAP_NUMBER,configTOTAL_HEAP_SIZE,configCHECK_FOR_STACK_OVERFLOW,configUSE_TASK_NOTIFICATIONS FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;LedBlinkTask,8,128,StartLedBlinkTask,Default,NULL,Dynamic,NULL,NULL;IWDGRefreshTask,40,128,StartIWDGRefreshTask,Default,NULL,Dynamic,NULL,NULL;EventDetect,8,128,StartEventDetect,Default,NULL,Dynamic,NULL,NULL;CoulombRead,8,128,StartCoulombRead,Default,NULL,Dynamic,NULL,NULL;StateSwitchTask,8,128,StartStateSwitchTask,Default,NULL,Dynamic,NULL,NULL;PowerMonitTask,8,128,StartPowerMonitTask,Default,NULL,Dynamic,NULL,NULL FREERTOS.configCHECK_FOR_STACK_OVERFLOW=1 FREERTOS.configGENERATE_RUN_TIME_STATS=1 diff --git a/USB_DEVICE/Target/usbd_conf.h b/USB_DEVICE/Target/usbd_conf.h index 4b29c22..e6fc6f8 100644 --- a/USB_DEVICE/Target/usbd_conf.h +++ b/USB_DEVICE/Target/usbd_conf.h @@ -1,10 +1,3 @@ -/* - * @Description: - * @Date: 2020-02-20 11:58:24 - * @LastEditors: CK.Zh - * @LastEditTime: 2020-12-17 17:39:37 - * @FilePath: \NaviKit_stm32\USB_DEVICE\Target\usbd_conf.h - */ /* USER CODE BEGIN Header */ /** ******************************************************************************