changeset 292:0f688d07b068

block deep sleep on activity in new PWT and vibrator drivers
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Mar 2022 00:29:19 +0000
parents a72feaed133a
children 2d7d95e7f9c2
files src/cs/layer1/cfile/l1_trace.c src/cs/layer1/cust0/l1_cust.c src/cs/layer1/include/l1_trace.h
diffstat 3 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/layer1/cfile/l1_trace.c	Sat Mar 26 19:31:18 2022 +0000
+++ b/src/cs/layer1/cfile/l1_trace.c	Sun Mar 27 00:29:19 2022 +0000
@@ -1606,7 +1606,7 @@
             else
             // big sleep
             {
-              char *array_string[]={"undefined","light on","uart","sim","gauging","sleep mode","DSP","BT","charging"};
+              char *array_string[]={"undefined","light on","uart","sim","gauging","sleep mode","DSP","BT","charging","buzzer","vibrator"};
               sprintf (str,"      big sleep: %ld %ld %d %d (cause:%s) %s\n\r",
                        ((T_TRACE_INFO *)(msg->SigP))->tab[0],
                        ((T_TRACE_INFO *)(msg->SigP))->tab[1],
@@ -8059,7 +8059,7 @@
          else
          // big sleep
          {
-           char *array_string[]={"undefined","light on","uart","sim","gauging","sleep mode","DSP","BT","charging"};
+           char *array_string[]={"undefined","light on","uart","sim","gauging","sleep mode","DSP","BT","charging","buzzer","vibrator"};
            sprintf (str,"      big sleep: %ld %ld %d %d (cause:%s) %s\n\r",
                     start_fn,
                     end_fn,
--- a/src/cs/layer1/cust0/l1_cust.c	Sat Mar 26 19:31:18 2022 +0000
+++ b/src/cs/layer1/cust0/l1_cust.c	Sun Mar 27 00:29:19 2022 +0000
@@ -255,6 +255,7 @@
   extern T_PWR_CTRL_BLOCK *pwr_ctrl;
 #endif
   extern SYS_BOOL uart_sleep_timer_enabled;
+  extern SYS_BOOL PWT_tone_is_on, HW_vibrator_is_on;
   extern unsigned char iota_ledb_status;
 
 #if (CODE_VERSION != SIMULATION)
@@ -279,6 +280,20 @@
       return(FRAME_STOP);  // BIG sleep
     }
 
+    // Forbid deep sleep if the buzzer is on
+    if (PWT_tone_is_on)
+    {
+      why_big_sleep = BIG_SLEEP_DUE_TO_BUZZER;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
+    // Forbid deep sleep if the vibrator is on
+    if (HW_vibrator_is_on)
+    {
+      why_big_sleep = BIG_SLEEP_DUE_TO_VIBRATOR;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
     // Forbid deep sleep if the SIM and UARTs not ready
     if (!SIM_SleepStatus())
     {
--- a/src/cs/layer1/include/l1_trace.h	Sat Mar 26 19:31:18 2022 +0000
+++ b/src/cs/layer1/include/l1_trace.h	Sun Mar 27 00:29:19 2022 +0000
@@ -100,6 +100,8 @@
   #define BIG_SLEEP_DUE_TO_DSP_TRACES 6  // deep sleep is forbiden by the DSP
   #define BIG_SLEEP_DUE_TO_BLUETOOTH  7  // deep sleep is forbiden by the Bluetooth module
   #define BIG_SLEEP_DUE_TO_CHARGING   8  // deep sleep is forbiden by battery charging
+  #define BIG_SLEEP_DUE_TO_BUZZER     9  // deep sleep is forbiden by buzzer activity
+  #define BIG_SLEEP_DUE_TO_VIBRATOR  10  // deep sleep is forbiden by vibrator activity
 
   void  Trace_Packet_Transfer      (UWORD8  prev_crc_error); // Previous RX blocks CRC_ERROR summary
   void  l1_display_buffer_trace_fct(void);
@@ -5671,6 +5673,8 @@
 #define BIG_SLEEP_DUE_TO_DSP_TRACES 6  // deep sleep is forbiden by the DSP
 #define BIG_SLEEP_DUE_TO_BLUETOOTH  7  // deep sleep is forbiden by the Bluetooth module
 #define BIG_SLEEP_DUE_TO_CHARGING   8  // deep sleep is forbiden by battery charging
+#define BIG_SLEEP_DUE_TO_BUZZER     9  // deep sleep is forbiden by buzzer activity
+#define BIG_SLEEP_DUE_TO_VIBRATOR  10  // deep sleep is forbiden by vibrator activity
 
 /***********************************************************************************************************/
 /* Begin header