Skip to content

Commit aa9894a

Browse files
committed
wip: update comments
1 parent accad40 commit aa9894a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/devices/oil_smart.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ Should apply to similar Watchman, Beckett, and Apollo devices too.
2323
There is a preamble plus de-sync of 555558, then MC coded an inner preamble of 5558 (raw 9999996a).
2424
End of frame is the last half-bit repeated additional 2 times, then 4 times mark.
2525
26-
FIXME: confirm this
27-
The sensor sends a single packet once every hour or twice a second
28-
for 11 minutes when in pairing/test mode (pairing needs 35 sec).
29-
depth reading is in cm, lowest reading is ~3, highest is ~305, 0 is invalid
26+
The sensor sends a single packet once every half hour or twice a second
27+
for 5 minutes when in pairing/test mode.
28+
Depth reading is in cm, lowest reading is ~3, highest is ~305, 0 is invalid
3029
3130
Data Format:
3231
@@ -45,8 +44,9 @@ Data Layout:
4544
4645
example packets are:
4746
48-
raw: {158}555558 9999 996a 6559aaa99996a55696a9a5963c
49-
aligned: {134}9999996a 6559aaa999969aa6aa9a6995fc
47+
- raw: {158}555558 9999 996a 6559aaa99996a55696a9a5963c
48+
- aligned: {134}9999996a 6559aaa999969aa6aa9a6995 fc
49+
- decoded: 5558 bd01 5642 0497
5050
5151
FIXME: this is not confirmed
5252
Start of frame full preamble is depending on first data bit either
@@ -89,25 +89,28 @@ static int oil_smart_decode(r_device *decoder, bitbuffer_t *bitbuffer, unsigned
8989
// 0x20: (unknown toggle)
9090
// 0x40: (unknown toggle)
9191
// 0x80: (always zero?)
92+
93+
// idle flags are : 0x17
94+
// counter value appears to change variously to: 0c 0e 10 12
9295
uint8_t flags = b[4];
9396
uint8_t alarm = b[5];
9497

9598
// FIXME: confirm there is a binding counter
9699
uint16_t depth = 0;
97100
uint16_t binding_countdown = 0;
98-
if (flags & 1) {
101+
// if (flags & 1) {
99102
// When binding, the countdown counts up from 0x40 to 0x4a
100103
// (as long as you hold the magnet to it for long enough)
101104
// before the device ID changes. The receiver unit needs
102105
// to receive this *strongly* in order to change its
103106
// allegiance.
104-
binding_countdown = b[6];
105-
}
106-
else {
107+
// binding_countdown = b[6];
108+
// }
109+
// else {
107110
// A depth reading of zero indicates no reading.
108111
//depth = ((b[5] & 0x02) << 7) | b[6];
109112
depth = b[6];
110-
}
113+
// }
111114

112115
/* clang-format off */
113116
data_t *data = data_make(

0 commit comments

Comments
 (0)