display2.h 4.2 KB

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