changeset 316:ec71c9658110

l1p_ctl.c: reconstruction complete, perfect match to original TCS211 object
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 04 Oct 2017 04:30:05 +0000
parents 27a933036b4f
children 3a2c43579200
files chipsetsw/layer1/p_cfile/l1p_ctl.c
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/p_cfile/l1p_ctl.c	Wed Oct 04 04:03:00 2017 +0000
+++ b/chipsetsw/layer1/p_cfile/l1p_ctl.c	Wed Oct 04 04:30:05 2017 +0000
@@ -1684,7 +1684,7 @@
 #endif
 
   if (0==pm)  // Check and filter illegal pm value by using last valid IL
-    current_IL = l1a_l1s_com.last_input_level[index].input_level;
+    current_IL = l1a_l1s_com.last_input_level[index].input_level - lna_value;
   else
     current_IL = -(pm - (used_agc - delta_drp_gain) + lna_value - l1ctl_get_g_magic(radio_freq));
 
@@ -1717,7 +1717,9 @@
                      &(l1a_l1s_com.last_input_level[index].lna_off),
                      radio_freq);
 
-    l1a_l1s_com.last_input_level[index].input_level = new_IL;
+    l1a_l1s_com.last_input_level[index].input_level = new_IL +
+      l1a_l1s_com.last_input_level[index].lna_off *
+        l1ctl_get_lna_att(radio_freq);
   }
 
   // if radio freq is a neighbor beacon
@@ -1729,7 +1731,9 @@
                      &(l1a_l1s_com.last_input_level[index].lna_off),
                      radio_freq);
 
-    l1a_l1s_com.last_input_level[index].input_level = (UWORD8)current_IL;
+    l1a_l1s_com.last_input_level[index].input_level = current_IL +
+      l1a_l1s_com.last_input_level[index].lna_off *
+        l1ctl_get_lna_att(radio_freq);
   }
 
   return((UWORD8)current_calibrated_IL);