Procházet zdrojové kódy

解决中间段为外部事件时,脉冲是否发完判断不正确的问题

2
JIU JIALIN před 4 týdny
rodič
revize
d3822d4108
11 změnil soubory, kde provedl 3719 přidání a 3720 odebrání
  1. +11
    -15
      PLSR/PLSR/Core/Src/tim.c
  2. +2
    -2
      PLSR/PLSR/EWARM/settings/test.1.dnx
  3. +464
    -464
      PLSR/PLSR/EWARM/test.1.dep
  4. +2647
    -2644
      PLSR/PLSR/EWARM/test.1/Exe/test.1.hex
  5. binární
      PLSR/PLSR/EWARM/test.1/Exe/test.1.out
  6. binární
      PLSR/PLSR/EWARM/test.1/Exe/test.1.sim
  7. +595
    -595
      PLSR/PLSR/EWARM/test.1/List/test.1.map
  8. binární
      PLSR/PLSR/EWARM/test.1/Obj/gpio.o
  9. binární
      PLSR/PLSR/EWARM/test.1/Obj/os_cpu_c.o
  10. binární
      PLSR/PLSR/EWARM/test.1/Obj/tim.o
  11. binární
      PLSR/PLSR/EWARM/test.1/Obj/tools.o

+ 11
- 15
PLSR/PLSR/Core/Src/tim.c Zobrazit soubor

@@ -1166,9 +1166,10 @@ void PLSR_Route_Set(PLSR_RouteConfig_t* route)
route->section[i].target_freq = ((uint32_t)FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_FREQ_LOW)) |
((uint32_t)FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_FREQ_HIGH) << 16);
/* 目标脉冲数 = 低16位 | (高16位 << 16) */
route->section[i].target_pulse = ((int64_t)FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_PULSE_COUNT_LOW)) |
((int64_t)FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_PULSE_COUNT_HIGH) << 16);
uint16_t pulse_low = FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_PULSE_COUNT_LOW);
uint16_t pulse_high = FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_PULSE_COUNT_HIGH);
int32_t pulse_32bit = (int32_t)((uint32_t)pulse_low | ((uint32_t)pulse_high << 16));
route->section[i].target_pulse = (int64_t)pulse_32bit;
/* 等待条件和跳转编号 */
route->section[i].wait_condition.wait_type = FlashSave_Get_Holding_Register(seg_base_addr + MODBUS_OFFSET_WAIT_CONDITION);
@@ -1754,7 +1755,7 @@ void PLSR_Section_SwitchNext(PLSR_RouteConfig_t* route, uint8_t is_pulse_complet
else
{
// 外部事件触发:直接使用全局脉冲计数器作为累计脉冲数
route->prevPulseCount = PlsrTotalPulseCount;
route->prevPulseCount += (TIM2->CNT + (PartUpdatePluse - SectionUpdatePluse));
SectionUpdatePluse = PlsrTotalPulseCount;
}
}
@@ -2164,18 +2165,13 @@ uint8_t PLSR_Section_CheckPulseComplete(PLSR_RouteConfig_t* route)
PLSR_SectionConfig_t* current_section = &route->section[route->current_section_num - 1];
// 根据等待条件类型检查
if (current_section->wait_condition.wait_type == PLSR_WAIT_PLUSEEND ||
current_section->wait_condition.wait_type == PLSR_WAIT_EXT_OR_END)
{
int64_t target_pulse = current_section->actual_pulse;
if(target_pulse < 0) target_pulse = -target_pulse;
target_pulse += route->prevPulseCount; // 累加上次的脉冲计数

int64_t target_pulse = current_section->actual_pulse;
if(target_pulse < 0) target_pulse = -target_pulse;
target_pulse += route->prevPulseCount; // 累加上次的脉冲计数
return (route->pulse_count >= target_pulse) ? 1 : 0;
}
return 0;
return (route->pulse_count >= target_pulse) ? 1 : 0;

}

/**


+ 2
- 2
PLSR/PLSR/EWARM/settings/test.1.dnx Zobrazit soubor

@@ -12,12 +12,12 @@
<ByteLimit>50</ByteLimit>
</Stack>
<StLinkDriver>
<stlinkserialNo>46232557</stlinkserialNo>
<stlinkfoundProbes />
<CStepIntDis>_ 0</CStepIntDis>
<LeaveTargetRunning>_ 0</LeaveTargetRunning>
<stlinkResetStyle>0</stlinkResetStyle>
<stlinkResetStrategy>2</stlinkResetStrategy>
<stlinkserialNo>46232557</stlinkserialNo>
<stlinkfoundProbes />
</StLinkDriver>
<DebugChecksum>
<Checksum>630028761</Checksum>


+ 464
- 464
PLSR/PLSR/EWARM/test.1.dep
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 2647
- 2644
PLSR/PLSR/EWARM/test.1/Exe/test.1.hex
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


binární
PLSR/PLSR/EWARM/test.1/Exe/test.1.out Zobrazit soubor


binární
PLSR/PLSR/EWARM/test.1/Exe/test.1.sim Zobrazit soubor


+ 595
- 595
PLSR/PLSR/EWARM/test.1/List/test.1.map
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


binární
PLSR/PLSR/EWARM/test.1/Obj/gpio.o Zobrazit soubor


binární
PLSR/PLSR/EWARM/test.1/Obj/os_cpu_c.o Zobrazit soubor


binární
PLSR/PLSR/EWARM/test.1/Obj/tim.o Zobrazit soubor


binární
PLSR/PLSR/EWARM/test.1/Obj/tools.o Zobrazit soubor


Načítá se…
Zrušit
Uložit