Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Stuff
Tuesday, October 9th, 2007 at 10:17:03am UTC 

  1. Index: apps/lang/english.lang
  2. ===================================================================
  3. --- apps/lang/english.lang      (revision 15044)
  4. +++ apps/lang/english.lang      (working copy)
  5. @@ -11389,3 +11389,33 @@
  6.      lcd_color: "Line Selector Colours"
  7.    </voice>
  8.  </phrase>
  9. +<phrase>
  10. +  id: LANG_CHARGER_REMOVED
  11. +  desc: Tell  the user when the charger is disconnected.
  12. +Only for voice
  13. +  user:
  14. +  <source>
  15. +    *: "Charger removed"
  16. +  </source>
  17. +  <dest>
  18. +    *: "Charger removed"
  19. +      </dest>
  20. +  <voice>
  21. +    *: "Charger removed"
  22. +  </voice>
  23. +</phrase>
  24. +<phrase>
  25. +  id: LANG_CHARGER_INSERTED
  26. +  desc: Tell  the user when the charger is connected.
  27. +Only for voice
  28. +  user:
  29. +  <source>
  30. +    *: "Charger inserted"
  31. +  </source>
  32. +  <dest>
  33. +    *: "Charger inserted"
  34. +      </dest>
  35. +  <voice>
  36. +    *: "Charger inserted"
  37. +  </voice>
  38. +</phrase>
  39. Index: apps/misc.c
  40. ===================================================================
  41. --- apps/misc.c (revision 15044)
  42. +++ apps/misc.c (working copy)
  43. @@ -857,6 +857,13 @@
  44.  {
  45.      switch(event)
  46.      {
  47. +        case SYS_BATTERY_UPDATE:
  48. +            if(talk_menus_enabled ())
  49. +            {
  50. +                talk_id(LANG_BATTERY_TIME, true);
  51. +                talk_value(battery_level(), UNIT_PERCENT, true);
  52. +            }
  53. +            break;
  54.          case SYS_USB_CONNECTED:
  55.              if (callback != NULL)
  56.                  callback(parameter);
  57. @@ -888,10 +895,14 @@
  58.  #if CONFIG_CHARGING
  59.          case SYS_CHARGER_CONNECTED:
  60.              car_adapter_mode_processing(true);
  61. +            if(talk_menus_enabled ())
  62. +                talk_id(LANG_CHARGER_INSERTED, true);
  63.              return SYS_CHARGER_CONNECTED;
  64.              
  65.          case SYS_CHARGER_DISCONNECTED:
  66.              car_adapter_mode_processing(false);
  67. +            if(talk_menus_enabled ())
  68. +                talk_id(LANG_CHARGER_REMOVED, true);
  69.              return SYS_CHARGER_DISCONNECTED;
  70.  
  71.          case SYS_CAR_ADAPTER_RESUME:
  72. Index: firmware/export/kernel.h
  73. ===================================================================
  74. --- firmware/export/kernel.h    (revision 15044)
  75. +++ firmware/export/kernel.h    (working copy)
  76. @@ -62,6 +62,7 @@
  77.  #define SYS_POWEROFF              MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 0)
  78.  #define SYS_CHARGER_CONNECTED     MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 1)
  79.  #define SYS_CHARGER_DISCONNECTED  MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 2)
  80. +#define SYS_BATTERY_UPDATE        MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 3)
  81.  #define SYS_FS_CHANGED            MAKE_SYS_EVENT(SYS_EVENT_CLS_FILESYS, 0)
  82.  #define SYS_HOTSWAP_INSERTED      MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 0)
  83.  #define SYS_HOTSWAP_EXTRACTED     MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 1)
  84. Index: firmware/export/powermgmt.h
  85. ===================================================================
  86. --- firmware/export/powermgmt.h (revision 15044)
  87. +++ firmware/export/powermgmt.h (working copy)
  88. @@ -174,5 +174,4 @@
  89.  void cancel_shutdown(void);
  90.  void shutdown_hw(void);
  91.  void sys_poweroff(void);
  92. -
  93.  #endif
  94. Index: firmware/powermgmt.c
  95. ===================================================================
  96. --- firmware/powermgmt.c        (revision 15044)
  97. +++ firmware/powermgmt.c        (working copy)
  98. @@ -74,11 +74,11 @@
  99.  #else
  100.  #define DEBUG_STACK 0
  101.  #endif
  102. -
  103.  static int shutdown_timeout = 0;
  104.  #if CONFIG_CHARGING >= CHARGING_MONITOR
  105.  charge_state_type charge_state;     /* charging mode */
  106.  #endif
  107. +static int last_sent_level = 100;
  108.  
  109.  #if CONFIG_CHARGING
  110.  charger_input_state_type charger_input_state IDATA_ATTR;
  111. @@ -95,6 +95,8 @@
  112.  static int batt_time = BATT_MAXRUNTIME; /* estimated remaining time in minutes */
  113.  static time_t last_change = 0;
  114.  
  115. +void send_level(void);
  116. +
  117.  static void battery_status_update(void)
  118.  {
  119.      time_t          now;
  120. @@ -111,6 +113,7 @@
  121.          batt_level = 100 * (batt_millivolts - BATT_MINMVOLT) / (BATT_MAXMVOLT - BATT_MINMVOLT);
  122.          batt_time = batt_level * BATT_MAXRUNTIME / 100;
  123.      }
  124. +    send_level();
  125.  }
  126.  
  127.  void battery_read_info(int *voltage, int *level)
  128. @@ -459,6 +462,7 @@
  129.      }
  130.  
  131.      battery_percent = level;
  132. +    send_level();
  133.  }
  134.  
  135.  /*
  136. @@ -638,6 +642,7 @@
  137.                      return;
  138.                  case CHARGER_PLUGGED:
  139.                      queue_broadcast(SYS_CHARGER_CONNECTED, 0);
  140. +                    last_sent_level = 0;
  141.                      charger_input_state = CHARGER;
  142.                      break;
  143.                  case CHARGER:
  144. @@ -649,6 +654,7 @@
  145.                      break;
  146.                  case CHARGER_UNPLUGGED:
  147.                      queue_broadcast(SYS_CHARGER_DISCONNECTED, 0);
  148. +                    last_sent_level = 100;
  149.                      charger_input_state = NO_CHARGER;
  150.                      break;
  151.                  case CHARGER_PLUGGED:
  152. @@ -1192,3 +1198,23 @@
  153.      power_off();
  154.  #endif /* #ifndef SIMULATOR */
  155.  }
  156. +
  157. +/*Returns the battery level on certain levels.*/
  158. +void send_level(void)
  159. +{
  160. +    if (batt_level <= 5 && last_sent_level > 5)
  161. +    {
  162. +        last_sent_level = 5;
  163. +        queue_broadcast(SYS_BATTERY_UPDATE, batt_level);
  164. +    }
  165. +    if (batt_level <= 20 && last_sent_level > 20)
  166. +    {
  167. +        last_sent_level = 20;
  168. +        queue_broadcast(SYS_BATTERY_UPDATE, batt_level);
  169. +    }
  170. +    if (batt_level <= 50 && last_sent_level > 50)
  171. +    {
  172. +        last_sent_level = 50;
  173. +        queue_broadcast(SYS_BATTERY_UPDATE, batt_level);
  174. +    }
  175. +}

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right