My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

dogm_lcd_implementation.h 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  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 ULTRA_LCD_IMPLEMENTATION_DOGM_H
  14. #define ULTRA_LCD_IMPLEMENTATION_DOGM_H
  15. /**
  16. * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
  17. **/
  18. // CHANGE_DE begin ***
  19. #include <U8glib.h> // DE_U8glib
  20. #include "DOGMbitmaps.h"
  21. #include "dogm_font_data_marlin.h"
  22. #include "ultralcd.h"
  23. /* Russian language not supported yet, needs custom font
  24. #if LANGUAGE_CHOICE == 6
  25. #include "LiquidCrystalRus.h"
  26. #define LCD_CLASS LiquidCrystalRus
  27. #else
  28. #include <LiquidCrystal.h>
  29. #define LCD_CLASS LiquidCrystal
  30. #endif
  31. */
  32. // DOGM parameters (size in pixels)
  33. #define DOG_CHAR_WIDTH 6
  34. #define DOG_CHAR_HEIGHT 12
  35. #define DOG_CHAR_WIDTH_LARGE 9
  36. #define DOG_CHAR_HEIGHT_LARGE 18
  37. #define START_ROW 0
  38. /* Custom characters defined in font font_6x10_marlin.c */
  39. #define LCD_STR_BEDTEMP "\xFE"
  40. #define LCD_STR_DEGREE "\xB0"
  41. #define LCD_STR_THERMOMETER "\xFF"
  42. #define LCD_STR_UPLEVEL "\xFB"
  43. #define LCD_STR_REFRESH "\xF8"
  44. #define LCD_STR_FOLDER "\xF9"
  45. #define LCD_STR_FEEDRATE "\xFD"
  46. #define LCD_STR_CLOCK "\xFC"
  47. #define LCD_STR_ARROW_RIGHT "\xFA"
  48. #define FONT_STATUSMENU u8g_font_6x9
  49. // LCD selection
  50. #ifdef U8GLIB_ST7920
  51. // SPI Com: SCK = en = (D4), MOSI = rw = (RS), CS = di = (ENABLE)
  52. U8GLIB_ST7920_128X64_1X u8g(LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS);
  53. #else
  54. U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0); // HW-SPI Com: CS, A0
  55. #endif
  56. static void lcd_implementation_init()
  57. {
  58. // Uncomment this if you have the first generation (V1.10) of STBs board
  59. // pinMode(17, OUTPUT); // Enable LCD backlight
  60. // digitalWrite(17, HIGH);
  61. u8g.firstPage();
  62. do {
  63. u8g.setFont(u8g_font_6x10_marlin);
  64. u8g.setColorIndex(1);
  65. u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
  66. u8g.setColorIndex(1);
  67. } while( u8g.nextPage() );
  68. #ifdef LCD_SCREEN_ROT_90
  69. u8g.setRot90(); // Rotate screen by 90°
  70. #endif
  71. #ifdef LCD_SCREEN_ROT_180;
  72. u8g.setRot180(); // Rotate screen by 180°
  73. #endif
  74. #ifdef LCD_SCREEN_ROT_270;
  75. u8g.setRot270(); // Rotate screen by 270°
  76. #endif
  77. u8g.firstPage();
  78. do {
  79. // RepRap init bmp
  80. u8g.drawBitmapP(0,0,START_BMPBYTEWIDTH,START_BMPHEIGHT,start_bmp);
  81. // Welcome message
  82. u8g.setFont(u8g_font_6x10_marlin);
  83. u8g.drawStr(62,10,"MARLIN");
  84. u8g.setFont(u8g_font_5x8);
  85. u8g.drawStr(62,19,"V1.0.0 RC2");
  86. u8g.setFont(u8g_font_6x10_marlin);
  87. u8g.drawStr(62,28,"by ErikZalm");
  88. u8g.drawStr(62,41,"DOGM128 LCD");
  89. u8g.setFont(u8g_font_5x8);
  90. u8g.drawStr(62,48,"enhancements");
  91. u8g.setFont(u8g_font_5x8);
  92. u8g.drawStr(62,55,"by STB");
  93. u8g.drawStr(62,61,"uses u");
  94. u8g.drawStr90(92,57,"8");
  95. u8g.drawStr(100,61,"glib");
  96. } while( u8g.nextPage() );
  97. }
  98. static void lcd_implementation_clear()
  99. {
  100. // NO NEED TO IMPLEMENT LIKE SO. Picture loop automatically clears the display.
  101. //
  102. // Check this article: http://arduino.cc/forum/index.php?topic=91395.25;wap2
  103. //
  104. // u8g.firstPage();
  105. // do {
  106. // u8g.setColorIndex(0);
  107. // u8g.drawBox (0, 0, u8g.getWidth(), u8g.getHeight());
  108. // u8g.setColorIndex(1);
  109. // } while( u8g.nextPage() );
  110. }
  111. /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
  112. static void lcd_printPGM(const char* str)
  113. {
  114. char c;
  115. while((c = pgm_read_byte(str++)) != '\0')
  116. {
  117. u8g.print(c);
  118. }
  119. }
  120. static void lcd_implementation_status_screen()
  121. {
  122. static unsigned char fan_rot = 0;
  123. u8g.setColorIndex(1); // black on white
  124. // Symbols menu graphics, animated fan
  125. if ((blink % 2) && fanSpeed ) u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen0_bmp);
  126. else u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT,status_screen1_bmp);
  127. #ifdef SDSUPPORT
  128. //SD Card Symbol
  129. u8g.drawBox(42,42,8,7);
  130. u8g.drawBox(50,44,2,5);
  131. u8g.drawFrame(42,49,10,4);
  132. u8g.drawPixel(50,43);
  133. // Progress bar
  134. u8g.drawFrame(54,49,73,4);
  135. // SD Card Progress bar and clock
  136. u8g.setFont(FONT_STATUSMENU);
  137. if (IS_SD_PRINTING)
  138. {
  139. // Progress bar
  140. u8g.drawBox(55,50, (unsigned int)( (71 * card.percentDone())/100) ,2);
  141. }
  142. else {
  143. // do nothing
  144. }
  145. u8g.setPrintPos(80,47);
  146. if(starttime != 0)
  147. {
  148. uint16_t time = millis()/60000 - starttime/60000;
  149. u8g.print(itostr2(time/60));
  150. u8g.print(':');
  151. u8g.print(itostr2(time%60));
  152. }else{
  153. lcd_printPGM(PSTR("--:--"));
  154. }
  155. #endif
  156. // Extruder 1
  157. u8g.setFont(FONT_STATUSMENU);
  158. u8g.setPrintPos(6,6);
  159. u8g.print(itostr3(int(degTargetHotend(0) + 0.5)));
  160. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  161. u8g.setPrintPos(6,27);
  162. u8g.print(itostr3(int(degHotend(0) + 0.5)));
  163. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  164. if (!isHeatingHotend(0)) u8g.drawBox(13,17,2,2);
  165. else
  166. {
  167. u8g.setColorIndex(0); // white on black
  168. u8g.drawBox(13,17,2,2);
  169. u8g.setColorIndex(1); // black on white
  170. }
  171. // Extruder 2
  172. u8g.setFont(FONT_STATUSMENU);
  173. #if EXTRUDERS > 1
  174. u8g.setPrintPos(31,6);
  175. u8g.print(itostr3(int(degTargetHotend(1) + 0.5)));
  176. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  177. u8g.setPrintPos(31,27);
  178. u8g.print(itostr3(int(degHotend(1) + 0.5)));
  179. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  180. if (!isHeatingHotend(1)) u8g.drawBox(38,17,2,2);
  181. else
  182. {
  183. u8g.setColorIndex(0); // white on black
  184. u8g.drawBox(38,17,2,2);
  185. u8g.setColorIndex(1); // black on white
  186. }
  187. #else
  188. u8g.setPrintPos(31,27);
  189. u8g.print("---");
  190. #endif
  191. // Extruder 3
  192. u8g.setFont(FONT_STATUSMENU);
  193. # if EXTRUDERS > 2
  194. u8g.setPrintPos(55,6);
  195. u8g.print(itostr3(int(degTargetHotend(2) + 0.5)));
  196. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  197. u8g.setPrintPos(55,27);
  198. u8g.print(itostr3(int(degHotend(2) + 0.5)));
  199. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  200. if (!isHeatingHotend(2)) u8g.drawBox(62,17,2,2);
  201. else
  202. {
  203. u8g.setColorIndex(0); // white on black
  204. u8g.drawBox(62,17,2,2);
  205. u8g.setColorIndex(1); // black on white
  206. }
  207. #else
  208. u8g.setPrintPos(55,27);
  209. u8g.print("---");
  210. #endif
  211. // Heatbed
  212. u8g.setFont(FONT_STATUSMENU);
  213. u8g.setPrintPos(81,6);
  214. u8g.print(itostr3(int(degTargetBed() + 0.5)));
  215. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  216. u8g.setPrintPos(81,27);
  217. u8g.print(itostr3(int(degBed() + 0.5)));
  218. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  219. if (!isHeatingBed()) u8g.drawBox(88,18,2,2);
  220. else
  221. {
  222. u8g.setColorIndex(0); // white on black
  223. u8g.drawBox(88,18,2,2);
  224. u8g.setColorIndex(1); // black on white
  225. }
  226. // Fan
  227. u8g.setFont(FONT_STATUSMENU);
  228. u8g.setPrintPos(104,27);
  229. #if FAN_PIN > 0
  230. u8g.print(itostr3(int((fanSpeed*100)/256 + 1)));
  231. u8g.print("%");
  232. #else
  233. u8g.print("---");
  234. #endif
  235. // X, Y, Z-Coordinates
  236. u8g.setFont(FONT_STATUSMENU);
  237. u8g.drawBox(0,29,128,10);
  238. u8g.setColorIndex(0); // white on black
  239. u8g.setPrintPos(2,37);
  240. u8g.print("X");
  241. u8g.drawPixel(8,33);
  242. u8g.drawPixel(8,35);
  243. u8g.setPrintPos(10,37);
  244. u8g.print(ftostr31ns(current_position[X_AXIS]));
  245. u8g.setPrintPos(43,37);
  246. lcd_printPGM(PSTR("Y"));
  247. u8g.drawPixel(49,33);
  248. u8g.drawPixel(49,35);
  249. u8g.setPrintPos(51,37);
  250. u8g.print(ftostr31ns(current_position[Y_AXIS]));
  251. u8g.setPrintPos(83,37);
  252. u8g.print("Z");
  253. u8g.drawPixel(89,33);
  254. u8g.drawPixel(89,35);
  255. u8g.setPrintPos(91,37);
  256. u8g.print(ftostr31(current_position[Z_AXIS]));
  257. u8g.setColorIndex(1); // black on white
  258. // Feedrate
  259. u8g.setFont(u8g_font_6x10_marlin);
  260. u8g.setPrintPos(3,49);
  261. u8g.print(LCD_STR_FEEDRATE[0]);
  262. u8g.setFont(FONT_STATUSMENU);
  263. u8g.setPrintPos(12,48);
  264. u8g.print(itostr3(feedmultiply));
  265. u8g.print('%');
  266. // Status line
  267. u8g.setFont(FONT_STATUSMENU);
  268. u8g.setPrintPos(0,61);
  269. u8g.print(lcd_status_message);
  270. }
  271. static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
  272. {
  273. char c;
  274. uint8_t n = LCD_WIDTH - 1 - 2;
  275. if ((pre_char == '>') || (pre_char == LCD_STR_UPLEVEL[0] ))
  276. {
  277. u8g.setColorIndex(1); // black on white
  278. u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
  279. u8g.setColorIndex(0); // following text must be white on black
  280. } else u8g.setColorIndex(1); // unmarked text is black on white
  281. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  282. if (pre_char != '>') u8g.print(pre_char); else u8g.print(' '); // Row selector is obsolete
  283. while( (c = pgm_read_byte(pstr)) != '\0' )
  284. {
  285. u8g.print(c);
  286. pstr++;
  287. n--;
  288. }
  289. while(n--){
  290. u8g.print(' ');
  291. }
  292. u8g.print(post_char);
  293. u8g.print(' ');
  294. u8g.setColorIndex(1); // restore settings to black on white
  295. }
  296. static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
  297. {
  298. static unsigned int fkt_cnt = 0;
  299. char c;
  300. uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
  301. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  302. u8g.print(pre_char);
  303. while( (c = pgm_read_byte(pstr)) != '\0' )
  304. {
  305. u8g.print(c);
  306. pstr++;
  307. n--;
  308. }
  309. u8g.print(':');
  310. while(n--){
  311. u8g.print(' ');
  312. }
  313. u8g.print(data);
  314. }
  315. static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
  316. {
  317. char c;
  318. uint8_t n= LCD_WIDTH - 1 - 2 - strlen_P(data);
  319. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  320. u8g.print(pre_char);
  321. while( (c = pgm_read_byte(pstr)) != '\0' )
  322. {
  323. u8g.print(c);
  324. pstr++;
  325. n--;
  326. }
  327. u8g.print(':');
  328. while(n--){
  329. u8g.print(' ');
  330. }
  331. lcd_printPGM(data);
  332. }
  333. #define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
  334. #define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
  335. #define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
  336. #define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
  337. #define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
  338. #define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
  339. #define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  340. #define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  341. #define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
  342. #define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
  343. #define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
  344. #define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
  345. #define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  346. #define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  347. #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))
  348. #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))
  349. //Add version for callback functions
  350. #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)))
  351. #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)))
  352. #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)))
  353. #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)))
  354. #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)))
  355. #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)))
  356. #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)))
  357. #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)))
  358. #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)))
  359. #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)))
  360. #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)))
  361. #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)))
  362. #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)))
  363. #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)))
  364. #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))
  365. #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))
  366. void lcd_implementation_drawedit(const char* pstr, char* value)
  367. {
  368. u8g.setPrintPos(0 * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
  369. u8g.setFont(u8g_font_9x18);
  370. lcd_printPGM(pstr);
  371. u8g.print(':');
  372. u8g.setPrintPos((14 - strlen(value)) * DOG_CHAR_WIDTH_LARGE, (u8g.getHeight() - 1 - DOG_CHAR_HEIGHT_LARGE) - (1 * DOG_CHAR_HEIGHT_LARGE) - START_ROW );
  373. u8g.print(value);
  374. }
  375. static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  376. {
  377. char c;
  378. uint8_t n = LCD_WIDTH - 1;
  379. if (longFilename[0] != '\0')
  380. {
  381. filename = longFilename;
  382. longFilename[LCD_WIDTH-1] = '\0';
  383. }
  384. u8g.setColorIndex(1); // black on white
  385. u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
  386. u8g.setColorIndex(0); // following text must be white on black
  387. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  388. u8g.print(' '); // Indent by 1 char
  389. while((c = *filename) != '\0')
  390. {
  391. u8g.print(c);
  392. filename++;
  393. n--;
  394. }
  395. while(n--){
  396. u8g.print(' ');
  397. }
  398. u8g.setColorIndex(1); // black on white
  399. }
  400. static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  401. {
  402. char c;
  403. uint8_t n = LCD_WIDTH - 1;
  404. if (longFilename[0] != '\0')
  405. {
  406. filename = longFilename;
  407. longFilename[LCD_WIDTH-1] = '\0';
  408. }
  409. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  410. u8g.print(' ');
  411. while((c = *filename) != '\0')
  412. {
  413. u8g.print(c);
  414. filename++;
  415. n--;
  416. }
  417. while(n--){
  418. u8g.print(' ');
  419. }
  420. }
  421. static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  422. {
  423. char c;
  424. uint8_t n = LCD_WIDTH - 2;
  425. if (longFilename[0] != '\0')
  426. {
  427. filename = longFilename;
  428. longFilename[LCD_WIDTH-2] = '\0';
  429. }
  430. u8g.setColorIndex(1); // black on white
  431. u8g.drawBox (0, row*DOG_CHAR_HEIGHT + 3, 128, DOG_CHAR_HEIGHT);
  432. u8g.setColorIndex(0); // following text must be white on black
  433. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  434. u8g.print(' '); // Indent by 1 char
  435. u8g.print(LCD_STR_FOLDER[0]);
  436. while((c = *filename) != '\0')
  437. {
  438. u8g.print(c);
  439. filename++;
  440. n--;
  441. }
  442. while(n--){
  443. u8g.print(' ');
  444. }
  445. u8g.setColorIndex(1); // black on white
  446. }
  447. static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  448. {
  449. char c;
  450. uint8_t n = LCD_WIDTH - 2;
  451. if (longFilename[0] != '\0')
  452. {
  453. filename = longFilename;
  454. longFilename[LCD_WIDTH-2] = '\0';
  455. }
  456. u8g.setPrintPos(0 * DOG_CHAR_WIDTH, (row + 1) * DOG_CHAR_HEIGHT);
  457. u8g.print(' ');
  458. u8g.print(LCD_STR_FOLDER[0]);
  459. while((c = *filename) != '\0')
  460. {
  461. u8g.print(c);
  462. filename++;
  463. n--;
  464. }
  465. while(n--){
  466. u8g.print(' ');
  467. }
  468. }
  469. #define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
  470. #define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
  471. #define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
  472. #define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
  473. #define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
  474. #define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
  475. #define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
  476. #define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
  477. static void lcd_implementation_quick_feedback()
  478. {
  479. #if BEEPER > -1
  480. SET_OUTPUT(BEEPER);
  481. for(int8_t i=0;i<10;i++)
  482. {
  483. WRITE(BEEPER,HIGH);
  484. delay(3);
  485. WRITE(BEEPER,LOW);
  486. delay(3);
  487. }
  488. #endif
  489. }
  490. #endif//ULTRA_LCD_IMPLEMENTATION_DOGM_H