Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support r900 m v4 non bcd - DRAFT #2969

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/devices/neptune_r900.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ After decoding the bitstream into 104 bits of payload, the layout appears to be:

Data layout:

IIIIIIII IIIIIIII IIIIIIII IIIIIIII UUUUUUUU ???NNNBB CCCCCCCC CCCCCCCC CCCCCCCC UU?TTTLL EEEEEEEE EEEEEEEE EEEEEEEE
IIIIIIII IIIIIIII IIIIIIII IIIIIIII UUUUMMMM ???NNNBB CCCCCCCC CCCCCCCC CCCCCCCC UU?TTTLL EEEEEEEE EEEEEEEE EEEEEEEE

- I: 32-bit little-endian id
- U: 8-bit Unknown1
- U: 4-bit Unknown1
- M: 4-bit Meter Type
- N: 6-bit NoUse (3 bits)
- B: 2-bit backflow flag
- C: 24-bit Consumption Data, might be 1/10 gallon units
- U: 2-bit Unknown3
- U: 2-bit Unknown3, perhaps added (first 2 bits) of consumption???
- T: 4-bit days of leak mapping (3 bits)
- L: 2-bit leak flag type
- E: 24-bit extra data????
Expand Down Expand Up @@ -144,8 +145,10 @@ static int neptune_r900_decode(r_device *decoder, bitbuffer_t *bitbuffer)

// meter_id 32 bits
uint32_t meter_id = ((uint32_t)b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
//Unkn1 8 bits
int unkn1 = b[4];
//Unkn1 4 bits
int unkn1 = b[4] >> 4;
//MeterType 4 bits
int metertype = b[4]&0x0F;
//Unkn2 3 bits
int unkn2 = b[5] >> 5;
//NoUse 3 bits
Expand All @@ -163,8 +166,8 @@ static int neptune_r900_decode(r_device *decoder, bitbuffer_t *bitbuffer)
// 1 = low
// 2 = high
int backflow = b[5]&0x03;
//Consumption 24 bits
int consumption = (b[6] << 16) | (b[7] << 8) | (b[8]);
//Consumption 26 bits ??
int consumption = ((b[9] >> 6) << 24) | (b[6] << 16) | (b[7] << 8) | (b[8]);
//Unkn3 2 bits + 1 bit ???
int unkn3 = b[9] >> 5;
//Leak 3 bits
Expand All @@ -191,6 +194,7 @@ static int neptune_r900_decode(r_device *decoder, bitbuffer_t *bitbuffer)
"model", "", DATA_STRING, "Neptune-R900",
"id", "", DATA_INT, meter_id,
"unkn1", "", DATA_INT, unkn1,
"metertype", "", DATA_INT, metertype,
"unkn2", "", DATA_INT, unkn2,
"nouse", "", DATA_INT, nouse,
"backflow", "", DATA_INT, backflow,
Expand Down Expand Up @@ -218,6 +222,7 @@ static char const *const output_fields[] = {
"model",
"id",
"unkn1",
"metertype",
"unkn2",
"nouse",
"backflow",
Expand Down
Loading