menu.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*
  2. menu.c
  3. */
  4. #include "menu.h"
  5. /*================================================*/
  6. void menu_DrawEdgePixel(menu_t *menu, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
  7. {
  8. w--;
  9. h--;
  10. u8g2_DrawPixel(menu->u8g2, x,y);
  11. u8g2_DrawPixel(menu->u8g2, x+w,y);
  12. u8g2_DrawPixel(menu->u8g2, x,y+h);
  13. u8g2_DrawPixel(menu->u8g2, x+w,y+h);
  14. }
  15. void menu_ClearEdgePixel(menu_t *menu, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
  16. {
  17. u8g2_SetDrawColor(menu->u8g2, 0);
  18. menu_DrawEdgePixel(menu, x, y, w, h);
  19. u8g2_SetDrawColor(menu->u8g2, 1);
  20. }
  21. void menu_DrawBoxFocus(menu_t *menu, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
  22. {
  23. u8g2_SetDrawColor(menu->u8g2, 2);
  24. u8g2_DrawBox(menu->u8g2, x, y, w, h);
  25. menu_ClearEdgePixel(menu, x, y, w, h);
  26. }
  27. void menu_DrawFrameFocus(menu_t *menu, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
  28. {
  29. menu_DrawEdgePixel(menu, x, y, w, h);
  30. x--;
  31. y--;
  32. w+=2;
  33. h+=2;
  34. u8g2_DrawFrame(menu->u8g2, x, y, w, h);
  35. menu_ClearEdgePixel(menu, x, y, w, h);
  36. }
  37. /*================================================*/
  38. /* this function must be the last function in the list. it also marks the end of a list */
  39. int me_cb_null(menu_t *menu, const me_t *me, uint8_t msg)
  40. {
  41. return 0;
  42. }
  43. /*
  44. Name: me_cb_big_toggle
  45. Val: uint8_t *
  46. Arg: Not used
  47. */
  48. int me_cb_big_toggle(menu_t *menu, const me_t *me, uint8_t msg)
  49. {
  50. uint8_t val = *(uint8_t *)(me->val);
  51. u8g2_uint_t x, y, w, h, w2;
  52. w = 16;
  53. w2 = 6;
  54. h = 10;
  55. x = me->x;
  56. y = me->y;
  57. switch(msg)
  58. {
  59. case ME_MSG_IS_FOCUS:
  60. return 1;
  61. case ME_MSG_DRAW_FOCUS:
  62. //menu_DrawFrameFocus(menu, x-1, y-1, w+2, h+2);
  63. menu_DrawFrameFocus(menu, x, y, w, h);
  64. return 1;
  65. case ME_MSG_SELECT:
  66. {
  67. val++;
  68. if ( val > 1 )
  69. val = 0;
  70. *(uint8_t *)(me->val) = val;
  71. }
  72. return 1;
  73. case ME_MSG_DRAW:
  74. menu_DrawFrameFocus(menu, x+1,y+1,w-2,h-2);
  75. if ( val == 0 )
  76. {
  77. menu_DrawFrameFocus(menu, x+3,y+3,w2-2,h-6);
  78. }
  79. else
  80. {
  81. menu_DrawBoxFocus(menu, x+w/2,y+2,w2,h-4);
  82. }
  83. return 1;
  84. }
  85. return 0;
  86. }
  87. /*
  88. Name: me_cb_wd_toggle
  89. Val: uint8_t *
  90. Arg: char *
  91. */
  92. int me_cb_wd_toggle(menu_t *menu, const me_t *me, uint8_t msg)
  93. {
  94. uint8_t val = *(uint8_t *)(me->val);
  95. u8g2_uint_t x, y, w, h;
  96. u8g2_SetFont(menu->u8g2, MENU_SMALL_FONT);
  97. w = 13;
  98. h = u8g2_GetAscent(menu->u8g2)+2;
  99. x = me->x-2;
  100. y = me->y - u8g2_GetAscent(menu->u8g2)-1;
  101. switch(msg)
  102. {
  103. case ME_MSG_IS_FOCUS:
  104. return 1;
  105. case ME_MSG_DRAW_FOCUS:
  106. menu_DrawFrameFocus(menu, x, y, w, h);
  107. return 1;
  108. case ME_MSG_SELECT:
  109. {
  110. val++;
  111. if ( val > 1 )
  112. val = 0;
  113. *(uint8_t *)(me->val) = val;
  114. }
  115. return 1;
  116. case ME_MSG_DRAW:
  117. u8g2_DrawUTF8(menu->u8g2, me->x, me->y, (const char *)(me->arg));
  118. if ( val > 0 )
  119. {
  120. menu_DrawBoxFocus(menu, x,y,w,h);
  121. }
  122. //u8g2_DrawRFrame(menu->u8g2, x, y, w, h, 1);
  123. return 1;
  124. }
  125. return 0;
  126. }
  127. /*
  128. Name: me_cb_0_9
  129. Val: uint8_t *
  130. */
  131. int me_cb_0_9(menu_t *menu, const me_t *me, uint8_t msg)
  132. {
  133. switch(msg)
  134. {
  135. case ME_MSG_IS_FOCUS:
  136. return 1;
  137. case ME_MSG_DRAW_FOCUS:
  138. u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
  139. menu_DrawBoxFocus(menu,
  140. me->x+MENU_BIG_NUM_FOCUS_XO,
  141. me->y - u8g2_GetAscent(menu->u8g2)-1,
  142. u8g2_GetGlyphWidth(menu->u8g2, '0')+MENU_BIG_NUM_FOCUS_EXTRAX,
  143. u8g2_GetAscent(menu->u8g2) + 2);
  144. return 1;
  145. case ME_MSG_SELECT:
  146. {
  147. uint8_t val = *(uint8_t *)(me->val);
  148. val++;
  149. if ( val > 9 )
  150. val = 0;
  151. *(uint8_t *)(me->val) = val;
  152. }
  153. return 1;
  154. case ME_MSG_DRAW:
  155. u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
  156. u8g2_DrawGlyph(menu->u8g2, me->x, me->y, *(uint8_t *)(me->val) + '0');
  157. return 1;
  158. }
  159. return 0;
  160. }
  161. int me_cb_0_9_ro(menu_t *menu, const me_t *me, uint8_t msg)
  162. {
  163. if ( msg == ME_MSG_IS_FOCUS )
  164. return 0;
  165. return me_cb_0_9(menu, me, msg);
  166. }
  167. /*
  168. Name: me_cb_0_5
  169. Val: uint8_t *
  170. */
  171. int me_cb_0_5(menu_t *menu, const me_t *me, uint8_t msg)
  172. {
  173. switch(msg)
  174. {
  175. case ME_MSG_SELECT:
  176. {
  177. uint8_t val = *(uint8_t *)(me->val);
  178. val++;
  179. if ( val > 5 )
  180. val = 0;
  181. *(uint8_t *)(me->val) = val;
  182. }
  183. return 1;
  184. }
  185. return me_cb_0_9(menu, me, msg);
  186. }
  187. /*
  188. Name: me_cb_0_23
  189. Val: uint8_t *
  190. */
  191. int me_cb_0_23(menu_t *menu, const me_t *me, uint8_t msg)
  192. {
  193. char s[4];
  194. switch(msg)
  195. {
  196. case ME_MSG_IS_FOCUS:
  197. return 1;
  198. case ME_MSG_DRAW_FOCUS:
  199. u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
  200. menu_DrawBoxFocus(menu,
  201. me->x+MENU_BIG_NUM_FOCUS_XO,
  202. me->y - u8g2_GetAscent(menu->u8g2)-1,
  203. u8g2_GetGlyphWidth(menu->u8g2, '0')*2+MENU_BIG_NUM_FOCUS_EXTRAX,
  204. u8g2_GetAscent(menu->u8g2) + 2);
  205. return 1;
  206. case ME_MSG_SELECT:
  207. {
  208. uint8_t val = *(uint8_t *)(me->val);
  209. val++;
  210. if ( val > 23 )
  211. val = 0;
  212. *(uint8_t *)(me->val) = val;
  213. }
  214. return 1;
  215. case ME_MSG_DRAW:
  216. u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
  217. s[0] = *(uint8_t *)(me->val);
  218. s[1] = s[0];
  219. s[1] %= 10;
  220. s[1] += '0';
  221. s[0] /= 10;
  222. s[0] += '0';
  223. s[2] = '\0';
  224. u8g2_DrawUTF8(menu->u8g2, me->x, me->y, s);
  225. return 1;
  226. }
  227. return 0;
  228. }
  229. int me_cb_0_23_ro(menu_t *menu, const me_t *me, uint8_t msg)
  230. {
  231. if ( msg == ME_MSG_IS_FOCUS )
  232. return 0;
  233. return me_cb_0_23(menu, me, msg);
  234. }
  235. int me_cb_0_9_small_ro(menu_t *menu, const me_t *me, uint8_t msg)
  236. {
  237. switch(msg)
  238. {
  239. case ME_MSG_IS_FOCUS:
  240. return 0;
  241. case ME_MSG_DRAW_FOCUS:
  242. return 1;
  243. case ME_MSG_SELECT:
  244. return 1;
  245. case ME_MSG_DRAW:
  246. u8g2_SetFont(menu->u8g2, MENU_SMALL_FONT);
  247. u8g2_DrawGlyph(menu->u8g2, me->x, me->y, *(uint8_t *)(me->val) + '0');
  248. return 1;
  249. }
  250. return 0;
  251. }
  252. /*
  253. Name: me_cb_0_55
  254. Val: uint8_t *
  255. */
  256. int me_cb_0_55(menu_t *menu, const me_t *me, uint8_t msg)
  257. {
  258. switch(msg)
  259. {
  260. case ME_MSG_SELECT:
  261. {
  262. uint8_t val = *(uint8_t *)(me->val);
  263. val+=5;
  264. if ( val > 55 )
  265. val = 0;
  266. *(uint8_t *)(me->val) = val;
  267. }
  268. return 1;
  269. }
  270. return me_cb_0_23(menu, me, msg);
  271. }
  272. /*
  273. Name: me_cb_1_12
  274. Val: uint8_t *
  275. */
  276. int me_cb_1_12(menu_t *menu, const me_t *me, uint8_t msg)
  277. {
  278. switch(msg)
  279. {
  280. case ME_MSG_SELECT:
  281. {
  282. uint8_t val = *(uint8_t *)(me->val);
  283. val++;
  284. if ( val > 12 )
  285. val = 1;
  286. *(uint8_t *)(me->val) = val;
  287. }
  288. return 1;
  289. }
  290. return me_cb_0_23(menu, me, msg);
  291. }
  292. /*
  293. Name: me_cb_1_31
  294. Val: uint8_t *
  295. */
  296. int me_cb_1_31(menu_t *menu, const me_t *me, uint8_t msg)
  297. {
  298. switch(msg)
  299. {
  300. case ME_MSG_SELECT:
  301. {
  302. uint8_t val = *(uint8_t *)(me->val);
  303. val++;
  304. if ( val > 31 )
  305. val = 1;
  306. *(uint8_t *)(me->val) = val;
  307. }
  308. return 1;
  309. }
  310. return me_cb_0_23(menu, me, msg);
  311. }
  312. /*
  313. Name: me_cb_num_label
  314. can not get focus
  315. Arg: char *
  316. */
  317. int me_cb_num_label(menu_t *menu, const me_t *me, uint8_t msg)
  318. {
  319. switch(msg)
  320. {
  321. case ME_MSG_IS_FOCUS:
  322. case ME_MSG_DRAW_FOCUS:
  323. case ME_MSG_SELECT:
  324. break;
  325. case ME_MSG_DRAW:
  326. u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
  327. u8g2_DrawUTF8(menu->u8g2, me->x, me->y, (char *)(me->arg) );
  328. return 1;
  329. }
  330. return 0;
  331. }
  332. /*
  333. Name: me_cb_button_full_line
  334. Val: callback function
  335. Arg: char *
  336. */
  337. int me_cb_button_full_line(menu_t *menu, const me_t *me, uint8_t msg)
  338. {
  339. int r = 0;
  340. switch(msg)
  341. {
  342. case ME_MSG_IS_FOCUS:
  343. return 1;
  344. case ME_MSG_DRAW_FOCUS:
  345. menu_DrawBoxFocus(menu,
  346. 0,
  347. me->y - u8g2_GetAscent(menu->u8g2)-1,
  348. u8g2_GetDisplayWidth(menu->u8g2) ,
  349. u8g2_GetAscent(menu->u8g2) - u8g2_GetDescent(menu->u8g2) +1);
  350. r = 1;
  351. break;
  352. case ME_MSG_DRAW:
  353. u8g2_SetFont(menu->u8g2, MENU_NORMAL_FONT);
  354. u8g2_DrawUTF8(menu->u8g2, me->x, me->y, (char *)(me->arg) );
  355. r = 1;
  356. break;
  357. }
  358. /* pass all messages except for the IS_FOCUS also to the callback function */
  359. if ( me->val != NULL )
  360. return ((me_cb)(me->val))(menu, me, msg) | r;
  361. return r;
  362. }
  363. /*
  364. Name: me_cb_button_full_line
  365. Val: callback function
  366. Arg: char *
  367. */
  368. int me_cb_button_half_line(menu_t *menu, const me_t *me, uint8_t msg)
  369. {
  370. int r = 0;
  371. switch(msg)
  372. {
  373. case ME_MSG_IS_FOCUS:
  374. return 1;
  375. case ME_MSG_DRAW_FOCUS:
  376. menu_DrawBoxFocus(menu,
  377. me->x,
  378. me->y - u8g2_GetAscent(menu->u8g2)-1,
  379. u8g2_GetDisplayWidth(menu->u8g2)/2,
  380. u8g2_GetAscent(menu->u8g2) - u8g2_GetDescent(menu->u8g2) +1);
  381. r = 1;
  382. break;
  383. case ME_MSG_DRAW:
  384. u8g2_SetFont(menu->u8g2, MENU_NORMAL_FONT);
  385. u8g2_DrawUTF8(menu->u8g2, me->x+4, me->y, (char *)(me->arg) );
  386. r = 1;
  387. break;
  388. }
  389. /* pass all messages except for the IS_FOCUS also to the callback function */
  390. if ( me->val != NULL )
  391. return ((me_cb)(me->val))(menu, me, msg) | r;
  392. return r;
  393. }
  394. /*
  395. Name: me_cb_button_empty
  396. Val: callback function
  397. Arg: not used
  398. */
  399. int me_cb_button_empty(menu_t *menu, const me_t *me, uint8_t msg)
  400. {
  401. if ( msg == ME_MSG_IS_FOCUS )
  402. return 1;
  403. if ( me->val != NULL )
  404. return ((me_cb)(me->val))(menu, me, msg);
  405. return 0;
  406. }
  407. /*
  408. Name: me_cb_scale_1_7
  409. Val: uint8_t *
  410. */
  411. void set_contrast(void);
  412. int me_cb_scale_1_7(menu_t *menu, const me_t *me, uint8_t msg)
  413. {
  414. u8g2_uint_t x;
  415. uint8_t val = *(uint8_t *)(me->val);
  416. if ( val <= 0 )
  417. val = 1;
  418. x = me->x+(val-1)*5;
  419. switch(msg)
  420. {
  421. case ME_MSG_IS_FOCUS:
  422. return 1;
  423. case ME_MSG_DRAW_FOCUS:
  424. /*
  425. u8g2_SetFont(menu->u8g2, MENU_BIG_NUM);
  426. menu_DrawBoxFocus(menu,
  427. me->x+MENU_BIG_NUM_FOCUS_XO,
  428. me->y - u8g2_GetAscent(menu->u8g2)-1,
  429. u8g2_GetGlyphWidth(menu->u8g2, '0')+MENU_BIG_NUM_FOCUS_EXTRAX,
  430. u8g2_GetAscent(menu->u8g2) + 2);
  431. */
  432. u8g2_DrawBox(menu->u8g2, x-2 , me->y-2, 5, 5);
  433. return 1;
  434. case ME_MSG_SELECT:
  435. {
  436. val++;
  437. if ( val > 7 )
  438. val = 1;
  439. *(uint8_t *)(me->val) = val;
  440. }
  441. return 1;
  442. case ME_MSG_DRAW:
  443. set_contrast(); /* give user feedback... not so nice: We assume *(uint8_t *)(me->val) points to gui_data.contrast */
  444. //u8g2_SetFont(menu->u8g2, MENU_NORMAL_FONT);
  445. //u8g2_DrawGlyph(menu->u8g2, me->x, me->y-2, *(uint8_t *)(me->val) + '0');
  446. u8g2_DrawHLine(menu->u8g2, me->x, me->y, 6*5+1);
  447. u8g2_DrawVLine(menu->u8g2, me->x, me->y-2, 5);
  448. //u8g2_DrawVLine(menu->u8g2, me->x+1*5, me->y-1, 3);
  449. //u8g2_DrawVLine(menu->u8g2, me->x+2*5, me->y-1, 3);
  450. u8g2_DrawVLine(menu->u8g2, me->x+3*5, me->y-2, 5);
  451. //u8g2_DrawVLine(menu->u8g2, me->x+4*5, me->y-1, 3);
  452. //u8g2_DrawVLine(menu->u8g2, me->x+5*5, me->y-1, 3);
  453. u8g2_DrawVLine(menu->u8g2, me->x+6*5, me->y-2, 5);
  454. u8g2_DrawFrame(menu->u8g2, x-3 , me->y-3, 7, 7);
  455. u8g2_SetDrawColor(menu->u8g2, 0);
  456. u8g2_DrawBox(menu->u8g2, x-2 , me->y-2, 5, 5);
  457. /* draw color is set to 1 in the following function */
  458. menu_ClearEdgePixel(menu, x-3 , me->y-3, 7, 7);
  459. menu_DrawEdgePixel(menu, x-2 , me->y-3+1, 5, 5);
  460. return 1;
  461. }
  462. return 0;
  463. }
  464. /*
  465. Name: me_cb_label
  466. can not get focus
  467. Arg: char *
  468. */
  469. int me_cb_label(menu_t *menu, const me_t *me, uint8_t msg)
  470. {
  471. switch(msg)
  472. {
  473. case ME_MSG_IS_FOCUS:
  474. case ME_MSG_DRAW_FOCUS:
  475. case ME_MSG_SELECT:
  476. break;
  477. case ME_MSG_DRAW:
  478. u8g2_SetFont(menu->u8g2, MENU_NORMAL_FONT);
  479. u8g2_DrawUTF8(menu->u8g2, me->x, me->y, (char *)(me->arg) );
  480. return 1;
  481. }
  482. return 0;
  483. }
  484. int me_cb_inv_label(menu_t *menu, const me_t *me, uint8_t msg)
  485. {
  486. int r = me_cb_label(menu, me, msg);
  487. if ( msg == ME_MSG_DRAW )
  488. {
  489. menu_DrawBoxFocus(menu,
  490. me->x-1,
  491. me->y - u8g2_GetAscent(menu->u8g2)-1,
  492. u8g2_GetUTF8Width(menu->u8g2, (char *)(me->arg))+2,
  493. u8g2_GetAscent(menu->u8g2) + 2);
  494. }
  495. return r;
  496. }
  497. /*
  498. Name: me_cb_button_full_line
  499. Val: callback function
  500. Arg: bitmap
  501. */
  502. int me_cb_16x16_bitmap_button(menu_t *menu, const me_t *me, uint8_t msg)
  503. {
  504. int r = 0;
  505. switch(msg)
  506. {
  507. case ME_MSG_IS_FOCUS:
  508. return 1;
  509. case ME_MSG_DRAW_FOCUS:
  510. /*
  511. menu_DrawFrameFocus(menu,
  512. me->x-1,
  513. me->y-1,
  514. 16+2,
  515. 16+2);
  516. */
  517. menu_DrawFrameFocus(menu,
  518. me->x,
  519. me->y,
  520. 16,
  521. 16);
  522. r = 1;
  523. break;
  524. case ME_MSG_DRAW:
  525. u8g2_DrawXBM(menu->u8g2, me->x, me->y, 16, 16, (const uint8_t *)(me->arg));
  526. r = 1;
  527. break;
  528. }
  529. /* pass all messages except for the IS_FOCUS also to the callback function */
  530. if ( me->val != NULL )
  531. return ((me_cb)(me->val))(menu, me, msg) | r;
  532. return r;
  533. }
  534. /*================================================*/
  535. /* call menu element from menu->current_index */
  536. int menu_CallME(menu_t *menu, uint8_t msg)
  537. {
  538. const me_t *me;
  539. me = menu->me_list+menu->current_index;
  540. return me->cb(menu, me, msg);
  541. }
  542. /* stay on current focus if valid, move to next valid focus */
  543. static void menu_CalcNextValidFocus(menu_t *menu) U8G2_NOINLINE;
  544. static void menu_CalcNextValidFocus(menu_t *menu)
  545. {
  546. for(;;)
  547. {
  548. menu->current_index = menu->focus_index;
  549. if ( menu->current_index >= menu->me_count )
  550. break;
  551. if ( menu_CallME(menu, ME_MSG_IS_FOCUS) != 0 )
  552. break;
  553. menu->focus_index++;
  554. }
  555. }
  556. /* advance current focus to the next element */
  557. void menu_NextFocus(menu_t *menu)
  558. {
  559. menu->focus_index++;
  560. if ( menu->focus_index >= menu->me_count )
  561. menu->focus_index = 0;
  562. menu_CalcNextValidFocus(menu);
  563. }
  564. /* send select message to the element which has the current focus */
  565. void menu_Select(menu_t *menu)
  566. {
  567. menu->current_index = menu->focus_index;
  568. menu_CallME(menu, ME_MSG_SELECT);
  569. }
  570. void menu_SetMEList(menu_t *menu, const me_t *me_list, uint16_t initial_focus)
  571. {
  572. menu->me_list = me_list;
  573. menu->me_count = 0;
  574. while( me_list[menu->me_count].cb != me_cb_null )
  575. menu->me_count++;
  576. menu->focus_index = 0;
  577. menu_CalcNextValidFocus(menu);
  578. while( initial_focus > 0 )
  579. {
  580. menu_NextFocus(menu);
  581. initial_focus--;
  582. }
  583. menu->radio_index = menu->me_count;
  584. }
  585. me_t melist_emty[] =
  586. {
  587. { me_cb_null, NULL, 0, 0 }
  588. };
  589. void menu_Init(menu_t *menu, u8g2_t *u8g2)
  590. {
  591. menu->u8g2 = u8g2;
  592. menu_SetMEList(menu, melist_emty, 0);
  593. }
  594. void menu_Draw(menu_t *menu)
  595. {
  596. for( menu->current_index = 0; menu->current_index < menu->me_count; menu->current_index++ )
  597. {
  598. menu_CallME(menu, ME_MSG_DRAW);
  599. if ( menu->current_index == menu->focus_index )
  600. {
  601. menu_CallME(menu, ME_MSG_DRAW_FOCUS);
  602. }
  603. }
  604. // u8g2_DrawHLine(menu->u8g2, 0, 32, 128);
  605. }