step should not be constant but dependent on valid measurements
This commit is contained in:
parent
9e79787a41
commit
dc805547d9
|
|
@ -175,7 +175,18 @@ func DecodePayload(s string, deveui string, devaddr string, lrrlat float32, lrrl
|
|||
if write2file {
|
||||
// Time of first Packet
|
||||
var tfp = (time.Now().Unix() / 60) - int64(pl_1.O)
|
||||
var step = int64(pl_1.O / 7)
|
||||
humidity_values := []uint8{pl_1.H1, pl_1.H2, pl_1.H3, pl_1.H4, pl_1.H5, pl_1.H6, pl_1.H7, pl_1.H8}
|
||||
valid_measurements := 0
|
||||
for _, v := range humidity_values {
|
||||
if v > 0 {
|
||||
valid_measurements = valid_measurements + 1
|
||||
}
|
||||
}
|
||||
fmt.Printf("Valid Measurements: %d,\n", valid_measurements)
|
||||
var step int64
|
||||
if valid_measurements > 1 {
|
||||
step = int64(int(pl_1.O) / (valid_measurements - 1))
|
||||
}
|
||||
|
||||
// the first temperature is usually too high (maybe becaus of lorawan send, so we take
|
||||
// the second measurement as first..., the same for humidity, which is usually too low...
|
||||
|
|
|
|||
Loading…
Reference in New Issue