Add support for Fine Offset WN32B (closes )

This commit is contained in:
Christian W. Zuckschwerdt 2023-12-25 20:23:57 +01:00
parent cf4c74de09
commit 83afc7b439
3 changed files with 15 additions and 9 deletions

View file

@ -163,7 +163,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
[75] LaCrosse TX35DTH-IT, TFA Dostmann 30.3155 Temperature/Humidity sensor
[76] LaCrosse TX29IT, TFA Dostmann 30.3159.IT Temperature sensor
[77] Vaillant calorMatic VRT340f Central Heating Control
[78] Fine Offset Electronics, WH25, WH32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
[78] Fine Offset Electronics, WH25, WH32, WH32B, WN32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
[79] Fine Offset Electronics, WH0530 Temperature/Rain Sensor
[80] IBIS beacon
[81] Oil Ultrasonic STANDARD FSK

View file

@ -304,7 +304,7 @@ convert si
protocol 75 # LaCrosse TX35DTH-IT, TFA Dostmann 30.3155 Temperature/Humidity sensor
protocol 76 # LaCrosse TX29IT, TFA Dostmann 30.3159.IT Temperature sensor
protocol 77 # Vaillant calorMatic VRT340f Central Heating Control
protocol 78 # Fine Offset Electronics, WH25, WH32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
protocol 78 # Fine Offset Electronics, WH25, WH32, WH32B, WN32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor
protocol 79 # Fine Offset Electronics, WH0530 Temperature/Rain Sensor
protocol 80 # IBIS beacon
protocol 81 # Oil Ultrasonic STANDARD FSK

View file

@ -437,7 +437,7 @@ static int fineoffset_WH0290_callback(r_device *decoder, bitbuffer_t *bitbuffer)
}
/**
Fine Offset Electronics WH25 / WH32B Temperature/Humidity/Pressure sensor protocol.
Fine Offset Electronics WH25 / WH32 / WH32B / WN32B Temperature/Humidity/Pressure sensor protocol.
The sensor sends a package each ~64 s with a width of ~28 ms. The bits are PCM modulated with Frequency Shift Keying.
@ -474,9 +474,15 @@ static int fineoffset_WH25_callback(r_device *decoder, bitbuffer_t *bitbuffer)
unsigned bit_offset;
// Validate package
if (bitbuffer->bits_per_row[0] < 190) {
if (bitbuffer->bits_per_row[0] < 160) {
// Nominal length of WH0290 is 129 bits
return fineoffset_WH0290_callback(decoder, bitbuffer); // abort and try WH0290
} else if (bitbuffer->bits_per_row[0] < 440) { // Nominal size is 488 bit periods
}
else if (bitbuffer->bits_per_row[0] < 190) {
// Nominal length of WN32B is 173 bits
type = 32; // new WN32B
}
else if (bitbuffer->bits_per_row[0] < 440) { // Nominal size is 488 bit periods
return fineoffset_WH24_callback(decoder, bitbuffer); // abort and try WH24, WH65B, HP1000
}
@ -485,14 +491,14 @@ static int fineoffset_WH25_callback(r_device *decoder, bitbuffer_t *bitbuffer)
}
// Find a data package and extract data payload
// Normal index of WH25 is 367, and 123, 570 for WH32B
// skip some bytes to find faster
bit_offset = bitbuffer_search(bitbuffer, 0, 100, preamble, sizeof(preamble) * 8) + sizeof(preamble) * 8;
// Nominal index of WH25 is 367, and 123, 570 for WH32B
bit_offset = bitbuffer_search(bitbuffer, 0, 0, preamble, sizeof(preamble) * 8) + sizeof(preamble) * 8;
if (bit_offset + sizeof(b) * 8 > bitbuffer->bits_per_row[0]) { // Did not find a big enough package
decoder_logf_bitbuffer(decoder, 1, __func__, bitbuffer, "short package. Header index: %u", bit_offset);
return DECODE_ABORT_LENGTH;
}
bitbuffer_extract_bytes(bitbuffer, 0, bit_offset, b, sizeof(b) * 8);
decoder_log_bitrow(decoder, 2, __func__, b, sizeof(b) * 8, "Packet");
// Verify type code
int msg_type = b[0] & 0xf0;
@ -1020,7 +1026,7 @@ r_device const fineoffset_WH2 = {
};
r_device const fineoffset_WH25 = {
.name = "Fine Offset Electronics, WH25, WH32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor",
.name = "Fine Offset Electronics, WH25, WH32, WH32B, WN32B, WH24, WH65B, HP1000, Misol WS2320 Temperature/Humidity/Pressure Sensor",
.modulation = FSK_PULSE_PCM,
.short_width = 58, // Bit width = 58µs (measured across 580 samples / 40 bits / 250 kHz)
.long_width = 58, // NRZ encoding (bit width = pulse width)