display2.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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. //(DO NOT change the following values unless you know what you do -> Integer division)
  17. typedef enum {
  18. refresh_fast = 5, // Display refresh rate in Hz when active
  19. refresh_std = 2 // Display refresh rate in Hz when not active
  20. } refreshRate_t;
  21. typedef enum {
  22. lang_de,
  23. lang_en,
  24. lang_last
  25. } display_lang_t;
  26. typedef enum {
  27. str_heating,
  28. str_heatingready,
  29. str_ready,
  30. str_brewing,
  31. str_cleaning,
  32. str_fullTank,
  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_singleEspresso,
  41. str_menu_stats,
  42. str_menu_stats2,
  43. str_menu_nextdesc,
  44. str_menu_temp,
  45. str_menu_clean,
  46. str_menu_reboot,
  47. str_menu_exit,
  48. str_menu_settings,
  49. str_menu_resetkwh,
  50. str_menu_resetkwh_val,
  51. str_menu_changepreinf,
  52. str_menu_changebrewtime,
  53. str_menu_changebrewml,
  54. str_menu_changesoaktime,
  55. str_menu_changeAutoReset,
  56. str_menu_leavesettings,
  57. str_postBrew,
  58. str_last
  59. } display_strings_t;
  60. typedef struct {
  61. char const * const text[lang_last];
  62. } display_string_t;
  63. static const display_string_t display_strings[str_last] =
  64. {
  65. { // heating
  66. {
  67. "Heizt auf",
  68. "Heating"
  69. }
  70. },
  71. { // heatingready
  72. {
  73. "Bereit (Heizt)",
  74. "Ready (Heating)"
  75. }
  76. },
  77. { // ready
  78. {
  79. "Bereit",
  80. "Ready"
  81. }
  82. },
  83. { // brewing
  84. {
  85. "Bezug..",
  86. "Brewing.."
  87. }
  88. },
  89. { // cleaning
  90. {
  91. "Reinigt..",
  92. "Cleaning.."
  93. }
  94. },
  95. { // full tank
  96. {
  97. "Abwasser leeren",
  98. "Graywater full"
  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 aus",
  140. "Turn off now"
  141. }
  142. },
  143. { // str_menu_singleEspresso
  144. {
  145. "einf. Espresso",
  146. "single espresso"
  147. }
  148. },
  149. { // str_menu_stats
  150. {
  151. "Stats",
  152. "Stats"
  153. }
  154. },
  155. { // str_menu_stats2
  156. {
  157. "Energieverbrauch",
  158. "Energy consumed"
  159. }
  160. },
  161. { // str_menu_nextdesc
  162. {
  163. "Reiningung in",
  164. "Descaling in"
  165. }
  166. },
  167. { // str_menu_temp
  168. {
  169. "Temperatur",
  170. "Temperature"
  171. }
  172. },
  173. { // str_menu_clean
  174. {
  175. "Reinigen",
  176. "Clean"
  177. }
  178. },
  179. { // str_menu_reboot
  180. {
  181. "Neustarten",
  182. "restart Pi"
  183. }
  184. },
  185. { // str_menu_exit
  186. {
  187. "Menü verlassen",
  188. "Leave menu"
  189. }
  190. },
  191. { // str_menu_settings
  192. {
  193. "Einstellungen",
  194. "Settings"
  195. }
  196. },
  197. { // str_menu_resetkwh
  198. {
  199. "Reset kWh Zähler",
  200. "Reset kWh"
  201. }
  202. },
  203. { // str_menu_resetkwh_val
  204. {
  205. "Zurücksetzen?",
  206. "Confirm to reset"
  207. }
  208. },
  209. { // str_change_preinf
  210. {
  211. "Vorbrühmenge",
  212. "Preinfusion"
  213. }
  214. },
  215. { // str_change_brewtime
  216. {
  217. "Extraktionszeit",
  218. "Brewing time"
  219. }
  220. },
  221. { // str_changebrewml
  222. {
  223. "Menge Espresso",
  224. "Amount Dbl Espr"
  225. }
  226. },
  227. { // str_changesoaktime
  228. {
  229. "Quellzeit",
  230. "Soak time"
  231. }
  232. },
  233. { // str_menu_changeAutoReset
  234. {
  235. "Auto reset anp",
  236. "Auto reset adj"
  237. }
  238. },
  239. { // str_leavesettings
  240. {
  241. "Verlassen",
  242. "Leave"
  243. }
  244. },
  245. { // str_postBrew
  246. {
  247. "Qualitaet:",
  248. "Quality:"
  249. }
  250. }
  251. };
  252. void *displayThread(void *threadid);
  253. void *displayTimerHandler(void *threadid);
  254. void displayInit(void);
  255. void displayPrintLn(int line, const char* str, bool centered);
  256. void displayPushState(coffee_status_t state);
  257. void displayRefresh(void);
  258. const char* displayGetString(display_strings_t string);
  259. void displaySetLang(display_lang_t lang);
  260. #endif /* DISPLAY_H_ */