display2.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. * display.h
  3. *
  4. * Created on: Sep 26, 2017
  5. * Author: Philipp Hinz
  6. */
  7. #ifndef DISPLAY2_H_
  8. #define DISPLAY2_H_
  9. #include <string>
  10. #include "coffee.h"
  11. #define DEFAULT_LANG lang_en // Default display language
  12. #define REFRESH_FAST 5
  13. #define REFRESH_STD 2
  14. #define DISPLAY_ROWS 2
  15. #define DISPLAY_COLS 16
  16. void *displayThread(void *threadid);
  17. void *displayTimerHandler(void *threadid);
  18. void displayInit(void);
  19. void displayPrintLn(int line, const char* str, bool centered);
  20. void displayPushState(coffee_status_t state);
  21. void displayRefresh(void);
  22. //(DO NOT change the following values unless you know what you do -> Integer division)
  23. typedef enum {
  24. refresh_fast = 5, // Display refresh rate in Hz when active
  25. refresh_std = 2 // Display refresh rate in Hz when not active
  26. } refreshRate_t;
  27. typedef enum {
  28. lang_de,
  29. lang_en,
  30. lang_last
  31. } display_lang_t;
  32. typedef enum {
  33. str_heating,
  34. str_heatingready,
  35. str_ready,
  36. str_brewing,
  37. str_cleaning,
  38. str_error,
  39. str_flow,
  40. str_bye,
  41. str_waitoff,
  42. str_menu,
  43. str_menu_softoff,
  44. str_menu_kill,
  45. str_menu_stats,
  46. str_menu_stats2,
  47. str_menu_nextdesc,
  48. str_menu_temp,
  49. str_menu_clean,
  50. str_menu_restart,
  51. str_menu_exit,
  52. str_postBrew,
  53. str_last
  54. } display_strings_t;
  55. typedef struct {
  56. char const * const text[lang_last];
  57. } display_string_t;
  58. static const display_string_t display_strings[str_last] =
  59. {
  60. { // heating
  61. {
  62. "Heizt auf",
  63. "Heating"
  64. }
  65. },
  66. { // heatingready
  67. {
  68. "Bereit (Heizt)",
  69. "Ready (Heating)"
  70. }
  71. },
  72. { // ready
  73. {
  74. "Bereit",
  75. "Ready"
  76. }
  77. },
  78. { // brewing
  79. {
  80. "Bezug..",
  81. "Brewing.."
  82. }
  83. },
  84. { // cleaning
  85. {
  86. "Reinigt..",
  87. "Cleaning.."
  88. }
  89. },
  90. { // error
  91. {
  92. "Fehler",
  93. "Error"
  94. }
  95. },
  96. { // flow
  97. {
  98. "Menge",
  99. "Flow"
  100. }
  101. },
  102. { // bye
  103. {
  104. "Auf wiedersehen",
  105. "Good bye"
  106. }
  107. },
  108. { // waitoff
  109. {
  110. "Ausschalten...",
  111. "Turning off..."
  112. }
  113. },
  114. { // str_menu
  115. {
  116. "CoffeePi Menü",
  117. "CoffeePi Menu"
  118. }
  119. },
  120. { // str_menu_softoff
  121. {
  122. "Ausschalten",
  123. "Turn off"
  124. }
  125. },
  126. { // str_menu_kill
  127. {
  128. "Sofort ausschalten",
  129. "Turn off now"
  130. }
  131. },
  132. { // str_menu_stats
  133. {
  134. "Stats",
  135. "Stats"
  136. }
  137. },{ // str_menu_stats2
  138. {
  139. "Energieverbrauch",
  140. "Energy consumed"
  141. }
  142. },
  143. { // str_menu_nextdesc
  144. {
  145. "Reiningung in",
  146. "Descaling in"
  147. }
  148. },
  149. { // str_menu_temp
  150. {
  151. "Temperatur",
  152. "Temperature"
  153. }
  154. },
  155. { // str_menu_clean
  156. {
  157. "Reinigen",
  158. "Clean"
  159. }
  160. },
  161. { // str_menu_restart
  162. {
  163. "Neustarten",
  164. "restart software"
  165. }
  166. },
  167. { // str_menu_exit
  168. {
  169. "Menü verlassen",
  170. "Leave menu"
  171. }
  172. },
  173. { // str_postBrew
  174. {
  175. "Qualitaet:",
  176. "Quality:"
  177. }
  178. }
  179. };
  180. const char* displayGetString(display_strings_t string);
  181. void displaySetLang(display_lang_t lang);
  182. #endif /* DISPLAY_H_ */