From bb7b8be95f415adc4d8e4932c3140866475b9e1c Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Tue, 17 Jan 2023 23:00:16 +0530
Subject: [PATCH] MIDI turned off and all related code guarded under a macro

---
 Makefile  | 4 ++--
 cw_menu.c | 2 ++
 radio.c   | 4 ++++
 rigctl.c  | 2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index c0d26a9..aeabce1 100644
--- a/Makefile
+++ b/Makefile
@@ -17,13 +17,13 @@ GIT_VERSION := $(shell git describe --abbrev=0 --tags --always)
 GPIO_INCLUDE=GPIO
 
 # uncomment if level control (power output) is software based
-# LEVEL_CTRL=SW_LEVEL_CTRL
+LEVEL_CTRL=SW_LEVEL_CTRL
 
 # uncomment the line below to include Pure Signal support
 #PURESIGNAL_INCLUDE=PURESIGNAL
 
 # uncomment the line below to include MIDI support
-MIDI_INCLUDE=MIDI
+# MIDI_INCLUDE=MIDI
 
 # uncomment the line below to include USB Ozy support
 # USBOZY_INCLUDE=USBOZY
diff --git a/cw_menu.c b/cw_menu.c
index 3cd5163..94effe7 100644
--- a/cw_menu.c
+++ b/cw_menu.c
@@ -48,8 +48,10 @@ void cw_changed() {
 // NewProtocol: rely on periodically sent HighPrio packets
 #ifdef LOCALCW
   keyer_update();
+#ifdef MIDI
   midi_keyer_update();
 #endif
+#endif
 //
 // speed and side tone frequency are displayed in the VFO bar
 //
diff --git a/radio.c b/radio.c
index 0287e98..26c9932 100644
--- a/radio.c
+++ b/radio.c
@@ -678,10 +678,12 @@ static void create_visual() {
     keyer_update();
   }
 
+#ifdef MIDI
   if (cw_keyer_midi == 1) {
       midi_keyer_update();
   }
 #endif
+#endif
 
 #ifdef CLIENT_SERVER
   if (!radio_is_remote) {
@@ -1880,8 +1882,10 @@ void radioRestoreState() {
     value = getProperty("cw_keyer_speed");
     if (value) {
       cw_keyer_speed = atoi(value);
+#ifdef MIDI
       // if we have the midikeyer, set the speed to this value
       midi_keyer_update();
+#endif
     }
     value = getProperty("cw_keyer_mode");
     if (value)
diff --git a/rigctl.c b/rigctl.c
index 6cef7d9..df87081 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -3154,7 +3154,9 @@ int parse_cmd(void *data) {
           cw_keyer_speed = speed;
 #ifdef LOCALCW
           keyer_update();
+#ifdef MIDI
 	  midi_keyer_update();
+#endif
 #endif
           vfo_update();
         }
-- 
2.45.2