v1.19 Release

Dependencies:   nRF51822

Revision:
60:6327aa30a10e
Parent:
59:1dd53bfb012d
Child:
61:3ab0f16d2bfc
Child:
63:c321added5b1
--- a/Source/main.cpp	Mon Feb 01 18:05:29 2021 +0000
+++ b/Source/main.cpp	Wed Feb 24 16:03:57 2021 +0000
@@ -235,6 +235,18 @@
                 start_periodic_tick(FAST_TICK_SEC);
                 #if SKIP_SHIP_MODE
                     // package_open_sense_enable = 1;
+                    
+                    // (cap is on) before going to in-use, adapt the cap_on threshold (iff the cap is on)
+                    {
+                        adaptive_active = true;
+                        int i = 20; // multiple calls aallow it to adapt slowly to eliminate potencial noise.
+                        while(i--) 
+                        {
+                            test_cap();
+                        }
+                        adaptive_active = false;
+                    }
+                            
                     state = IN_USE_SETUP;
                 #else
                     state = POST;
@@ -400,7 +412,7 @@
                 break;
                 
             case IN_USE_SETUP:
-                //flash_led(3, .25);
+                flash_led(3, .25);
                 start_periodic_tick(PERIODIC_TICK_SEC);
                 debug("In Use\n"); 
                 if(NV_NOT_IN_USE) nv_clear(NV_NOT_IN_USE_ADDR);            
@@ -491,6 +503,9 @@
     } while(state != last_state);
 }
 
+const uint32_t tdoffset = 1604131200 + 4*3600; // - 0x00015180; // used so all records start at the same time/date (10/31/2020 8:00:00am - 1hr)
+
+ 
 void dataWasRead(void)
 {
     flash_led(1, 0.04);
@@ -629,7 +644,23 @@
                 }
             }
             break;
-                
+               
+        case 'n': // set RTC
+            {
+                int i = 1;
+                uint32_t num = 0;
+    
+                while(cmd[i]>='0' && cmd[i]<='9') {
+                    num = num*10 + cmd[i++]-'0';
+                }
+    
+                if(i>1) {
+                    set_rtc(num-tdoffset);
+                    BLE_UART_xmit("*RTC Set\n");
+                }
+            }
+            break;
+             
         case 'v': // version
             BLE_UART_xmit("v=");
             BLE_UART_xmit(FW_VERSION);