Converts negative values due overflow of one node to correct value
Maximum timesamp is 1000. Node N1 sends 999 as timesamp. N2 recieves and sends delayed and increased timestamp back. Delay is 10, so timestamp would be 1009, but due overflow 009 is sent back. Now calculate TOF: 009 - 999 = -990 -> not correct time, so wrap() Wrap calculation: -990 + 1000 = 10 -> correct time
- Returns
_timestamp = 0;
}
}
}
}
}
}
_timestamp = value;
}
_timestamp = 0;
_timestamp |= ((int64_t)data[i] << (i*8));
}
}
}
}
}
return _timestamp;
}
data[i] = (byte)((_timestamp >> (i*8)) & 0xFF);
}
}
}
}
}
if(_timestamp < 0) {
}
return *this;
}
return (0 <= _timestamp && _timestamp <=
TIME_MAX);
}
if(this == &assign) {
return *this;
}
return *this;
}
return *this;
}
}
return *this;
}
}
_timestamp *= factor;
return *this;
}
}
return *this;
}
}
_timestamp /= factor;
return *this;
}
}
return *this;
}
}
}
}
#ifdef DW1000TIME_H_PRINTABLE
Serial.print(*this);
Serial.println();
}
int64_t number = _timestamp;
unsigned char buf[21];
uint8_t i = 0;
uint8_t printed = 0;
if(number == 0) {
p.print((char)'0');
return 1;
}
if(number < 0) {
p.print((char)'-');
number = -number;
printed++;
}
while(number > 0) {
int64_t q = number/10;
buf[i++] = number-q*10;
number = q;
}
printed += i;
for(; i > 0; i--)
p.print((char)(buf[i-1] < 10 ? '0'+buf[i-1] : 'A'+buf[i-1]-10));
return printed;
}
#endif // DW1000Time_H_PRINTABLE