From 6e6b0c7b8808f9a48a2c4b9503b3d45163674e33 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
Date: Sat, 1 Oct 2016 06:08:33 -0400
Subject: [PATCH] Updated write_setting method to be functional again. Fixed
 some constants int he KISS module.

---
 lib/kiss/constants.rb |  6 +++---
 lib/kiss/kiss.rb      | 15 +++++++--------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/lib/kiss/constants.rb b/lib/kiss/constants.rb
index 8298059..2ebcfcb 100644
--- a/lib/kiss/constants.rb
+++ b/lib/kiss/constants.rb
@@ -7,10 +7,10 @@ module KISS
     TFESC = 0xDD
 
     # "FEND is sent as FESC, TFEND"
-    FESC_TFEND = [KISS::FESC] + [KISS::TFEND]
+    FESC_TFEND = [FESC] + [TFEND]
 
     # "FESC is sent as FESC, TFESC"
-    FESC_TFESC = [KISS::FESC] + [KISS::TFESC]
+    FESC_TFESC = [FESC] + [TFESC]
 
     # KISS Command Codes
     # http://en.wikipedia.org/wiki/KISS_(TNC)#Command_Codes
@@ -36,7 +36,7 @@ module KISS
 
     # This will start kiss on a WA8DED or LINK>.<NORD firmware
     MODE_INIT_W8DED = [13, 27, 64, 75, 13]
-    MODE_INIT_LINKNORD = KISS::MODE_INIT_W8DED
+    MODE_INIT_LINKNORD = MODE_INIT_W8DED
 
     # Kenwood D710
     MODE_INIT_KENWOOD_D710 = [72, 66, 32, 49, 50, 48, 48, 13, # HB 1200
diff --git a/lib/kiss/kiss.rb b/lib/kiss/kiss.rb
index e9bfbbc..5528c1d 100644
--- a/lib/kiss/kiss.rb
+++ b/lib/kiss/kiss.rb
@@ -54,14 +54,13 @@ module KISS
         end
 
         protected
-        def write_setting(name, value)
-            # TODO: Implement this
-            # return self.write_interface(
-            #         KISS::FEND +
-            #         getattr(kiss_constants, name.upper()) +
-            #         Kiss.__escape_special_codes(value) +
-            #         kiss_constants.FEND
-            # )
+        def write_setting(command, value)
+            return self.write_interface(
+                [FEND] +
+                [command] +
+                escape_special_codes(value) +
+                [FEND]
+            )
         end
 
         private
-- 
GitLab