fix kx bugs
git-svn-id: svn://db.shs.com.ru/libs@8 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -126,12 +126,14 @@ void KX_Coefficients::received(bool correct) {
|
||||
return;
|
||||
};
|
||||
}
|
||||
if (k_syns.first_index < 0 || k_syns.count < 0) return;
|
||||
if (k_syns.first_index == 0) {
|
||||
//cout << "first receive\n";
|
||||
k_tmp.resize(k_syns.full_count);
|
||||
received_cnt = 0;
|
||||
}
|
||||
//for (int i = 0; i < k_syns.count; i++) K.at(k_syns.first_index + i) = k_syns.coeffs[i];
|
||||
//piCout << k_tmp.size() << k_syns.first_index << k_syns.count;
|
||||
memcpy(k_tmp.data(k_syns.first_index), k_syns.coeffs, k_syns.count);
|
||||
received_cnt += k_syns.count;
|
||||
tm.reset();
|
||||
@@ -168,7 +170,7 @@ void KX_Coefficients::renew() {
|
||||
|
||||
void KX_Coefficients::tick(void * , int ) {
|
||||
//piCout << "timer" << tm.elapsed_s();
|
||||
if (tm.elapsed_s() < 2.) return;
|
||||
if (tm.elapsed_s() < 10.) return;
|
||||
if (waitingCommit) {
|
||||
//cout << "commit timeout\n";
|
||||
//cout << "send failed\n";
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
from_buff.addr_to = ce.getValue("addr_x", 0x75);
|
||||
from_pult = from_buff;
|
||||
for (int i = 0; i < KX_X_PACKET_NUM; ++i)
|
||||
to_pult.x_num[i] = -1;
|
||||
to_pult.x_num[i] = from_pult.x_num[i] = -1;
|
||||
packetExtractor()->setSplitMode(PIPacketExtractor::Header);
|
||||
packetExtractor()->setHeader(PIByteArray(&from_buff, 2));
|
||||
start();
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
bool aboutSend() {
|
||||
for (int i = 0; i < KX_X_PACKET_NUM; ++i) {
|
||||
to_pult.x_num[i] = from_pult.x_num[i];
|
||||
to_pult.x_data[i] = X[from_pult.x_num[i]];
|
||||
to_pult.x_data[i] = from_pult.x_num[i] < 0 ? 0. : X[from_pult.x_num[i]];
|
||||
}
|
||||
to_pult.checksum = checksum_i(&to_pult, sizeof(to_pult) - 4);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user