云台电源和网络电源分开控制

streaming
Matthew 4 months ago
parent 9b59489969
commit 6be75f4a8e

@ -556,7 +556,7 @@ public:
PowerControl(CMD_SET_OTG_STATE, CMD_SET_NETWORK_POWER_EN, CMD_SET_PIC1_POWER, CMD_SET_485_EN_STATE, closeDelayTime) PowerControl(CMD_SET_OTG_STATE, CMD_SET_NETWORK_POWER_EN, CMD_SET_PIC1_POWER, CMD_SET_485_EN_STATE, closeDelayTime)
#else // USING_N938 #else // USING_N938
#ifdef USING_PLZ #ifdef USING_PLZ
PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_PTZ_PWR_ENABLE, CMD_SET_100M_ENABLE, CMD_SET_100M_SWITCH_PWR_ENABLE, CMD_SET_485_ENABLE, CMD_SET_12V_EN_STATE, closeDelayTime) PowerControl(CMD_SET_PTZ_PWR_ENABLE, CMD_SET_485_ENABLE, CMD_SET_12V_EN_STATE, closeDelayTime)
#else // USING_PLZ #else // USING_PLZ
PowerControl(CMD_SET_OTG_STATE, CMD_SET_12V_EN_STATE, closeDelayTime) PowerControl(CMD_SET_OTG_STATE, CMD_SET_12V_EN_STATE, closeDelayTime)
#endif // USING_PLZ #endif // USING_PLZ
@ -565,6 +565,23 @@ public:
} }
}; };
class EthernetPowerCtrl : public PowerControl
{
public:
EthernetPowerCtrl(uint32_t closeDelayTime) :
#ifdef USING_N938
PowerControl(CMD_SET_OTG_STATE, CMD_SET_NETWORK_POWER_EN, closeDelayTime)
#else // USING_N938
#ifdef USING_PLZ
PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_100M_ENABLE, CMD_SET_100M_SWITCH_PWR_ENABLE, closeDelayTime)
#else // USING_PLZ
PowerControl(CMD_SET_OTG_STATE, closeDelayTime)
#endif // USING_PLZ
#endif // USING_N938
{
}
};
class UsbCameraPowerCtrl : public PowerControl class UsbCameraPowerCtrl : public PowerControl
{ {
public: public:

@ -645,6 +645,7 @@ void CPhoneDevice::SetRecognizationCfg(const IDevice::CFG_RECOGNIZATION* pRecogn
bool CPhoneDevice::BindNetwork(int sock) bool CPhoneDevice::BindNetwork(int sock)
{ {
#ifdef USING_ETHERNET
m_devLocker.lock(); m_devLocker.lock();
net_handle_t defNetHandle = m_defNetHandle; net_handle_t defNetHandle = m_defNetHandle;
m_devLocker.unlock(); m_devLocker.unlock();
@ -658,6 +659,7 @@ bool CPhoneDevice::BindNetwork(int sock)
} }
return res == 0; return res == 0;
} }
#endif // USING_ETHERNET
return true; return true;
} }
@ -1509,6 +1511,9 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
std::this_thread::sleep_for(std::chrono::milliseconds(waitTime)); std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
} }
XYLOG(XYLOG_SEVERITY_ERROR, "Ethernet Power ON");
std::shared_ptr<PowerControl> ethernetPowerCtrl = std::make_shared<EthernetPowerCtrl>(1);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
SetStaticIp(); SetStaticIp();
std::this_thread::sleep_for(std::chrono::milliseconds(256)); std::this_thread::sleep_for(std::chrono::milliseconds(256));
@ -1616,6 +1621,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); std::this_thread::sleep_for(std::chrono::milliseconds(1000));
} }
ethernetPowerCtrl.reset();
cv::Mat rgb; cv::Mat rgb;
if (netCaptureResult && !img.empty()) if (netCaptureResult && !img.empty())
{ {

Loading…
Cancel
Save