优化中断向量地址设置

This commit is contained in:
2026-09-07 15:16:59 +08:00
parent dac0e92ac9
commit c65fa4fe1d
4 changed files with 1823 additions and 8 deletions
+16 -8
View File
@@ -84,7 +84,7 @@ void currentUpdate(void)
static void filamentThread(void *arg)
{
int iWorkCmd = 0;
int iCnt = 0;
uint32_t ulLastTick = HAL_GetTick();
loadSysParam();
if ((gptSysParam->usPreheatCurrent < 100) || (gptSysParam->usPreheatCurrent > 5000)) {
@@ -123,8 +123,16 @@ static void filamentThread(void *arg)
iWorkCmd = 3;
if (gucWorkState == 1) {
gucWorkState = 2;
if (gusNormalDuty < gusPreheatDuty * 1.5 ) {
gusNormalDuty = gusPreheatDuty * 1.5;
// if (gusNormalDuty < gusPreheatDuty * 1.5 ) {
// gusNormalDuty = gusPreheatDuty * 1.5;
// }
gusNormalDuty = gusPreheatDuty * 1.5;
gusDuty = gusNormalDuty;
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, gusDuty);
osDelay(3);
} else if (gucWorkState == 2) {
if (gusNormalDuty < 750) {
gusNormalDuty += 10;
}
gusDuty = gusNormalDuty;
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, gusDuty);
@@ -149,17 +157,17 @@ static void filamentThread(void *arg)
__HAL_TIM_SET_COMPARE(&htim1, TIM_CHANNEL_1, gusDuty);
}
iCnt++;
if (iCnt < 1000) {
if (HAL_GetTick() - ulLastTick < 500) {
continue;
}
iCnt = 0;
ulLastTick = HAL_GetTick();
printf("\n");
printf("\n");
printf("ADC: %d,%d,%d\n", gausAdcBuf[0], gausAdcBuf[1], gausAdcBuf[2]);
printf("workState:%d,duty:%d%%,I:%.3fA,V:%.2fV\n", gucWorkState, gusDuty * 100 / 2400, gusFilamentCurrent/1000.0, gusFilamentVoltage/1000.0);
gusXrayCurrent = adc2Xray(gausAdcBuf[0]);
printf("workState:%d,duty:%d%%,I:%.3fA,V:%.2fV,Xray:%.3fmA\n", gucWorkState, gusDuty * 100 / 2400, gusFilamentCurrent/1000.0, gusFilamentVoltage/1000.0, gusXrayCurrent/1000.0/1000.0/1000.0);
}
}