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.

ultralcd_implementation_hitachi_HD44780.h 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. #ifndef ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
  2. #define ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H
  3. /**
  4. * Implementation of the LCD display routines for a hitachi HD44780 display. These are common LCD character displays.
  5. * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
  6. **/
  7. #if LANGUAGE_CHOICE == 6
  8. #include "LiquidCrystalRus.h"
  9. #define LCD_CLASS LiquidCrystalRus
  10. #else
  11. #include <LiquidCrystal.h>
  12. #define LCD_CLASS LiquidCrystal
  13. #endif
  14. /* Custom characters defined in the first 8 characters of the LCD */
  15. #define LCD_STR_BEDTEMP "\x00"
  16. #define LCD_STR_DEGREE "\x01"
  17. #define LCD_STR_THERMOMETER "\x02"
  18. #define LCD_STR_UPLEVEL "\x03"
  19. #define LCD_STR_REFRESH "\x04"
  20. #define LCD_STR_FOLDER "\x05"
  21. #define LCD_STR_FEEDRATE "\x06"
  22. #define LCD_STR_CLOCK "\x07"
  23. #define LCD_STR_ARROW_RIGHT "\x7E" /* from the default character set */
  24. LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7); //RS,Enable,D4,D5,D6,D7
  25. static void lcd_implementation_init()
  26. {
  27. byte bedTemp[8] =
  28. {
  29. B00000,
  30. B11111,
  31. B10101,
  32. B10001,
  33. B10101,
  34. B11111,
  35. B00000,
  36. B00000
  37. }; //thanks Sonny Mounicou
  38. byte degree[8] =
  39. {
  40. B01100,
  41. B10010,
  42. B10010,
  43. B01100,
  44. B00000,
  45. B00000,
  46. B00000,
  47. B00000
  48. };
  49. byte thermometer[8] =
  50. {
  51. B00100,
  52. B01010,
  53. B01010,
  54. B01010,
  55. B01010,
  56. B10001,
  57. B10001,
  58. B01110
  59. };
  60. byte uplevel[8]={
  61. B00100,
  62. B01110,
  63. B11111,
  64. B00100,
  65. B11100,
  66. B00000,
  67. B00000,
  68. B00000
  69. }; //thanks joris
  70. byte refresh[8]={
  71. B00000,
  72. B00110,
  73. B11001,
  74. B11000,
  75. B00011,
  76. B10011,
  77. B01100,
  78. B00000,
  79. }; //thanks joris
  80. byte folder [8]={
  81. B00000,
  82. B11100,
  83. B11111,
  84. B10001,
  85. B10001,
  86. B11111,
  87. B00000,
  88. B00000
  89. }; //thanks joris
  90. byte feedrate [8]={
  91. B11100,
  92. B10000,
  93. B11000,
  94. B10111,
  95. B00101,
  96. B00110,
  97. B00101,
  98. B00000
  99. }; //thanks Sonny Mounicou
  100. byte clock [8]={
  101. B00000,
  102. B01110,
  103. B10011,
  104. B10101,
  105. B10001,
  106. B01110,
  107. B00000,
  108. B00000
  109. }; //thanks Sonny Mounicou
  110. lcd.begin(LCD_WIDTH, LCD_HEIGHT);
  111. lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
  112. lcd.createChar(LCD_STR_DEGREE[0], degree);
  113. lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);
  114. lcd.createChar(LCD_STR_UPLEVEL[0], uplevel);
  115. lcd.createChar(LCD_STR_REFRESH[0], refresh);
  116. lcd.createChar(LCD_STR_FOLDER[0], folder);
  117. lcd.createChar(LCD_STR_FEEDRATE[0], feedrate);
  118. lcd.createChar(LCD_STR_CLOCK[0], clock);
  119. lcd.clear();
  120. }
  121. static void lcd_implementation_clear()
  122. {
  123. lcd.clear();
  124. }
  125. /* Arduino < 1.0.0 is missing a function to print PROGMEM strings, so we need to implement our own */
  126. static void lcd_printPGM(const char* str)
  127. {
  128. char c;
  129. while((c = pgm_read_byte(str++)) != '\0')
  130. {
  131. lcd.write(c);
  132. }
  133. }
  134. /*
  135. Possible status screens:
  136. 16x2 |0123456789012345|
  137. |000/000 B000/000|
  138. |Status line.....|
  139. 16x4 |0123456789012345|
  140. |000/000 B000/000|
  141. |SD100% Z000.0|
  142. |F100% T--:--|
  143. |Status line.....|
  144. 20x2 |01234567890123456789|
  145. |T000/000D B000/000D |
  146. |Status line.........|
  147. 20x4 |01234567890123456789|
  148. |T000/000D B000/000D |
  149. |X+000.0 Y+000.0 Z+000.0|
  150. |F100% SD100% T--:--|
  151. |Status line.........|
  152. 20x4 |01234567890123456789|
  153. |T000/000D B000/000D |
  154. |T000/000D Z000.0|
  155. |F100% SD100% T--:--|
  156. |Status line.........|
  157. */
  158. static void lcd_implementation_status_screen()
  159. {
  160. int tHotend=int(degHotend(0) + 0.5);
  161. int tTarget=int(degTargetHotend(0) + 0.5);
  162. #if LCD_WIDTH < 20
  163. lcd.setCursor(0, 0);
  164. lcd.print(itostr3(tHotend));
  165. lcd.print('/');
  166. lcd.print(itostr3left(tTarget));
  167. # if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
  168. //If we have an 2nd extruder or heated bed, show that in the top right corner
  169. lcd.setCursor(8, 0);
  170. # if EXTRUDERS > 1
  171. tHotend = int(degHotend(1) + 0.5);
  172. tTarget = int(degTargetHotend(1) + 0.5);
  173. lcd.print(LCD_STR_THERMOMETER[0]);
  174. # else//Heated bed
  175. tHotend=int(degBed() + 0.5);
  176. tTarget=int(degTargetBed() + 0.5);
  177. lcd.print(LCD_STR_BEDTEMP[0]);
  178. # endif
  179. lcd.print(itostr3(tHotend));
  180. lcd.print('/');
  181. lcd.print(itostr3left(tTarget));
  182. # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
  183. #else//LCD_WIDTH > 19
  184. lcd.setCursor(0, 0);
  185. lcd.print(LCD_STR_THERMOMETER[0]);
  186. lcd.print(itostr3(tHotend));
  187. lcd.print('/');
  188. lcd.print(itostr3left(tTarget));
  189. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  190. if (tTarget < 10)
  191. lcd.print(' ');
  192. # if EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
  193. //If we have an 2nd extruder or heated bed, show that in the top right corner
  194. lcd.setCursor(10, 0);
  195. # if EXTRUDERS > 1
  196. tHotend = int(degHotend(1) + 0.5);
  197. tTarget = int(degTargetHotend(1) + 0.5);
  198. lcd.print(LCD_STR_THERMOMETER[0]);
  199. # else//Heated bed
  200. tHotend=int(degBed() + 0.5);
  201. tTarget=int(degTargetBed() + 0.5);
  202. lcd.print(LCD_STR_BEDTEMP[0]);
  203. # endif
  204. lcd.print(itostr3(tHotend));
  205. lcd.print('/');
  206. lcd.print(itostr3left(tTarget));
  207. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  208. if (tTarget < 10)
  209. lcd.print(' ');
  210. # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
  211. #endif//LCD_WIDTH > 19
  212. #if LCD_HEIGHT > 2
  213. //Lines 2 for 4 line LCD
  214. # if LCD_WIDTH < 20
  215. # ifdef SDSUPPORT
  216. lcd.setCursor(0, 2);
  217. lcd_printPGM(PSTR("SD"));
  218. if (IS_SD_PRINTING)
  219. lcd.print(itostr3(card.percentDone()));
  220. else
  221. lcd_printPGM(PSTR("---"));
  222. lcd.print('%');
  223. # endif//SDSUPPORT
  224. # else//LCD_WIDTH > 19
  225. # if EXTRUDERS > 1 && TEMP_SENSOR_BED != 0
  226. //If we both have a 2nd extruder and a heated bed, show the heated bed temp on the 2nd line on the left, as the first line is filled with extruder temps
  227. tHotend=int(degBed() + 0.5);
  228. tTarget=int(degTargetBed() + 0.5);
  229. lcd.setCursor(0, 1);
  230. lcd.print(LCD_STR_BEDTEMP[0]);
  231. lcd.print(itostr3(tHotend));
  232. lcd.print('/');
  233. lcd.print(itostr3left(tTarget));
  234. lcd_printPGM(PSTR(LCD_STR_DEGREE " "));
  235. if (tTarget < 10)
  236. lcd.print(' ');
  237. # else
  238. lcd.setCursor(0,1);
  239. lcd.print('X');
  240. lcd.print(ftostr3(current_position[X_AXIS]));
  241. lcd_printPGM(PSTR(" Y"));
  242. lcd.print(ftostr3(current_position[Y_AXIS]));
  243. # endif//EXTRUDERS > 1 || TEMP_SENSOR_BED != 0
  244. # endif//LCD_WIDTH > 19
  245. lcd.setCursor(LCD_WIDTH - 8, 1);
  246. lcd.print('Z');
  247. lcd.print(ftostr32(current_position[Z_AXIS]));
  248. #endif//LCD_HEIGHT > 2
  249. #if LCD_HEIGHT > 3
  250. lcd.setCursor(0, 2);
  251. lcd.print(LCD_STR_FEEDRATE[0]);
  252. lcd.print(itostr3(feedmultiply));
  253. lcd.print('%');
  254. # if LCD_WIDTH > 19
  255. # ifdef SDSUPPORT
  256. lcd.setCursor(7, 2);
  257. lcd_printPGM(PSTR("SD"));
  258. if (IS_SD_PRINTING)
  259. lcd.print(itostr3(card.percentDone()));
  260. else
  261. lcd_printPGM(PSTR("---"));
  262. lcd.print('%');
  263. # endif//SDSUPPORT
  264. # endif//LCD_WIDTH > 19
  265. lcd.setCursor(LCD_WIDTH - 6, 2);
  266. lcd.print(LCD_STR_CLOCK[0]);
  267. if(starttime != 0)
  268. {
  269. uint16_t time = millis()/60000 - starttime/60000;
  270. lcd.print(itostr2(time/60));
  271. lcd.print(':');
  272. lcd.print(itostr2(time%60));
  273. }else{
  274. lcd_printPGM(PSTR("--:--"));
  275. }
  276. #endif
  277. //Status message line on the last line
  278. lcd.setCursor(0, LCD_HEIGHT - 1);
  279. lcd.print(lcd_status_message);
  280. }
  281. static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
  282. {
  283. char c;
  284. //Use all characters in narrow LCDs
  285. #if LCD_WIDTH < 20
  286. uint8_t n = LCD_WIDTH - 1 - 1;
  287. #else
  288. uint8_t n = LCD_WIDTH - 1 - 2;
  289. #endif
  290. lcd.setCursor(0, row);
  291. lcd.print(pre_char);
  292. while((c = pgm_read_byte(pstr)) != '\0')
  293. {
  294. lcd.print(c);
  295. pstr++;
  296. n--;
  297. }
  298. while(n--)
  299. lcd.print(' ');
  300. lcd.print(post_char);
  301. lcd.print(' ');
  302. }
  303. static void lcd_implementation_drawmenu_setting_edit_generic(uint8_t row, const char* pstr, char pre_char, char* data)
  304. {
  305. char c;
  306. //Use all characters in narrow LCDs
  307. #if LCD_WIDTH < 20
  308. uint8_t n = LCD_WIDTH - 1 - 1 - strlen(data);
  309. #else
  310. uint8_t n = LCD_WIDTH - 1 - 2 - strlen(data);
  311. #endif
  312. lcd.setCursor(0, row);
  313. lcd.print(pre_char);
  314. while((c = pgm_read_byte(pstr)) != '\0')
  315. {
  316. lcd.print(c);
  317. pstr++;
  318. n--;
  319. }
  320. lcd.print(':');
  321. while(n--)
  322. lcd.print(' ');
  323. lcd.print(data);
  324. }
  325. static void lcd_implementation_drawmenu_setting_edit_generic_P(uint8_t row, const char* pstr, char pre_char, const char* data)
  326. {
  327. char c;
  328. //Use all characters in narrow LCDs
  329. #if LCD_WIDTH < 20
  330. uint8_t n = LCD_WIDTH - 1 - 1 - strlen_P(data);
  331. #else
  332. uint8_t n = LCD_WIDTH - 1 - 2 - strlen_P(data);
  333. #endif
  334. lcd.setCursor(0, row);
  335. lcd.print(pre_char);
  336. while((c = pgm_read_byte(pstr)) != '\0')
  337. {
  338. lcd.print(c);
  339. pstr++;
  340. n--;
  341. }
  342. lcd.print(':');
  343. while(n--)
  344. lcd.print(' ');
  345. lcd_printPGM(data);
  346. }
  347. #define lcd_implementation_drawmenu_setting_edit_int3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', itostr3(*(data)))
  348. #define lcd_implementation_drawmenu_setting_edit_int3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', itostr3(*(data)))
  349. #define lcd_implementation_drawmenu_setting_edit_float3_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr3(*(data)))
  350. #define lcd_implementation_drawmenu_setting_edit_float3(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr3(*(data)))
  351. #define lcd_implementation_drawmenu_setting_edit_float32_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr32(*(data)))
  352. #define lcd_implementation_drawmenu_setting_edit_float32(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr32(*(data)))
  353. #define lcd_implementation_drawmenu_setting_edit_float5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  354. #define lcd_implementation_drawmenu_setting_edit_float5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  355. #define lcd_implementation_drawmenu_setting_edit_float52_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr52(*(data)))
  356. #define lcd_implementation_drawmenu_setting_edit_float52(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr52(*(data)))
  357. #define lcd_implementation_drawmenu_setting_edit_float51_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr51(*(data)))
  358. #define lcd_implementation_drawmenu_setting_edit_float51(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr51(*(data)))
  359. #define lcd_implementation_drawmenu_setting_edit_long5_selected(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, '>', ftostr5(*(data)))
  360. #define lcd_implementation_drawmenu_setting_edit_long5(row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(row, pstr, ' ', ftostr5(*(data)))
  361. #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))
  362. #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))
  363. //Add version for callback functions
  364. #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)))
  365. #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)))
  366. #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)))
  367. #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)))
  368. #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)))
  369. #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)))
  370. #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)))
  371. #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)))
  372. #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)))
  373. #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)))
  374. #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)))
  375. #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)))
  376. #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)))
  377. #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)))
  378. #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))
  379. #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))
  380. void lcd_implementation_drawedit(const char* pstr, char* value)
  381. {
  382. lcd.setCursor(1, 1);
  383. lcd_printPGM(pstr);
  384. lcd.print(':');
  385. #if LCD_WIDTH < 20
  386. lcd.setCursor(LCD_WIDTH - strlen(value), 1);
  387. #else
  388. lcd.setCursor(LCD_WIDTH -1 - strlen(value), 1);
  389. #endif
  390. lcd.print(value);
  391. }
  392. static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  393. {
  394. char c;
  395. uint8_t n = LCD_WIDTH - 1;
  396. lcd.setCursor(0, row);
  397. lcd.print('>');
  398. if (longFilename[0] != '\0')
  399. {
  400. filename = longFilename;
  401. longFilename[LCD_WIDTH-1] = '\0';
  402. }
  403. while((c = *filename) != '\0')
  404. {
  405. lcd.print(c);
  406. filename++;
  407. n--;
  408. }
  409. while(n--)
  410. lcd.print(' ');
  411. }
  412. static void lcd_implementation_drawmenu_sdfile(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  413. {
  414. char c;
  415. uint8_t n = LCD_WIDTH - 1;
  416. lcd.setCursor(0, row);
  417. lcd.print(' ');
  418. if (longFilename[0] != '\0')
  419. {
  420. filename = longFilename;
  421. longFilename[LCD_WIDTH-1] = '\0';
  422. }
  423. while((c = *filename) != '\0')
  424. {
  425. lcd.print(c);
  426. filename++;
  427. n--;
  428. }
  429. while(n--)
  430. lcd.print(' ');
  431. }
  432. static void lcd_implementation_drawmenu_sddirectory_selected(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  433. {
  434. char c;
  435. uint8_t n = LCD_WIDTH - 2;
  436. lcd.setCursor(0, row);
  437. lcd.print('>');
  438. lcd.print(LCD_STR_FOLDER[0]);
  439. if (longFilename[0] != '\0')
  440. {
  441. filename = longFilename;
  442. longFilename[LCD_WIDTH-2] = '\0';
  443. }
  444. while((c = *filename) != '\0')
  445. {
  446. lcd.print(c);
  447. filename++;
  448. n--;
  449. }
  450. while(n--)
  451. lcd.print(' ');
  452. }
  453. static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pstr, const char* filename, char* longFilename)
  454. {
  455. char c;
  456. uint8_t n = LCD_WIDTH - 2;
  457. lcd.setCursor(0, row);
  458. lcd.print(' ');
  459. lcd.print(LCD_STR_FOLDER[0]);
  460. if (longFilename[0] != '\0')
  461. {
  462. filename = longFilename;
  463. longFilename[LCD_WIDTH-2] = '\0';
  464. }
  465. while((c = *filename) != '\0')
  466. {
  467. lcd.print(c);
  468. filename++;
  469. n--;
  470. }
  471. while(n--)
  472. lcd.print(' ');
  473. }
  474. #define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
  475. #define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
  476. #define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
  477. #define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
  478. #define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
  479. #define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
  480. #define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
  481. #define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
  482. static void lcd_implementation_quick_feedback()
  483. {
  484. #if BEEPER > -1
  485. SET_OUTPUT(BEEPER);
  486. for(int8_t i=0;i<10;i++)
  487. {
  488. WRITE(BEEPER,HIGH);
  489. delay(3);
  490. WRITE(BEEPER,LOW);
  491. delay(3);
  492. }
  493. #endif
  494. }
  495. #endif//ULTRA_LCD_IMPLEMENTATION_HITACHI_HD44780_H