display2.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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_menu_settings,
  53. str_menu_resetkwh,
  54. str_menu_changepreinf,
  55. str_menu_changebrewtime,
  56. str_menu_changebrewml,
  57. str_menu_changesoaktime,
  58. str_menu_leavesettings,
  59. str_postBrew,
  60. str_last
  61. } display_strings_t;
  62. typedef struct {
  63. char const * const text[lang_last];
  64. } display_string_t;
  65. static const display_string_t display_strings[str_last] =
  66. {
  67. { // heating
  68. {
  69. "Heizt auf",
  70. "Heating"
  71. }
  72. },
  73. { // heatingready
  74. {
  75. "Bereit (Heizt)",
  76. "Ready (Heating)"
  77. }
  78. },
  79. { // ready
  80. {
  81. "Bereit",
  82. "Ready"
  83. }
  84. },
  85. { // brewing
  86. {
  87. "Bezug..",
  88. "Brewing.."
  89. }
  90. },
  91. { // cleaning
  92. {
  93. "Reinigt..",
  94. "Cleaning.."
  95. }
  96. },
  97. { // error
  98. {
  99. "Fehler",
  100. "Error"
  101. }
  102. },
  103. { // flow
  104. {
  105. "Menge",
  106. "Flow"
  107. }
  108. },
  109. { // bye
  110. {
  111. "Auf wiedersehen",
  112. "Good bye"
  113. }
  114. },
  115. { // waitoff
  116. {
  117. "Ausschalten...",
  118. "Turning off..."
  119. }
  120. },
  121. { // str_menu
  122. {
  123. "CoffeePi Menü",
  124. "CoffeePi Menu"
  125. }
  126. },
  127. { // str_menu_softoff
  128. {
  129. "Ausschalten",
  130. "Turn off"
  131. }
  132. },
  133. { // str_menu_kill
  134. {
  135. "Sofort ausschalten",
  136. "Turn off now"
  137. }
  138. },
  139. { // str_menu_stats
  140. {
  141. "Stats",
  142. "Stats"
  143. }
  144. },
  145. { // str_menu_stats2
  146. {
  147. "Energieverbrauch",
  148. "Energy consumed"
  149. }
  150. },
  151. { // str_menu_nextdesc
  152. {
  153. "Reiningung in",
  154. "Descaling in"
  155. }
  156. },
  157. { // str_menu_temp
  158. {
  159. "Temperatur",
  160. "Temperature"
  161. }
  162. },
  163. { // str_menu_clean
  164. {
  165. "Reinigen",
  166. "Clean"
  167. }
  168. },
  169. { // str_menu_restart
  170. {
  171. "Neustarten",
  172. "restart software"
  173. }
  174. },
  175. { // str_menu_exit
  176. {
  177. "Menü verlassen",
  178. "Leave menu"
  179. }
  180. },
  181. { // str_menu_settings
  182. {
  183. "Einstellungen",
  184. "Settings"
  185. }
  186. },
  187. { // str_menu_resetkwh
  188. {
  189. "Reset kWh Zähler",
  190. "Reset kWh"
  191. }
  192. },
  193. { // str_change_preinf
  194. {
  195. "Vorbrühmenge",
  196. "Preinfusion"
  197. }
  198. },
  199. { // str_change_brewtime
  200. {
  201. "Extraktionszeit",
  202. "Brewing time"
  203. }
  204. },
  205. { // str_changebrewml
  206. {
  207. "Menge Espresso",
  208. "Amount Dbl Espr"
  209. }
  210. },
  211. { // str_changesoaktime
  212. {
  213. "Quellzeit",
  214. "Soak time"
  215. }
  216. },
  217. { // str_leavesettings
  218. {
  219. "Verlassen",
  220. "Leave"
  221. }
  222. },
  223. { // str_postBrew
  224. {
  225. "Qualitaet:",
  226. "Quality:"
  227. }
  228. }
  229. };
  230. const char* displayGetString(display_strings_t string);
  231. void displaySetLang(display_lang_t lang);
  232. #endif /* DISPLAY_H_ */