summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fmrxd.h6
-rw-r--r--rds.c4
-rw-r--r--server.c2
-rw-r--r--signal.c10
-rw-r--r--tuner.c2
5 files changed, 17 insertions, 7 deletions
diff --git a/fmrxd.h b/fmrxd.h
index 9473510..9c74ce6 100644
--- a/fmrxd.h
+++ b/fmrxd.h
@@ -38,8 +38,10 @@
#define TUNER_DEVICE_ID 0
/** Enable the wl1273 N950/N9 RDS decoding workarounds. */
-#define CRAPPY_WL1273_RDS 1
+#define WORKAROUND_BAD_WL1273_RDS 1
+/** Enable the wl1273 N950/N9 signal level workarounds. */
+#define WORKAROUND_BAD_WL1273_SIGNAL 1
/** Poll the signal level every this many seconds. */
#define SIGNAL_POLL_INTERVAL 10
/** After tuning, refresh the signal level once after this many miliseconds. */
@@ -80,7 +82,7 @@ bool configure_capture(bool on);
bool configure_tuner(bool on);
extern int tuner_fd;
bool tuner_set_frequency(double mhz);
-uint16_t tuner_get_signal();
+int32_t tuner_get_signal();
bool tuner_search(bool forward);
/* rds.c -- RDS decoder */
diff --git a/rds.c b/rds.c
index ed116a2..1c41d4d 100644
--- a/rds.c
+++ b/rds.c
@@ -25,7 +25,7 @@
#include "fmrxd.h"
-#if CRAPPY_WL1273_RDS
+#if WORKAROUND_BAD_WL1273_RDS
#define WL1273_RDS_BLOCK_A 0
#define WL1273_RDS_BLOCK_B 1
#define WL1273_RDS_BLOCK_C 2
@@ -190,7 +190,7 @@ static gboolean rds_callback(GIOChannel *source, GIOCondition condition,
int block;
bool error;
-#if CRAPPY_WL1273_RDS
+#if WORKAROUND_BAD_WL1273_RDS
block = rds.block & WL1273_RDS_BLOCK_MASK;
// The following is, in a "more" readable way, swapping 3 and 4.
switch (block) {
diff --git a/server.c b/server.c
index 7b2cb53..7871381 100644
--- a/server.c
+++ b/server.c
@@ -73,7 +73,7 @@ static const char * introspect_data = {
" <signal name=\"Stopped\">\n"
" </signal>\n"
" <signal name=\"SignalLevelChanged\">\n"
- " <arg type=\"q\" name=\"signal\" />\n"
+ " <arg type=\"q\" name=\"level\" />\n"
" </signal>\n"
" <signal name=\"PiReceived\">\n"
" <arg type=\"q\" name=\"pi\" />\n"
diff --git a/signal.c b/signal.c
index 3618e34..667da6a 100644
--- a/signal.c
+++ b/signal.c
@@ -27,7 +27,15 @@ static uint16_t last_signal_level = 0;
static void signal_update()
{
- uint16_t new_signal_level = tuner_get_signal();
+ uint16_t new_signal_level;
+#if WORKAROUND_BAD_WL1273_SIGNAL
+ /* rssi is a value from -128 to +127. */
+ new_signal_level = (tuner_get_signal() + 128) * 257;
+#else
+ /* rssi is a value from 0 to 65535. */
+ new_signal_level = tuner_get_signal();
+#endif
+
if (new_signal_level != last_signal_level) {
server_notify_signal(new_signal_level);
last_signal_level = new_signal_level;
diff --git a/tuner.c b/tuner.c
index 0f7b3f7..670ee8b 100644
--- a/tuner.c
+++ b/tuner.c
@@ -174,7 +174,7 @@ bool tuner_set_frequency(double mhz)
return false;
}
-uint16_t tuner_get_signal()
+int32_t tuner_get_signal()
{
struct v4l2_tuner t_tuner = {
.index = TUNER_DEVICE_ID