My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dogm_lcd_implementation.h 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. /**
  2. * dogm_lcd_implementation.h
  3. *
  4. * Graphics LCD implementation for 128x64 pixel LCDs by STB for ErikZalm/Marlin
  5. * Demonstrator: http://www.reprap.org/wiki/STB_Electronics
  6. * License: http://opensource.org/licenses/BSD-3-Clause
  7. *
  8. * With the use of:
  9. * u8glib by Oliver Kraus
  10. * http://code.google.com/p/u8glib/
  11. * License: http://opensource.org/licenses/BSD-3-Clause
  12. */
  13. #ifndef DOGM_LCD_IMPLEMENTATION_H
  14. #define DOGM_LCD_IMPLEMENTATION_H
  15. #define MARLIN_VERSION "1.0.2"
  16. /**
  17. * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
  18. **/
  19. #ifdef ULTIPANEL
  20. #define BLEN_A 0
  21. #define BLEN_B 1
  22. #define BLEN_C 2
  23. #define EN_A (1<<BLEN_A)
  24. #define EN_B (1<<BLEN_B)
  25. #define EN_C (1<<BLEN_C)
  26. #define encrot0 0
  27. #define encrot1 2
  28. #define encrot2 3
  29. #define encrot3 1
  30. #define LCD_CLICKED (buttons&EN_C)
  31. #endif
  32. #include <U8glib.h>
  33. #include "DOGMbitmaps.h"
  34. #include "dogm_font_data_marlin.h"
  35. #include "ultralcd.h"
  36. #include "ultralcd_st7920_u8glib_rrd.h"
  37. /* Russian language not supported yet, needs custom font
  38. #ifdef LANGUAGE_RU
  39. #include "LiquidCrystalRus.h"
  40. #define LCD_CLASS LiquidCrystalRus
  41. #else
  42. #include <LiquidCrystal.h>
  43. #define LCD_CLASS LiquidCrystal
  44. #endif
  45. */
  46. // DOGM parameters (size in pixels)
  47. #define DOG_CHAR_WIDTH 6
  48. #define DOG_CHAR_HEIGHT 12
  49. #define DOG_CHAR_WIDTH_LARGE 9
  50. #define DOG_CHAR_HEIGHT_LARGE 18
  51. #define START_ROW 0
  52. /* Custom characters defined in font font_6x10_marlin.c */
  53. #define LCD_STR_DEGREE "\xB0"
  54. #define LCD_STR_REFRESH "\xF8"
  55. #define LCD_STR_FOLDER "\xF9"
  56. #define LCD_STR_ARROW_RIGHT "\xFA"
  57. #define LCD_STR_UPLEVEL "\xFB"
  58. #define LCD_STR_CLOCK "\xFC"
  59. #define LCD_STR_FEEDRATE "\xFD"
  60. #define LCD_STR_BEDTEMP "\xFE"
  61. #define LCD_STR_THERMOMETER "\xFF"
  62. #define FONT_STATUSMENU u8g_font_6x9
  63. int lcd_contrast;
  64. // LCD selection
  65. #ifdef U8GLIB_ST7920
  66. //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
  67. U8GLIB_ST7920_128X64_RRD u8g(0);
  68. #elif defined(MAKRPANEL)
  69. // The MaKrPanel display, ST7565 controller as well
  70. U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
  71. #else
  72. // for regular DOGM128 display with HW-SPI
  73. U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
  74. #endif
  75. static void lcd_implementation_init()
  76. {
  77. #ifdef LCD_PIN_BL // Enable LCD backlight
  78. pinMode(LCD_PIN_BL, OUTPUT);
  79. digitalWrite(LCD_PIN_BL, HIGH);
  80. #endif
  81. u8g.setContrast(lcd_contrast);
  82. // FIXME: remove this workaround
  83. // Uncomment this if you have the first generation (V1.10) of STBs board
  84. // pinMode(17, OUTPUT); // Enable LCD backlight
  85. // digitalWrite(17, HIGH);
  86. #ifdef LCD_SCREEN_ROT_90
  87. u8g.setRot90(); // Rotate screen by 90°
  88. #elif defined(LCD_SCREEN_ROT_180)
  89. u8g.setRot180(); // Rotate screen by 180°
  90. #elif defined(LCD_SCREEN_ROT_270)
  91. u8g.setRot270(); // Rotate screen by 270°
  92. #endif
  93. // FIXME: whats the purpose of the box? Maybe clear screen?
  94. u8g.firstPage();
  95. do {
  96. u8g.setFont(u8g_font_6x10_marlin);
  97. u8g.setColorIndex(1);
  98. u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
  99. u8g.setColorIndex(1);
  100. } while(u8g.nextPage());
  101. // Show splashscreen
  102. int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
  103. int offy = (u8g.getHeight() - 18 - START_BMPHEIGHT) / 2;
  104. int txtX = (u8g.getWidth() - (sizeof(STRING_SPLASH) - 1)*5) / 2; // 5 is fontwidth in pixel
  105. int txtY = u8g.getHeight() - 10;
  106. u8g.firstPage();
  107. do {
  108. u8g.drawBitmapP(offx, offy, START_BMPBYTEWIDTH, START_BMPHEIGHT, start_bmp);
  109. u8g.setFont(u8g_font_5x8);
  110. u8g.drawStr(txtX, txtY, STRING_SPLASH);
  111. } while(u8g.nextPage());
  112. }
  113. static void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
  114. /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
  115. static void lcd_printPGM(const char* str) {
  116. char c;
  117. while ((c = pgm_read_byte(str++))) u8g.print(c);
  118. }
  119. static void _draw_heater_status(int x, int heater) {
  120. bool isBed = heater < 0;
  121. int y = 17 + (isBed ? 1 : 0);
  122. u8g.setFont(FONT_STATUSMENU);
  123. u8g.setPrintPos(x,6);
  124. u8g.print(itostr3(int((heater >= 0 ? degTargetHotend(heater) : degTargetBed()) + 0.5)));
  125. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  126. u8g.setPrintPos(x,27);
  127. u8g.print(itostr3(int(heater >= 0 ? degHotend(heater) : degBed()) + 0.5));
  128. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  129. if (!isHeatingHotend(0)) {
  130. u8g.drawBox(x+7,y,2,2);
  131. }
  132. else {
  133. u8g.setColorIndex(0); // white on black
  134. u8g.drawBox(x+7,y,2,2);
  135. u8g.setColorIndex(1); // black on white
  136. }
  137. }
  138. static void lcd_implementation_status_screen() {
  139. static unsigned char fan_rot = 0;
  140. u8g.setColorIndex(1); // black on white
  141. // Symbols menu graphics, animated fan
  142. u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
  143. #ifdef SDSUPPORT
  144. // SD Card Symbol
  145. u8g.drawBox(42,42,8,7);
  146. u8g.drawBox(50,44,2,5);
  147. u8g.drawFrame(42,49,10,4);
  148. u8g.drawPixel(50,43);
  149. // Progress bar frame
  150. u8g.drawFrame(54,49,73,4);
  151. // SD Card Progress bar and clock
  152. u8g.setFont(FONT_STATUSMENU);
  153. if (IS_SD_PRINTING) {
  154. // Progress bar solid part
  155. u8g.drawBox(55, 50, (unsigned int)(71.f * card.percentDone() / 100.f), 2);
  156. }
  157. u8g.setPrintPos(80,47);
  158. if (starttime != 0) {
  159. uint16_t time = millis()/60000 - starttime/60000;
  160. u8g.print(itostr2(time/60));
  161. u8g.print(':');
  162. u8g.print(itostr2(time%60));
  163. }
  164. else {
  165. lcd_printPGM(PSTR("--:--"));
  166. }
  167. #endif
  168. // Extruders
  169. _draw_heater_status(6, 0);
  170. #if EXTRUDERS > 1
  171. _draw_heater_status(31, 1);
  172. #if EXTRUDERS > 2
  173. _draw_heater_status(55, 2);
  174. #endif
  175. #endif
  176. // Heatbed
  177. _draw_heater_status(81, -1);
  178. // Fan
  179. u8g.setFont(FONT_STATUSMENU);
  180. u8g.setPrintPos(104,27);
  181. #if defined(FAN_PIN) && FAN_PIN > -1
  182. u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
  183. u8g.print("%");
  184. #else
  185. u8g.print("---");
  186. #endif
  187. // X, Y, Z-Coordinates
  188. u8g.setFont(FONT_STATUSMENU);
  189. u8g.drawBox(0,29,128,10);
  190. u8g.setColorIndex(0); // white on black
  191. u8g.setPrintPos(2,37);
  192. u8g.print("X");
  193. u8g.drawPixel(8,33);
  194. u8g.drawPixel(8,35);
  195. u8g.setPrintPos(10,37);
  196. u8g.print(ftostr31ns(current_position[X_AXIS]));
  197. u8g.setPrintPos(43,37);
  198. lcd_printPGM(PSTR("Y"));
  199. u8g.drawPixel(49,33);
  200. u8g.drawPixel(49,35);
  201. u8g.setPrintPos(51,37);
  202. u8g.print(ftostr31ns(current_position[Y_AXIS]));
  203. u8g.setPrintPos(83,37);
  204. u8g.print("Z");
  205. u8g.drawPixel(89,33);
  206. u8g.drawPixel(89,35);
  207. u8g.setPrintPos(91,37);
  208. u8g.print(ftostr31(current_position[Z_AXIS]));
  209. u8g.setColorIndex(1); // black on white
  210. // Feedrate
  211. u8g.setFont(u8g_font_6x10_marlin);
  212. u8g.setPrintPos(3,49);
  213. u8g.print(LCD_STR_FEEDRATE[0]);
  214. u8g.setFont(FONT_STATUSMENU);
  215. u8g.setPrintPos(12,48);
  216. u8g.print(itostr3(feedmultiply));
  217. u8g.print('%');
  218. // Status line
  219. u8g.setFont(FONT_STATUSMENU);
  220. u8g.setPrintPos(0,61);
  221. #ifndef FILAMENT_LCD_DISPLAY
  222. u8g.print(lcd_status_message);
  223. #else
  224. if (millis() < message_millis + 5000) { //Display both Status message line and Filament display on the last line
  225. u8g.print(lcd_status_message);
  226. }
  227. else {
  228. lcd_printPGM(PSTR("dia:"));
  229. u8g.print(ftostr12ns(filament_width_meas));
  230. lcd_printPGM(PSTR(" factor:"));
  231. u8g.print(itostr3(extrudemultiply));
  232. u8g.print('%');
  233. }
  234. #endif
  235. }
  236. static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char) {
  237. char c;
  238. uint8_t n = LCD_WIDTH - 1 - 2;
  239. if ((pre_char == '>') || (pre_char == LCD_STR_UPLEVEL[0] )) {
  240. u8g.setColorIndex(1); // black on white
  241. u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
  242. u8g.setColorIndex(0); // following text must be white on black
  243. }
  244. else {
  245. u8g.setColorIndex(1); // unmarked text is black on white
  246. }
  247. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  248. u8g.print(pre_char == '>' ? ' ' : pre_char); // Row selector is obsolete
  249. while((c = pgm_read_byte(pstr))) {
  250. u8g.print(c);
  251. pstr++;
  252. n--;
  253. }
  254. while(n--) u8g.print(' ');
  255. u8g.print(post_char);
  256. u8g.print(' ');
  257. u8g.setColorIndex(1); // restore settings to black on white
  258. }
  259. static void _drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, const char* data, bool pgm) {
  260. char c;
  261. uint8_t n = LCD_WIDTH - 1 - 2 - (pgm ? strlen_P(data) : strlen(data));
  262. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  263. u8g.print(pre_char);
  264. while( (c = pgm_read_byte(pstr)) != '\0' ) {
  265. u8g.print(c);
  266. pstr++;
  267. n--;
  268. }
  269. u8g.print(':');
  270. while(n--) u8g.print(' ');
  271. if (pgm) { lcd_printPGM(data); } else { u8g.print(data); }
  272. }
  273. #define lcd_implementation_drawmenu_setting_edit_generic(row, pstr, pre_char, data) _drawmenu_setting_edit_generic(row, pstr, pre_char, data, false)
  274. #define lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, pre_char, data) _drawmenu_setting_edit_generic(row, pstr, pre_char, data, true)
  275. #define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
  276. #define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
  277. #define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
  278. #define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
  279. #define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
  280. #define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
  281. #define lcd_implementation_drawmenu_setting_edit_float43_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
  282. #define lcd_implementation_drawmenu_setting_edit_float43(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
  283. #define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  284. #define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  285. #define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
  286. #define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
  287. #define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
  288. #define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
  289. #define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  290. #define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  291. #define lcd_implementation_drawmenu_setting_edit_bool_selected(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
  292. #define lcd_implementation_drawmenu_setting_edit_bool(row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
  293. //Add version for callback functions
  294. #define lcd_implementation_drawmenu_setting_edit_callback_int3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
  295. #define lcd_implementation_drawmenu_setting_edit_callback_int3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
  296. #define lcd_implementation_drawmenu_setting_edit_callback_float3_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
  297. #define lcd_implementation_drawmenu_setting_edit_callback_float3(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
  298. #define lcd_implementation_drawmenu_setting_edit_callback_float32_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
  299. #define lcd_implementation_drawmenu_setting_edit_callback_float32(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
  300. #define lcd_implementation_drawmenu_setting_edit_callback_float43_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr43(*(data)))
  301. #define lcd_implementation_drawmenu_setting_edit_callback_float43(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr43(*(data)))
  302. #define lcd_implementation_drawmenu_setting_edit_callback_float5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  303. #define lcd_implementation_drawmenu_setting_edit_callback_float5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  304. #define lcd_implementation_drawmenu_setting_edit_callback_float52_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
  305. #define lcd_implementation_drawmenu_setting_edit_callback_float52(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
  306. #define lcd_implementation_drawmenu_setting_edit_callback_float51_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
  307. #define lcd_implementation_drawmenu_setting_edit_callback_float51(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
  308. #define lcd_implementation_drawmenu_setting_edit_callback_long5_selected(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  309. #define lcd_implementation_drawmenu_setting_edit_callback_long5(row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  310. #define lcd_implementation_drawmenu_setting_edit_callback_bool_selected(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
  311. #define lcd_implementation_drawmenu_setting_edit_callback_bool(row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(row, pstr, ' ', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
  312. void lcd_implementation_drawedit(const char* pstr, char* value) {
  313. u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
  314. u8g.setFont(u8g_font_9x18);
  315. lcd_printPGM(pstr);
  316. u8g.print(':');
  317. u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
  318. u8g.print(value);
  319. }
  320. static void _drawmenu_sd(uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir, bool isSelected) {
  321. char c;
  322. uint8_t n = LCD_WIDTH - 1;
  323. if (longFilename[0] != '\0') {
  324. filename = longFilename;
  325. longFilename[n] = '\0';
  326. }
  327. if (isSelected) {
  328. u8g.setColorIndex(1); // black on white
  329. u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
  330. u8g.setColorIndex(0); // following text must be white on black
  331. }
  332. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  333. u8g.print(' '); // Indent by 1 char
  334. if (isDir) u8g.print(LCD_STR_FOLDER[0]);
  335. while((c = *filename) != '\0') {
  336. u8g.print(c);
  337. filename++;
  338. n--;
  339. }
  340. while(n--) u8g.print(' ');
  341. if (isSelected) u8g.setColorIndex(1); // black on white
  342. }
  343. #define lcd_implementation_drawmenu_sdfile_selected(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, false, true)
  344. #define lcd_implementation_drawmenu_sdfile(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, false, false)
  345. #define lcd_implementation_drawmenu_sddirectory_selected(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, true, true)
  346. #define lcd_implementation_drawmenu_sddirectory(row, pstr, filename, longFilename) _drawmenu_sd(row, pstr, filename, longFilename, true, false)
  347. #define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
  348. #define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
  349. #define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
  350. #define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
  351. #define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
  352. #define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
  353. #define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
  354. #define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
  355. static void lcd_implementation_quick_feedback() {
  356. #if BEEPER > -1
  357. SET_OUTPUT(BEEPER);
  358. for(int8_t i=0; i<10; i++) {
  359. WRITE(BEEPER,HIGH);
  360. delay(3);
  361. WRITE(BEEPER,LOW);
  362. delay(3);
  363. }
  364. #endif
  365. }
  366. #endif //__DOGM_LCD_IMPLEMENTATION_H