26 lines
1.0 KiB
C++
26 lines
1.0 KiB
C++
|
#include "AxisConfig.h"
|
||
|
#include "../config/ConfigManager.h"
|
||
|
|
||
|
void AxisConfig::GetValue(CfgValue& va)
|
||
|
{
|
||
|
std::shared_lock<std::shared_mutex> lock(mtx);
|
||
|
va.speed = m_Speed->GetValue();
|
||
|
va.acc = m_Acc->GetValue();
|
||
|
va.dec = m_Dec->GetValue();
|
||
|
va.rel = m_RefDistance->GetValue();
|
||
|
va.abs = m_AbsPos->GetValue();
|
||
|
}
|
||
|
|
||
|
|
||
|
void AxisConfig::Update(unsigned char* addr)
|
||
|
{
|
||
|
int index = 0;
|
||
|
std::unique_lock<std::shared_mutex> lock(mtx);
|
||
|
m_Speed->SetReatimeValue(S7FLOATDATA(addr[index + 3], addr[index + 2], addr[index + 1], addr[index]).fValue);; index += 4;
|
||
|
m_Acc->SetReatimeValue(S7FLOATDATA(addr[index + 3], addr[index + 2], addr[index + 1], addr[index]).fValue);; index += 4;
|
||
|
m_Dec->SetReatimeValue(S7FLOATDATA(addr[index + 3], addr[index + 2], addr[index + 1], addr[index]).fValue);; index += 4;
|
||
|
m_RefDistance->SetReatimeValue(S7FLOATDATA(addr[index + 3], addr[index + 2], addr[index + 1], addr[index]).fValue);; index += 4;
|
||
|
m_AbsPos->SetReatimeValue(S7FLOATDATA(addr[index + 3], addr[index + 2], addr[index + 1], addr[index]).fValue);; index += 4;
|
||
|
}
|
||
|
|