display.h 2.6 KB

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