Skip to content

Commit a8a619f

Browse files
committed
Fix UDP alti field type (u32 > f64).
Fixes #66.
1 parent 21a1dd1 commit a8a619f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/backend/semtech_udp/structs.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ pub struct Stat {
529529
pub long: f64,
530530
/// GPS altitude of the gateway in meter RX (integer).
531531
#[serde(default)]
532-
pub alti: u32,
532+
pub alti: f64,
533533
/// Number of radio packets received (unsigned integer).
534534
pub rxnb: u32,
535535
/// Number of radio packets received with a valid PHY CRC.
@@ -552,11 +552,11 @@ impl Stat {
552552
gateway_id: hex::encode(gateway_id),
553553
time: Some(pbjson_types::Timestamp::from(self.time)),
554554
location: {
555-
if self.lati != 0.0 || self.long != 0.0 || self.alti != 0 {
555+
if self.lati != 0.0 || self.long != 0.0 || self.alti != 0.0 {
556556
Some(common::Location {
557557
latitude: self.lati,
558558
longitude: self.long,
559-
altitude: self.alti.into(),
559+
altitude: self.alti,
560560
source: common::LocationSource::Gps.into(),
561561
..Default::default()
562562
})
@@ -970,7 +970,7 @@ mod test {
970970
time: now,
971971
lati: 0.0,
972972
long: 0.0,
973-
alti: 0,
973+
alti: 0.0,
974974
rxnb: 10,
975975
rxok: 5,
976976
rxfw: 5,
@@ -1010,7 +1010,7 @@ mod test {
10101010
time: now,
10111011
lati: 1.1,
10121012
long: 2.2,
1013-
alti: 3,
1013+
alti: -3.3,
10141014
rxnb: 10,
10151015
rxok: 5,
10161016
rxfw: 5,
@@ -1032,7 +1032,7 @@ mod test {
10321032
location: Some(common::Location {
10331033
latitude: 1.1,
10341034
longitude: 2.2,
1035-
altitude: 3.0,
1035+
altitude: -3.3,
10361036
source: common::LocationSource::Gps.into(),
10371037
..Default::default()
10381038
}),
@@ -1056,7 +1056,7 @@ mod test {
10561056
time: now,
10571057
lati: 0.0,
10581058
long: 0.0,
1059-
alti: 0,
1059+
alti: 0.0,
10601060
rxnb: 10,
10611061
rxok: 5,
10621062
rxfw: 5,

0 commit comments

Comments
 (0)