display2.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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_demo,
  51. str_menu_exit,
  52. str_last
  53. } display_strings_t;
  54. typedef struct {
  55. char const * const text[lang_last];
  56. } display_string_t;
  57. static const display_string_t display_strings[str_last] =
  58. {
  59. { // heating
  60. {
  61. "Heizt auf",
  62. "Heating"
  63. }
  64. },
  65. { // heatingready
  66. {
  67. "Bereit (Heizt)",
  68. "Ready (Heating)"
  69. }
  70. },
  71. { // ready
  72. {
  73. "Bereit",
  74. "Ready"
  75. }
  76. },
  77. { // brewing
  78. {
  79. "Bezug..",
  80. "Brewing.."
  81. }
  82. },
  83. { // cleaning
  84. {
  85. "Reinigt..",
  86. "Cleaning.."
  87. }
  88. },
  89. { // error
  90. {
  91. "Fehler",
  92. "Error"
  93. }
  94. },
  95. { // flow
  96. {
  97. "Menge",
  98. "Flow"
  99. }
  100. },
  101. { // bye
  102. {
  103. "Auf wiedersehen",
  104. "Good bye"
  105. }
  106. },
  107. { // waitoff
  108. {
  109. "Ausschalten...",
  110. "Turning off..."
  111. }
  112. },
  113. { // str_menu
  114. {
  115. "CoffeePi Menü",
  116. "CoffeePi Menu"
  117. }
  118. },
  119. { // str_menu_softoff
  120. {
  121. "Ausschalten",
  122. "Turn off"
  123. }
  124. },
  125. { // str_menu_kill
  126. {
  127. "Sofort ausschalten",
  128. "Turn off now"
  129. }
  130. },
  131. { // str_menu_stats
  132. {
  133. "Stats",
  134. "Stats"
  135. }
  136. },{ // str_menu_stats2
  137. {
  138. "Energieverbrauch",
  139. "Energy consumed"
  140. }
  141. },
  142. { // str_menu_nextdesc
  143. {
  144. "Reiningung in",
  145. "Descaling in"
  146. }
  147. },
  148. { // str_menu_temp
  149. {
  150. "Temperatur",
  151. "Temperature"
  152. }
  153. },
  154. { // str_menu_clean
  155. {
  156. "Reinigen",
  157. "Clean"
  158. }
  159. },
  160. { // str_menu_demo
  161. {
  162. "Demo",
  163. "Demo"
  164. }
  165. },
  166. { // str_menu_exit
  167. {
  168. "Menü verlassen",
  169. "Leave menu"
  170. }
  171. }
  172. };
  173. const char* displayGetString(display_strings_t string);
  174. void displaySetLang(display_lang_t lang);
  175. #endif /* DISPLAY_H_ */