Merge pull request #336 from cyberman54/development

update payload decoder for rcommand 0x86
This commit is contained in:
Verkehrsrot 2019-03-31 20:51:38 +02:00 committed by GitHub
commit 86f7e91751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -389,9 +389,21 @@ Note: all settings are stored in NVRAM and will be reloaded when device starts.
0x86 get time/date
Device answers with it's local time/date (UTC Unix epoch) on Port 2:
bytes 1..4 = local time/date in UTC epoch seconds
byte 5 = bits 0..3 timeSource, bits 4..7 timeStatus
Device answers with it's current time on Port 2:
bytes 1..4 = time/date in UTC epoch seconds (LSB)
byte 5 = time source & status, see below
bits 0..3 time source
0x00 = GPS
0x01 = RTC
0x02 = LORA
0x03 = unsynched
bits 4..7 time status
0x00 = timeNotSet (never synched)
0x10 = timeNeedsSync (last sync failed)
0x20 = timeSet (synched)
0x87 set time/date

View File

@ -34,8 +34,8 @@ function Decoder(bytes, port) {
return decode(bytes, [uint16, uptime, uint8, uint32, uint8, uint8], ['voltage', 'uptime', 'cputemp', 'memory', 'reset0', 'reset1']);
}
// epoch time answer
if (bytes.length === 4) {
return decode(bytes, [uint32], ['time']);
if (bytes.length === 5) {
return decode(bytes, [uint32, uint8], ['time', 'timestatus']);
}
}