mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-25 09:51:10 -04:00
Clean up AIS lat/lon types and formatting.
This commit is contained in:
parent
1e92d416c7
commit
f3989050e8
4 changed files with 82 additions and 13 deletions
|
@ -178,13 +178,13 @@ DateTime Packet::datetime(const size_t start_bit) const {
|
|||
Latitude Packet::latitude(const size_t start_bit) const {
|
||||
// Shifting and dividing is to sign-extend the source field.
|
||||
// TODO: There's probably a more elegant way to do it.
|
||||
return static_cast<int32_t>(field_.read(start_bit, 27) << 5) / 32;
|
||||
return field_.read(start_bit, 27);
|
||||
}
|
||||
|
||||
Longitude Packet::longitude(const size_t start_bit) const {
|
||||
// Shifting and dividing is to sign-extend the source field.
|
||||
// TODO: There's probably a more elegant way to do it.
|
||||
return static_cast<int32_t>(field_.read(start_bit, 28) << 4) / 16;
|
||||
return field_.read(start_bit, 28);
|
||||
}
|
||||
|
||||
bool Packet::crc_ok() const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue