From 3ff11b4fe3af1d7959b903f307827b338a9a92e2 Mon Sep 17 00:00:00 2001
From: "Christian W. Zuckschwerdt" <christian@zuckschwerdt.org>
Date: Fri, 23 Dec 2022 11:54:12 +0100
Subject: [PATCH] minor: Change Digitech-XC0324 to default enabled

---
 README.md                     |  4 ++--
 conf/rtl_433.example.conf     |  2 +-
 man/man1/rtl_433.1            |  2 +-
 src/devices/digitech_xc0324.c | 19 ++++++++++---------
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index cfba998d..801a9415 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
 		= General options =
   [-V] Output the version string and exit
   [-v] Increase verbosity (can be used multiple times).
-       -v : verbose, -vv : verbose decoders, -vvv : debug decoders, -vvvv : trace decoding).
+       -v : verbose notice, -vv : verbose info, -vvv : debug, -vvvv : trace.
   [-c <path>] Read config options from a file
 		= Tuner options =
   [-d <RTL-SDR USB device index> | :<RTL-SDR USB device serial> | <SoapySDR device query> | rtl_tcp | help]
@@ -202,7 +202,7 @@ See [CONTRIBUTING.md](./docs/CONTRIBUTING.md).
     [117]* ESA1000 / ESA2000 Energy Monitor
     [118]* Biltema rain gauge
     [119]  Bresser Weather Center 5-in-1
-    [120]* Digitech XC-0324 temperature sensor
+    [120]  Digitech XC-0324 / AmbientWeather FT005RH temp/hum sensor
     [121]  Opus/Imagintronix XT300 Soil Moisture
     [122]* FS20
     [123]* Jansite TPMS Model TY02S
diff --git a/conf/rtl_433.example.conf b/conf/rtl_433.example.conf
index 39a1b551..5673a18f 100644
--- a/conf/rtl_433.example.conf
+++ b/conf/rtl_433.example.conf
@@ -341,7 +341,7 @@ stop_after_successful_events false
 # protocol 117 # ESA1000 / ESA2000 Energy Monitor
 # protocol 118 # Biltema rain gauge
   protocol 119 # Bresser Weather Center 5-in-1
-# protocol 120 # Digitech XC-0324 temperature sensor
+  protocol 120 # Digitech XC-0324 / AmbientWeather FT005RH temp/hum sensor
   protocol 121 # Opus/Imagintronix XT300 Soil Moisture
 # protocol 122 # FS20
 # protocol 123 # Jansite TPMS Model TY02S
diff --git a/man/man1/rtl_433.1 b/man/man1/rtl_433.1
index b791c418..921b57ae 100644
--- a/man/man1/rtl_433.1
+++ b/man/man1/rtl_433.1
@@ -44,7 +44,7 @@ Output the version string and exit
 .TP
 [ \fB\-v\fI\fP ]
 Increase verbosity (can be used multiple times).
-       \-v : verbose, \-vv : verbose decoders, \-vvv : debug decoders, \-vvvv : trace decoding).
+       \-v : verbose notice, \-vv : verbose info, \-vvv : debug, \-vvvv : trace.
 .TP
 [ \fB\-c\fI <path>\fP ]
 Read config options from a file
diff --git a/src/devices/digitech_xc0324.c b/src/devices/digitech_xc0324.c
index ff3f92ab..00f829f6 100644
--- a/src/devices/digitech_xc0324.c
+++ b/src/devices/digitech_xc0324.c
@@ -9,7 +9,9 @@
     (at your option) any later version.
 */
 /**
-Digitech XC-0324 device.
+Decoder for Digitech XC-0324 temperature sensor.
+
+Also AmbientWeather FT005RH.
 
 The encoding is pulse position modulation
 (i.e. gap width contains the modulation information)
@@ -88,9 +90,9 @@ static int decode_xc0324_message(r_device *decoder, bitbuffer_t *bitbuffer,
     // NB : b[0] ^ b[1] ^ b[2] ^ b[3] ^ b[4] ^ b[5] == 0x00 for a clean message
     chksum = xor_bytes(b, 6);
     if (chksum != 0x00) {
-        if (decoder->verbose) {
+        if (decoder->verbose > 1) {
             // Output the "bad" message (only for message level deciphering!)
-            decoder_logf_bitrow(decoder, 1, __func__, b, XC0324_MESSAGE_BITLEN,
+            decoder_logf_bitrow(decoder, 2, __func__, b, XC0324_MESSAGE_BITLEN,
                     "chksum = 0x%02X not 0x00 <- XC0324:vv row %d bit %d",
                     chksum, row, bitpos);
         }
@@ -125,8 +127,8 @@ static int decode_xc0324_message(r_device *decoder, bitbuffer_t *bitbuffer,
     }
 
     // Output (simulated) message level deciphering information..
-    if (decoder->verbose) {
-        decoder_logf_bitrow(decoder, 1, __func__, b, XC0324_MESSAGE_BITLEN,
+    if (decoder->verbose > 1) {
+        decoder_logf_bitrow(decoder, 2, __func__, b, XC0324_MESSAGE_BITLEN,
                 "Temp was %4.1f <- XC0324:vv row %03d bit %03d",
                 temperature, row, bitpos);
     }
@@ -144,7 +146,7 @@ static int decode_xc0324_message(r_device *decoder, bitbuffer_t *bitbuffer,
 Digitech XC-0324 device.
 @sa decode_xc0324_message()
 */
-static int xc0324_callback(r_device *decoder, bitbuffer_t *bitbuffer)
+static int digitech_xc0324_decode(r_device *decoder, bitbuffer_t *bitbuffer)
 {
     uint8_t const preamble_pattern[] = {0x5F};
 
@@ -216,12 +218,11 @@ static char *output_fields[] = {
 };
 
 r_device digitech_xc0324 = {
-        .name        = "Digitech XC-0324 temperature sensor",
+        .name        = "Digitech XC-0324 / AmbientWeather FT005RH temp/hum sensor",
         .modulation  = OOK_PULSE_PPM,
         .short_width = 520,  // = 130 * 4
         .long_width  = 1000, // = 250 * 4
         .reset_limit = 3000,
-        .decode_fn   = &xc0324_callback,
-        .disabled    = 1, // stop debug output from spamming unsuspecting users
+        .decode_fn   = &digitech_xc0324_decode,
         .fields      = output_fields,
 };