优化文件结构
This commit is contained in:
+2
-54
@@ -74,7 +74,6 @@ const osThreadAttr_t defaultTask_attributes = {
|
||||
};
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
uint16_t gausAdcBuf[ADC_CHNL_NUM];
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
@@ -141,21 +140,6 @@ RETRY:
|
||||
return temp;
|
||||
}
|
||||
|
||||
uint16_t adc2voltage(uint16_t adcVal)
|
||||
{
|
||||
return adcVal * 3000 / 65535;
|
||||
}
|
||||
|
||||
uint16_t adc2Iflla(uint16_t adcVal)
|
||||
{
|
||||
return adc2voltage(adcVal) * 1000 / 20 / 20;
|
||||
}
|
||||
|
||||
uint16_t adc2Vflla(uint16_t adcVal)
|
||||
{
|
||||
return adc2voltage(adcVal) * 3;
|
||||
}
|
||||
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
@@ -937,27 +921,6 @@ static void MX_GPIO_Init(void)
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
||||
|
||||
static uint16_t gusDuty = 0;
|
||||
|
||||
void ifilaAdust(void)
|
||||
{
|
||||
static uint32_t ulLastTick = 0;
|
||||
uint32_t ulTick = HAL_GetTick();
|
||||
if (ulTick - ulLastTick < 5000) {
|
||||
return;
|
||||
}
|
||||
ulLastTick = ulTick;
|
||||
|
||||
if (gusDuty == 0) {
|
||||
gusDuty = 300;
|
||||
} else if (gusDuty == 300) {
|
||||
gusDuty = 600;
|
||||
} else if (gusDuty == 600) {
|
||||
gusDuty = 300;
|
||||
}
|
||||
|
||||
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, gusDuty);
|
||||
}
|
||||
|
||||
void HAL_UARTEx_RxEventCallback_UART3(UART_HandleTypeDef *huart, uint16_t Size);
|
||||
void HAL_UARTEx_RxEventCallback_UART4(UART_HandleTypeDef *huart, uint16_t Size);
|
||||
@@ -989,18 +952,7 @@ void StartDefaultTask(void *argument)
|
||||
|
||||
HAL_GPIO_WritePin(WDO_GPIO_Port, WDO_Pin, GPIO_PIN_RESET);
|
||||
|
||||
HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED);
|
||||
|
||||
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)gausAdcBuf, ADC_CHNL_NUM);
|
||||
|
||||
debug("ADC_CHNL_NUM = %d\n", ADC_CHNL_NUM);
|
||||
|
||||
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, 0);
|
||||
|
||||
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
|
||||
|
||||
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);
|
||||
|
||||
filamentInit();
|
||||
osuInit();
|
||||
iapThreadInit();
|
||||
cpyProtInit();
|
||||
@@ -1011,17 +963,13 @@ void StartDefaultTask(void *argument)
|
||||
{
|
||||
osDelay(2);
|
||||
i++;
|
||||
ifilaAdust();
|
||||
|
||||
if (i % 250 != 0) {
|
||||
continue;
|
||||
}
|
||||
gusTempVal = getBoardTemp();
|
||||
// HAL_ADC_Start_DMA(&hadc1, (uint32_t *)gausAdcBuf, ADC_CHNL_NUM);
|
||||
SCB_InvalidateDCache_by_Addr(gausAdcBuf, ADC_CHNL_NUM * sizeof(gausAdcBuf[0]));
|
||||
printf("IWDG refresh,%d,%d,%d,%d\n",
|
||||
gusTempVal, gausAdcBuf[0], gausAdcBuf[1], gausAdcBuf[2]);
|
||||
printf("duty:%d%%,I:%.2fA,V:%.2fV\n", gusDuty*100/2400, adc2Iflla(gausAdcBuf[1]) / 1000.0, adc2Vflla(gausAdcBuf[2])/1000.0);
|
||||
|
||||
iFaultFlag = 0;
|
||||
HAL_GPIO_WritePin(WDO_GPIO_Port, WDO_Pin, GPIO_PIN_SET);
|
||||
HAL_IWDG_Refresh(&hiwdg1);
|
||||
|
||||
Reference in New Issue
Block a user