Skip to content

Commit

Permalink
Added suppression of invalid value in unixtime decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Jun 5, 2024
1 parent e6ac6c9 commit ccdaf4f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/uplink_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
// Added compatibility mode: "status" as in BresserweatherSensorTTN
// 20240603 Added sensor battery status flags (compatibility mode)
// Added command Added CMD_GET_SENSORS_STAT and sensor status decoder
// 20240604 Added suppression of invalid value in unixtime decoder
//
// ToDo:
// -
Expand Down Expand Up @@ -191,6 +192,9 @@ function decoder(bytes, port) {
dateObj = new Date(bytesToInt(bytes) * 1000);
let time = dateObj.toISOString();
let timestamp = bytesToInt(bytes);
if (SKIP_INVALID_SIGNALS && timestamp === 0xFFFFFFFF) {
return NaN;
}
return { time: time, timestamp: timestamp };
};
unixtime.BYTES = 4;
Expand Down

0 comments on commit ccdaf4f

Please sign in to comment.