LAPTOP-SNT8I5JK\Boounion
2025-04-30 d38d98d99e873d0a48e75aa9f8472cff4574c132
SourceCode/Bond/Servo/CWriteStep.cpp
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "CWriteStep.h"
#include "Common.h"
#include "CEquipment.h"
namespace SERVO {
@@ -88,9 +89,9 @@
            // 1.写数据
            nextStep();
            ASSERT(m_pCclink);
            int nRet = m_pCclink->WriteData(m_station, (short)DeviceType::W,
            int nWriteRet = m_pCclink->WriteData(m_station, (short)DeviceType::W,
               m_nWriteDevNo, m_nWriteDataSize, (short*)m_szBuffer);
            if (0 != nRet) {
            if (0 != nWriteRet) {
               onTimeout();
               goto RESET;
            }
@@ -98,14 +99,14 @@
            // 2.给对方写ON
            nextStep();
            m_pCclink->SetBitDevice(m_station, DeviceType::B, m_nWriteSignalDev);
            m_pCclink->SetBitDeviceEx(m_station, (long)DeviceType::B, m_nWriteSignalDev);
            // 3.等待对方ON
            nextStep();
            int nStep3Ret = ::WaitForSingleObject(m_hRecvSignalOn, TIMEOUT * 1000);
            if (nStep3Ret == WAIT_TIMEOUT) {
               m_pCclink->ResetBitDevice(m_station, DeviceType::B, m_nWriteSignalDev);
               m_pCclink->ResetBitDeviceEx(m_station, (long)DeviceType::B, m_nWriteSignalDev);
               onTimeout();
               goto RESET;
            }
@@ -114,15 +115,14 @@
            // 4.дOFF
            nextStep();
            m_pCclink->ResetBitDevice(m_station, DeviceType::B, m_nWriteSignalDev);
            m_pCclink->ResetBitDeviceEx(m_station, (long)DeviceType::B, m_nWriteSignalDev);
            // 6.完成
            nextStep();
            if (0 == onComplete()) {
               if (m_listener.onEvent != nullptr) {
                  m_listener.onEvent(this, STEP_EVENT_COMPLETE, nullptr);
               }
               ASSERT(m_pEquipment);
               m_pEquipment->onStepEvent(this, STEP_EVENT_COMPLETE);
            }
         }
      }