From 4de090538fbb8394b2aadaf0051d40092e8a62f1 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Tue, 14 Nov 2023 22:21:04 +0530
Subject: [PATCH] remove magic numbers from NB/NR rendering

---
 screen.h |  8 ++++++++
 vfo.c    | 22 +++++++++++-----------
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/screen.h b/screen.h
index c07c84f..98fa944 100644
--- a/screen.h
+++ b/screen.h
@@ -58,6 +58,8 @@
 #define  PS_RENDER_FONT_SIZE        (12)
 #define  RIT_RENDER_FONT_SIZE       (16)
 #define  XIT_RENDER_FONT_SIZE       (16)
+#define  NB_RENDER_FONT_SIZE        (16)
+#define  NR_RENDER_FONT_SIZE        (16)
 
 // coordinates
 
@@ -82,4 +84,10 @@
 #define  XIT_X      220
 #define  XIT_Y      20
 
+#define  NB_X       115
+#define  NB_Y       40
+
+#define  NR_X       70
+#define  NR_Y       40
+
 #endif // _SCREEN_H
diff --git a/vfo.c b/vfo.c
index ee625a0..0577451 100644
--- a/vfo.c
+++ b/vfo.c
@@ -1210,35 +1210,35 @@ void vfo_update(void) {
         // NB and NB2 are mutually exclusive, therefore
         // they are put to the same place in order to save
         // some space
-        cairo_move_to(cr, 115, 40);
-        cairo_set_font_size(cr, 16);
+        cairo_move_to(cr, NB_X, NB_Y);
+        cairo_set_font_size(cr, NB_RENDER_FONT_SIZE);
         if (active_receiver->nb) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "NB");
         } else if (active_receiver->nb2) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "NB2");
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
             cairo_show_text(cr, "NB");
         }
 
         // NR, NR2, NR3 and NR4 are mutually exclusive
-        cairo_move_to(cr, 70, 40);
+        cairo_move_to(cr, NR_X, NR_Y);
         if (active_receiver->nr) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "NR");
         } else if (active_receiver->nr2) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "NR2");
         } else if (active_receiver->nr3) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "NR3");
         } else if (active_receiver->nr4) {
-            cairo_set_source_rgb(cr, 1.0, 1.0, 0.0);
+            cairo_set_source_rgb(cr, YELLOW_R, YELLOW_G, YELLOW_B);
             cairo_show_text(cr, "NR4");
         } else {
-            cairo_set_source_rgb(cr, 0.7, 0.7, 0.7);
+            cairo_set_source_rgb(cr, GREY_R, GREY_G, GREY_B);
             cairo_show_text(cr, "NR");
         }
 
-- 
2.45.2