display2.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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_RATE 5 /**< Display refresh rate in Hz when active */
  13. #define DISPLAY_ROWS 2
  14. #define DISPLAY_COLS 16
  15. #define MAX_PAGENAME 20
  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. typedef enum {
  23. lang_de,
  24. lang_en,
  25. lang_last
  26. } display_lang_t;
  27. typedef enum {
  28. str_heating,
  29. str_heatingready,
  30. str_ready,
  31. str_brewing,
  32. str_cleaning,
  33. str_error,
  34. str_flow,
  35. str_bye,
  36. str_waitoff,
  37. str_menu,
  38. str_menu_softoff,
  39. str_menu_kill,
  40. str_menu_stats,
  41. str_menu_stats2,
  42. str_menu_nextdesc,
  43. str_menu_temp,
  44. str_menu_clean,
  45. str_menu_demo,
  46. str_menu_exit,
  47. str_last
  48. } display_strings_t;
  49. typedef struct {
  50. const char * const pagename[MAX_PAGENAME];
  51. void (*ContentFunction)(void);
  52. uint16_t refreshrate;
  53. uint16_t timeToDisplay;
  54. uint16_t displayTime;
  55. }display2_page_t;
  56. static const display2_page_t pages[] =
  57. {
  58. {
  59. {"demopage"},
  60. displayInit,
  61. 10,
  62. 19,
  63. 10
  64. }
  65. };
  66. typedef struct {
  67. char const * const text[lang_last];
  68. } display_string_t;
  69. static const display_string_t display_strings[str_last] =
  70. {
  71. { // heating
  72. {
  73. "Heizt auf",
  74. "Heating"
  75. }
  76. },
  77. { // heatingready
  78. {
  79. "Bereit (Heizt)",
  80. "Ready (Heating)"
  81. }
  82. },
  83. { // ready
  84. {
  85. "Bereit",
  86. "Ready"
  87. }
  88. },
  89. { // brewing
  90. {
  91. "Bezug..",
  92. "Brewing.."
  93. }
  94. },
  95. { // cleaning
  96. {
  97. "Reinigt..",
  98. "Cleaning.."
  99. }
  100. },
  101. { // error
  102. {
  103. "Fehler",
  104. "Error"
  105. }
  106. },
  107. { // flow
  108. {
  109. "Menge",
  110. "Flow"
  111. }
  112. },
  113. { // bye
  114. {
  115. "Auf wiedersehen",
  116. "Good bye"
  117. }
  118. },
  119. { // waitoff
  120. {
  121. "Ausschalten...",
  122. "Turning off..."
  123. }
  124. },
  125. { // str_menu
  126. {
  127. "CoffeePi Menü",
  128. "CoffeePi Menu"
  129. }
  130. },
  131. { // str_menu_softoff
  132. {
  133. "Ausschalten",
  134. "Turn off"
  135. }
  136. },
  137. { // str_menu_kill
  138. {
  139. "Sofort ausschalten",
  140. "Turn off now"
  141. }
  142. },
  143. { // str_menu_stats
  144. {
  145. "Stats",
  146. "Stats"
  147. }
  148. },{ // str_menu_stats2
  149. {
  150. "Energieverbrauch",
  151. "Energy consumed"
  152. }
  153. },
  154. { // str_menu_nextdesc
  155. {
  156. "Reiningung in",
  157. "Descaling in"
  158. }
  159. },
  160. { // str_menu_temp
  161. {
  162. "Temperatur",
  163. "Temperature"
  164. }
  165. },
  166. { // str_menu_clean
  167. {
  168. "Reinigen",
  169. "Clean"
  170. }
  171. },
  172. { // str_menu_demo
  173. {
  174. "Demo",
  175. "Demo"
  176. }
  177. },
  178. { // str_menu_exit
  179. {
  180. "Menü verlassen",
  181. "Leave menu"
  182. }
  183. }
  184. };
  185. const char* displayGetString(display_strings_t string);
  186. void displaySetLang(display_lang_t lang);
  187. #endif /* DISPLAY_H_ */